UNPKG

@pulumi/sumologic

Version:

A Pulumi package for creating and managing sumologic cloud resources.

480 lines 22.9 kB
"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.Dashboard = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a [Sumologic Dashboard (New)][1]. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as sumologic from "@pulumi/sumologic"; * * const personalFolder = sumologic.getPersonalFolder({}); * const api_dashboard = new sumologic.Dashboard("api-dashboard", { * title: "Api Health Dashboard", * description: "Demo dashboard description", * folderId: personalFolder.then(personalFolder => personalFolder.id), * refreshInterval: 120, * theme: "Dark", * timeRange: { * beginBoundedTimeRange: { * from: { * literalTimeRange: { * rangeName: "today", * }, * }, * }, * }, * topologyLabelMap: { * datas: [ * { * label: "cluster", * values: ["api-prod"], * }, * { * label: "namespace", * values: ["default"], * }, * ], * }, * domain: "app", * panels: [ * { * textPanel: { * key: "text-panel-01", * title: "Api Health", * visualSettings: JSON.stringify({ * text: { * verticalAlignment: "top", * horizontalAlignment: "left", * fontSize: 12, * }, * }), * keepVisualSettingsConsistentWithParent: true, * text: `## Api Health Monitoring * * Use this dashboard to monitor API service health. It contains following panels: * * 1. API errors: Errors in last 12 hours * 3. API 5xx: Count of 5xx response * 3. CPU utilization: CPU utilization in last 60 mins * `, * }, * }, * { * sumoSearchPanel: { * key: "search-panel-01", * title: "Api Errors by Host", * description: "Errors in api service since last 12 hours", * visualSettings: JSON.stringify({ * general: { * mode: "timeSeries", * type: "area", * displayType: "stacked", * markerSize: 5, * lineDashType: "solid", * markerType: "square", * lineThickness: 1, * }, * title: { * fontSize: 14, * }, * legend: { * enabled: true, * verticalAlign: "bottom", * fontSize: 12, * maxHeight: 50, * showAsTable: false, * wrap: true, * }, * }), * keepVisualSettingsConsistentWithParent: true, * queries: [{ * queryString: "_sourceCategory=api error | timeslice 1h | count by _timeslice, _sourceHost | transpose row _timeslice column _sourceHost", * queryType: "Logs", * queryKey: "A", * }], * timeRange: { * beginBoundedTimeRange: { * from: { * relativeTimeRange: { * relativeTime: "-12h", * }, * }, * }, * }, * }, * }, * { * sumoSearchPanel: { * key: "metrics-panel-01", * title: "Api 5xx Response Count", * description: "Count of 5xx response from api service", * visualSettings: JSON.stringify({ * general: { * mode: "distribution", * type: "pie", * displayType: "default", * fillOpacity: 1, * startAngle: 270, * innerRadius: "40%", * maxNumOfSlices: 10, * aggregationType: "sum", * }, * title: { * fontSize: 14, * }, * }), * keepVisualSettingsConsistentWithParent: true, * queries: [{ * queryString: "_sourceCategory=api metric=Api-5xx", * queryType: "Metrics", * queryKey: "A", * metricsQueryMode: "Advanced", * }], * timeRange: { * beginBoundedTimeRange: { * from: { * literalTimeRange: { * rangeName: "today", * }, * }, * }, * }, * }, * }, * { * sumoSearchPanel: { * key: "metrics-panel-02", * title: "CPU Utilization", * description: "CPU utilization in api service", * visualSettings: JSON.stringify({ * general: { * mode: "timeSeries", * type: "line", * displayType: "smooth", * markerSize: 5, * lineDashType: "dashDot", * markerType: "none", * lineThickness: 1, * }, * title: { * fontSize: 14, * }, * }), * keepVisualSettingsConsistentWithParent: true, * queries: [ * { * queryString: "metric=Proc_CPU nite-api-1", * queryType: "Metrics", * queryKey: "A", * metricsQueryMode: "Basic", * metricsQueryData: { * metric: "Proc_CPU", * filters: [{ * key: "_sourcehost", * negation: false, * value: "nite-api-1", * }], * aggregationType: "None", * }, * }, * { * queryString: "metric=Proc_CPU nite-api-2", * queryType: "Metrics", * queryKey: "B", * metricsQueryMode: "Basic", * metricsQueryData: { * metric: "Proc_CPU", * filters: [{ * key: "_sourcehost", * negation: false, * value: "nite-api-2", * }], * aggregationType: "None", * }, * }, * ], * timeRange: { * beginBoundedTimeRange: { * from: { * relativeTimeRange: { * relativeTime: "-1h", * }, * }, * }, * }, * }, * }, * ], * layout: { * grid: { * layoutStructures: [ * { * key: "text-panel-01", * structure: "{\"height\":5,\"width\":24,\"x\":0,\"y\":0}", * }, * { * key: "search-panel-01", * structure: "{\"height\":10,\"width\":12,\"x\":0,\"y\":5}", * }, * { * key: "metrics-panel-01", * structure: "{\"height\":10,\"width\":12,\"x\":12,\"y\":5}", * }, * { * key: "metrics-panel-02", * structure: "{\"height\":10,\"width\":24,\"x\":0,\"y\":25}", * }, * ], * }, * }, * variables: [{ * name: "_sourceHost", * displayName: "Source Host", * defaultValue: "nite-api-1", * sourceDefinition: { * csvVariableSourceDefinition: { * values: "nite-api-1,nite-api-2", * }, * }, * allowMultiSelect: true, * includeAllOption: true, * hideFromUi: false, * }], * }); * ``` * * ## Attributes reference * * In addition to all arguments above, the following attributes are exported: * * - `id` - The ID of the dashboard. * * ### Schema for `topologyLabelMap` * - `data` - (Block List, Required) A list of blocks containing label and it's values. * - - `label` - (Required) The name of the topology label. * - - `values` - (Required) The values for the topology label. * * ### Schema for `timeRange` * - `completeLiteralTimeRange` - (Block List, Max: 1, Optional) Literal time range. See * completeLiteralTimeRange schema for details. * - `beginBoundedTimeRange` - (Block List, Max: 1, Optional) Bounded time range. See * beginBoundedTimeRange schema schema for details. * schema for details. * * ### Schema for `completeLiteralTimeRange` * - `rangeName` - (Required) Name of complete literal time range. One of `today`, `yesterday`, `previousWeek`, `previousMonth`. * * ### Schema for `beginBoundedTimeRange` * - `from` - (Block List, Max: 1, Required) Start boundary of bounded time range. See * timeRangeBoundary schema for details. * - `to` - (Block List, Max: 1, Optional) End boundary of bounded time range. See * timeRangeBoundary schema for details. * * ### Schema for `timeRangeBoundary` * - `epochTimeRange` - (Block List, Optional) Time since the epoch. * - `epochMillis` - (Required) Time as a number of milliseconds since the epoch. * * - `iso8601TimeRange` - (Block List, Optional) Time in ISO 8601 format. * - `iso8601Time` - (Required) Time as a string in ISO 8601 format. * * - `relativeTimeRange` - (Block List, Optional) Time in relative format. * - `relativeTime` - (Required) Relative time as a string consists of following elements: * 1. `-` (optional): minus sign indicates time in the past, * 2. `<number>`: number of time units, * 3. `<time_unit>`: time unit; possible values are: `w` (week), `d` (day), `h` (hour), `m` (minute), `s` (second). * * Multiple pairs of `<number><time_unit>` may be provided, and they may be in any order. For example, * `-2w5d3h` points to the moment in time 2 weeks, 5 days and 3 hours ago. * * - `literalTimeRange` - (Block List, Optional) Time in literal format. * - `rangeName` - (Required) One of `now`, `second`, `minute`, `hour`, `day`, `today`, `week`, `month`, `year`. * * ### Schema for `panel` * - `textPanel` - (Block List, Max: 1, Optional) A text panel. See textPanel schema for details. * - `sumoSearchPanel` - (Block List, Max: 1, Optional) A search panel. See sumoSearchPanel schema * for details. * * ### Schema for `textPanel` * - `key` - (Required) Key for the panel. Used to create searches for the queries in the panel and configure the layout * of the panel in the dashboard. * - `title` - (Optional) Title of the panel. * - `visualSettings` - (Optional) Visual settings of the panel. * - `keepVisualSettingsConsistentWithParent` - (Optional) Keeps the visual settings, like series colors, consistent * with the settings of the parent panel. * - `text` - (Required) Text to display in the panel. * * ### Schema for `sumoSearchPanel` * - `key` - (Required) Key for the panel. Used to create searches for the queries in the panel and configure the layout * of the panel in the dashboard. * - `title` - (Optional) Title of the panel. * - `visualSettings` - (Optional) Visual settings of the panel. * - `keepVisualSettingsConsistentWithParent` - (Optional) Keeps the visual settings, like series colors, consistent * with the settings of the parent panel. * - `query` - (Block List, Required) A list of queries for the panel. Can be log or metric query. See * query schema for details. * - `description` - (Optional) Description of the panel. * - `timeRange` - (Block List, Max: 1, Optional) Time range of the panel. See timeRange schema * for details. * - `linkedDashboard` - (Block List, Optional) A list of linked dashboards. See * linkedDashboard schema for details. * * ### Schema for `query` * - `queryString` - (Required) The metrics or logs query. * - `queryType` - (Required) The type of the query. One of `Metrics` or `Logs`. * - `queryKey` - (Required) The key for metric or log query. Used as an identifier for queries. * - `metricQueryMode` - (Optional) _Should only be specified for metric query_. The mode of the metric query. * One of `Basic` or `Advanced`. * - `metricQueryData` - (Optional) _Should only be specified for metric query_. Data format for the metric query. See * metricQueryData schema for details. * - `parseMode` - (Optional) This field only applies for queryType of `Logs` but other query types may be supported in the future. * Define the parsing mode to scan the JSON format log messages. Possible values are: * 1. `Auto` * 2. `Manual` * In AutoParse mode, the system automatically figures out fields to parse based on the search query. * While in the Manual mode, no fields are parsed out automatically. * For more information see [Dynamic Parsing](https://help.sumologic.com/?cid=0011). * - `timeSource` - This field only applies for queryType of `Logs` but other query types may be supported in the future. * Define the time source of this query. Possible values are `Message`, and `Receipt`. * `Message` will use the timeStamp on the message, `Receipt` will use the timestamp it was received by Sumo. * - `transient` - (Optional) This field only applies for queryType of `Metrics` but other query types may be supported in the future. Determines if the row should be returned in the response. Can be used in conjunction with a join, if only the result of the join is needed, and not the intermediate rows. Setting `transient` to `true` wherever the intermediate results aren't required speeds up the computation and reduces the amount of data transferred over the network. * - `outputCardinalityLimit` - (Optional) This field only applies for queryType of `Metrics` but other query types may be supported in the future. Specifies the output cardinality limitations for the query, which is the maximum number of timeseries returned in the result. * * ### Schema for `metricQueryData` * - `metric` - (Required) The metric of the query. * - `aggregationType` - (Optional) The type of aggregation. One of `Count`, `Minimum`, `Maximum`, `Sum`, `Average`, `None`. * - `groupBy` - The field to group the results by. * - `filter` - (Block List, Required) A list of filters for the metrics query. * - `key` - (Required) The key of the metrics filter. * - `value` - (Required) The value of the metrics filter. * - `negation` - (Optional) Whether or not the metrics filter is negated. * - `operator` - (Block List, Optional) A list of operator data for the metrics query. * * ### Schema for `operator` * - `operatorName` - (Required) The name of the metrics operator. * - `parameter` - (Block List, Required) A list of operator parameters for the operator data. * - `key` - (Required) The key of the operator parameter. * - `value` - (Required) The value of the operator parameter. * * ### Schema for `linkedDashboard` * - `id` - (Required) Identifier of the linked dashboard. * - `relativePath` - (Optional) Relative path of the linked dashboard to the dashboard of the linking panel. * - `includeTimeRange` - (Optional) Include time range from the current dashboard to the linked dashboard. _Defaults to true_. * - `includeVariables` - (Optional) Include variables from the current dashboard to the linked dashboard. _Defaults to true_. * * ### Schema for `layout` * - `grid` - (Block List, Max: 1, Optional) Panel layout for the dashboard. * * ### Schema for `grid` * - `layoutStructure` - (Block List, Required) Layout structure for the panels in the dashboard. * - `key` - (Required) The identifier of the panel that this structure applies to. It's same as `panel.key`. * - `structure` - (Required) The structure of the panel. * * ### Schema for `variable` * - `name` - (Required) Name of the variable. The variable name is case-insensitive. * - `displayName` - (Optional) Display name of the variable shown in the UI. If this field is empty, the name field will be used. * - `defaultValue` - (Optional) Default value of the variable. * - `sourceDefinition` - (Required) Source definition for variable values. See * sourceDefinition schema for details. * - `allowMultiSelect` - (Optional) Allow multiple selections in the values dropdown. * - `includeAllOption` - (Optional) Include an "All" option at the top of the variable's values dropdown. _Defaults to true._ * - `hideFromUi` - (Optional) Hide the variable in the dashboard UI. * * ### Schema for `sourceDefinition` * - `logQueryVariableSourceDefinition` - (Optional) Variable values from a log query. * - `query` - (Required) A log query. * - `field` - (Required) A field in log query to populate the variable values * - `metadataVariableSourceDefinition` - (Optional) Variable values from a metric query. * - `filter` - (Required) Filter to search the catalog. * - `key` - (Required) Return the values for this given key. * - `csvVariableSourceDefinition` - (Optional) Variable values in csv format. * - `values` - (Required) A comma separated values for the variable. * * ## Import * * Dashboard can be imported using the dashboard id, e.g.: * * hcl * * ```sh * $ pulumi import sumologic:index/dashboard:Dashboard example-dashboard q0IKwAK5t2qRI4sgiANwnS87k5S4twN2sCpTuZFSsz6ZmbENPsG7PnpqZygc * ``` * * [1]: https://help.sumologic.com/Visualizations-and-Alerts/Dashboard_(New) */ class Dashboard extends pulumi.CustomResource { /** * Get an existing Dashboard 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 Dashboard(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Dashboard. 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'] === Dashboard.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["coloringRules"] = state ? state.coloringRules : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["domain"] = state ? state.domain : undefined; resourceInputs["folderId"] = state ? state.folderId : undefined; resourceInputs["layout"] = state ? state.layout : undefined; resourceInputs["panels"] = state ? state.panels : undefined; resourceInputs["refreshInterval"] = state ? state.refreshInterval : undefined; resourceInputs["theme"] = state ? state.theme : undefined; resourceInputs["timeRange"] = state ? state.timeRange : undefined; resourceInputs["title"] = state ? state.title : undefined; resourceInputs["topologyLabelMap"] = state ? state.topologyLabelMap : undefined; resourceInputs["variables"] = state ? state.variables : undefined; } else { const args = argsOrState; if ((!args || args.timeRange === undefined) && !opts.urn) { throw new Error("Missing required property 'timeRange'"); } if ((!args || args.title === undefined) && !opts.urn) { throw new Error("Missing required property 'title'"); } resourceInputs["coloringRules"] = args ? args.coloringRules : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["domain"] = args ? args.domain : undefined; resourceInputs["folderId"] = args ? args.folderId : undefined; resourceInputs["layout"] = args ? args.layout : undefined; resourceInputs["panels"] = args ? args.panels : undefined; resourceInputs["refreshInterval"] = args ? args.refreshInterval : undefined; resourceInputs["theme"] = args ? args.theme : undefined; resourceInputs["timeRange"] = args ? args.timeRange : undefined; resourceInputs["title"] = args ? args.title : undefined; resourceInputs["topologyLabelMap"] = args ? args.topologyLabelMap : undefined; resourceInputs["variables"] = args ? args.variables : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Dashboard.__pulumiType, name, resourceInputs, opts); } } exports.Dashboard = Dashboard; /** @internal */ Dashboard.__pulumiType = 'sumologic:index/dashboard:Dashboard'; //# sourceMappingURL=dashboard.js.map