@pulumi/sumologic
Version:
A Pulumi package for creating and managing sumologic cloud resources.
118 lines • 4.78 kB
JavaScript
;
// *** 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.MetricsSearchV2 = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a [Sumologic Metrics Search V2][1].
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as sumologic from "@pulumi/sumologic";
*
* const personalFolder = sumologic.getPersonalFolder({});
* const exampleMetricsSearch = new sumologic.MetricsSearchV2("example_metrics_search", {
* title: "Demo Metrics Search",
* description: "Demo search description",
* folderId: personalFolder.then(personalFolder => personalFolder.id),
* queries: [{
* queryKey: "A",
* queryString: "metric=cpu_idle | avg",
* queryType: "Metrics",
* metricsQueryMode: "Advanced",
* }],
* timeRange: {
* beginBoundedTimeRange: {
* from: {
* relativeTimeRange: {
* relativeTime: "-30m",
* },
* },
* },
* },
* });
* ```
*
* ## Attributes reference
*
* In addition to all arguments above, the following attributes are exported:
*
* - `id` - The ID of the metrics search.
*
* ## Import
*
* A metrics search can be imported using it's identifier, e.g.:
*
* hcl
*
* ```sh
* $ pulumi import sumologic:index/metricsSearchV2:MetricsSearchV2 example_search 0000000007FFD79D
* ```
*
* [1]: https://help.sumologic.com/docs/metrics/metrics-queries/metrics-explorer/
*/
class MetricsSearchV2 extends pulumi.CustomResource {
/**
* Get an existing MetricsSearchV2 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 MetricsSearchV2(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of MetricsSearchV2. 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'] === MetricsSearchV2.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["folderId"] = state ? state.folderId : undefined;
resourceInputs["queries"] = state ? state.queries : undefined;
resourceInputs["timeRange"] = state ? state.timeRange : undefined;
resourceInputs["title"] = state ? state.title : undefined;
resourceInputs["visualSettings"] = state ? state.visualSettings : undefined;
}
else {
const args = argsOrState;
if ((!args || args.queries === undefined) && !opts.urn) {
throw new Error("Missing required property 'queries'");
}
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["description"] = args ? args.description : undefined;
resourceInputs["folderId"] = args ? args.folderId : undefined;
resourceInputs["queries"] = args ? args.queries : undefined;
resourceInputs["timeRange"] = args ? args.timeRange : undefined;
resourceInputs["title"] = args ? args.title : undefined;
resourceInputs["visualSettings"] = args ? args.visualSettings : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(MetricsSearchV2.__pulumiType, name, resourceInputs, opts);
}
}
exports.MetricsSearchV2 = MetricsSearchV2;
/** @internal */
MetricsSearchV2.__pulumiType = 'sumologic:index/metricsSearchV2:MetricsSearchV2';
//# sourceMappingURL=metricsSearchV2.js.map