@piclemx/pulumi-opensearch
Version:
A Pulumi package for creating and managing Opensearch resources. Based on terraform-provider-opensearch: version v2.2.1
130 lines • 6.69 kB
JavaScript
"use strict";
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardObject = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides an OpenSearch Dashboards object resource. This resource interacts directly with the underlying OpenSearch index backing Dashboards, so the format must match what Dashboards the version of Dashboards is expecting. Dashboards with older versions - directly pulling the JSON from a Dashboards index of the same version of OpenSearch targeted by the provider is a workaround.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as opensearch from "@piclemx/pulumi-opensearch";
*
* const testVisualizationV6 = new opensearch.DashboardObject("testVisualizationV6", {body: `[
* {
* "_id": "visualization:response-time-percentile",
* "_type": "doc",
* "_source": {
* "type": "visualization",
* "visualization": {
* "title": "Total response time percentiles",
* "visState": "{\\"title\\":\\"Total response time percentiles\\",\\"type\\":\\"line\\",\\"params\\":{\\"addTooltip\\":true,\\"addLegend\\":true,\\"legendPosition\\":\\"right\\",\\"showCircles\\":true,\\"interpolate\\":\\"linear\\",\\"scale\\":\\"linear\\",\\"drawLinesBetweenPoints\\":true,\\"radiusRatio\\":9,\\"times\\":[],\\"addTimeMarker\\":false,\\"defaultYExtents\\":false,\\"setYExtents\\":false},\\"aggs\\":[{\\"id\\":\\"1\\",\\"enabled\\":true,\\"type\\":\\"percentiles\\",\\"schema\\":\\"metric\\",\\"params\\":{\\"field\\":\\"app.total_time\\",\\"percents\\":[50,90,95]}},{\\"id\\":\\"2\\",\\"enabled\\":true,\\"type\\":\\"date_histogram\\",\\"schema\\":\\"segment\\",\\"params\\":{\\"field\\":\\"@timestamp\\",\\"interval\\":\\"auto\\",\\"customInterval\\":\\"2h\\",\\"min_doc_count\\":1,\\"extended_bounds\\":{}}},{\\"id\\":\\"3\\",\\"enabled\\":true,\\"type\\":\\"terms\\",\\"schema\\":\\"group\\",\\"params\\":{\\"field\\":\\"system.syslog.program\\",\\"size\\":5,\\"order\\":\\"desc\\",\\"orderBy\\":\\"_term\\"}}],\\"listeners\\":{}}",
* "uiStateJSON": "{}",
* "description": "",
* "version": 1
* }
* }
* }
* ]
*
* `});
* const testVisualizationV7 = new opensearch.DashboardObject("testVisualizationV7", {body: `[
* {
* "_id": "response-time-percentile",
* "_source": {
* "type": "visualization",
* "visualization": {
* "title": "Total response time percentiles",
* "visState": "{\\"title\\":\\"Total response time percentiles\\",\\"type\\":\\"line\\",\\"params\\":{\\"addTooltip\\":true,\\"addLegend\\":true,\\"legendPosition\\":\\"right\\",\\"showCircles\\":true,\\"interpolate\\":\\"linear\\",\\"scale\\":\\"linear\\",\\"drawLinesBetweenPoints\\":true,\\"radiusRatio\\":9,\\"times\\":[],\\"addTimeMarker\\":false,\\"defaultYExtents\\":false,\\"setYExtents\\":false},\\"aggs\\":[{\\"id\\":\\"1\\",\\"enabled\\":true,\\"type\\":\\"percentiles\\",\\"schema\\":\\"metric\\",\\"params\\":{\\"field\\":\\"app.total_time\\",\\"percents\\":[50,90,95]}},{\\"id\\":\\"2\\",\\"enabled\\":true,\\"type\\":\\"date_histogram\\",\\"schema\\":\\"segment\\",\\"params\\":{\\"field\\":\\"@timestamp\\",\\"interval\\":\\"auto\\",\\"customInterval\\":\\"2h\\",\\"min_doc_count\\":1,\\"extended_bounds\\":{}}},{\\"id\\":\\"3\\",\\"enabled\\":true,\\"type\\":\\"terms\\",\\"schema\\":\\"group\\",\\"params\\":{\\"field\\":\\"system.syslog.program\\",\\"size\\":5,\\"order\\":\\"desc\\",\\"orderBy\\":\\"_term\\"}}],\\"listeners\\":{}}",
* "uiStateJSON": "{}",
* "description": "",
* "version": 1
* }
* }
* }
* ]
*
* `});
* const testIndexPatternV6 = new opensearch.DashboardObject("testIndexPatternV6", {body: `[
* {
* "_id": "index-pattern:cloudwatch",
* "_type": "doc",
* "_source": {
* "type": "index-pattern",
* "index-pattern": {
* "title": "cloudwatch-*",
* "timeFieldName": "timestamp"
* }
* }
* }
* ]
*
* `});
* const testIndexPatternV7 = new opensearch.DashboardObject("testIndexPatternV7", {body: `[
* {
* "_id": "index-pattern:cloudwatch",
* "_type": "doc",
* "_source": {
* "type": "index-pattern",
* "index-pattern": {
* "title": "cloudwatch-*",
* "timeFieldName": "timestamp"
* }
* }
* }
* ]
*
* `});
* ```
*/
class DashboardObject extends pulumi.CustomResource {
/**
* Get an existing DashboardObject resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new DashboardObject(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DashboardObject. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === DashboardObject.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["body"] = state ? state.body : undefined;
resourceInputs["index"] = state ? state.index : undefined;
}
else {
const args = argsOrState;
if ((!args || args.body === undefined) && !opts.urn) {
throw new Error("Missing required property 'body'");
}
resourceInputs["body"] = args ? args.body : undefined;
resourceInputs["index"] = args ? args.index : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DashboardObject.__pulumiType, name, resourceInputs, opts);
}
}
exports.DashboardObject = DashboardObject;
/** @internal */
DashboardObject.__pulumiType = 'opensearch:index/dashboardObject:DashboardObject';
//# sourceMappingURL=dashboardObject.js.map