@volcengine/pulumi
Version:
A Pulumi package for creating and managing volcengine cloud resources.
209 lines • 9.68 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.Rule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource to manage cloud monitor rule
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as volcengine from "@volcengine/pulumi";
*
* const foo = new volcengine.cloud_monitor.Rule("foo", {
* alertMethods: [
* "Email",
* "Webhook",
* ],
* conditionOperator: "||",
* conditions: [
* {
* comparisonOperator: ">",
* metricName: "DiskUsageAvail",
* metricUnit: "Megabytes",
* statistics: "avg",
* threshold: "100",
* },
* {
* comparisonOperator: ">",
* metricName: "DiskUsageUtilization",
* metricUnit: "Percent",
* statistics: "avg",
* threshold: "90",
* },
* ],
* contactGroupIds: ["174284616403161****"],
* description: "acc-test",
* effectEndAt: "22:55",
* effectStartAt: "00:15",
* enableState: "disable",
* evaluationCount: 5,
* level: "warning",
* multipleConditions: true,
* namespace: "VCM_ECS",
* originalDimensions: [
* {
* key: "ResourceID",
* values: ["*"],
* },
* {
* key: "DiskName",
* values: [
* "vda",
* "vda1",
* ],
* },
* ],
* recoveryNotify: {
* enable: true,
* },
* regions: [
* "cn-beijing",
* "cn-shanghai",
* ],
* ruleName: "acc-test-rule",
* silenceTime: 5,
* subNamespace: "Storage",
* webhookIds: [
* "187655704106731****",
* "187655712542447****",
* ],
* });
* ```
*
* ## Import
*
* CloudMonitorRule can be imported using the id, e.g.
*
* ```sh
* $ pulumi import volcengine:cloud_monitor/rule:Rule default 174284623567451****
* ```
*/
class Rule extends pulumi.CustomResource {
/**
* Get an existing Rule 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 Rule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Rule. 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'] === Rule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["alertMethods"] = state ? state.alertMethods : undefined;
resourceInputs["alertState"] = state ? state.alertState : undefined;
resourceInputs["conditionOperator"] = state ? state.conditionOperator : undefined;
resourceInputs["conditions"] = state ? state.conditions : undefined;
resourceInputs["contactGroupIds"] = state ? state.contactGroupIds : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["effectEndAt"] = state ? state.effectEndAt : undefined;
resourceInputs["effectStartAt"] = state ? state.effectStartAt : undefined;
resourceInputs["enableState"] = state ? state.enableState : undefined;
resourceInputs["evaluationCount"] = state ? state.evaluationCount : undefined;
resourceInputs["level"] = state ? state.level : undefined;
resourceInputs["multipleConditions"] = state ? state.multipleConditions : undefined;
resourceInputs["namespace"] = state ? state.namespace : undefined;
resourceInputs["originalDimensions"] = state ? state.originalDimensions : undefined;
resourceInputs["recoveryNotify"] = state ? state.recoveryNotify : undefined;
resourceInputs["regions"] = state ? state.regions : undefined;
resourceInputs["ruleName"] = state ? state.ruleName : undefined;
resourceInputs["silenceTime"] = state ? state.silenceTime : undefined;
resourceInputs["subNamespace"] = state ? state.subNamespace : undefined;
resourceInputs["updatedAt"] = state ? state.updatedAt : undefined;
resourceInputs["webHook"] = state ? state.webHook : undefined;
resourceInputs["webhookIds"] = state ? state.webhookIds : undefined;
}
else {
const args = argsOrState;
if ((!args || args.alertMethods === undefined) && !opts.urn) {
throw new Error("Missing required property 'alertMethods'");
}
if ((!args || args.conditions === undefined) && !opts.urn) {
throw new Error("Missing required property 'conditions'");
}
if ((!args || args.effectEndAt === undefined) && !opts.urn) {
throw new Error("Missing required property 'effectEndAt'");
}
if ((!args || args.effectStartAt === undefined) && !opts.urn) {
throw new Error("Missing required property 'effectStartAt'");
}
if ((!args || args.enableState === undefined) && !opts.urn) {
throw new Error("Missing required property 'enableState'");
}
if ((!args || args.evaluationCount === undefined) && !opts.urn) {
throw new Error("Missing required property 'evaluationCount'");
}
if ((!args || args.level === undefined) && !opts.urn) {
throw new Error("Missing required property 'level'");
}
if ((!args || args.namespace === undefined) && !opts.urn) {
throw new Error("Missing required property 'namespace'");
}
if ((!args || args.originalDimensions === undefined) && !opts.urn) {
throw new Error("Missing required property 'originalDimensions'");
}
if ((!args || args.regions === undefined) && !opts.urn) {
throw new Error("Missing required property 'regions'");
}
if ((!args || args.ruleName === undefined) && !opts.urn) {
throw new Error("Missing required property 'ruleName'");
}
if ((!args || args.silenceTime === undefined) && !opts.urn) {
throw new Error("Missing required property 'silenceTime'");
}
if ((!args || args.subNamespace === undefined) && !opts.urn) {
throw new Error("Missing required property 'subNamespace'");
}
resourceInputs["alertMethods"] = args ? args.alertMethods : undefined;
resourceInputs["conditionOperator"] = args ? args.conditionOperator : undefined;
resourceInputs["conditions"] = args ? args.conditions : undefined;
resourceInputs["contactGroupIds"] = args ? args.contactGroupIds : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["effectEndAt"] = args ? args.effectEndAt : undefined;
resourceInputs["effectStartAt"] = args ? args.effectStartAt : undefined;
resourceInputs["enableState"] = args ? args.enableState : undefined;
resourceInputs["evaluationCount"] = args ? args.evaluationCount : undefined;
resourceInputs["level"] = args ? args.level : undefined;
resourceInputs["multipleConditions"] = args ? args.multipleConditions : undefined;
resourceInputs["namespace"] = args ? args.namespace : undefined;
resourceInputs["originalDimensions"] = args ? args.originalDimensions : undefined;
resourceInputs["recoveryNotify"] = args ? args.recoveryNotify : undefined;
resourceInputs["regions"] = args ? args.regions : undefined;
resourceInputs["ruleName"] = args ? args.ruleName : undefined;
resourceInputs["silenceTime"] = args ? args.silenceTime : undefined;
resourceInputs["subNamespace"] = args ? args.subNamespace : undefined;
resourceInputs["webHook"] = args ? args.webHook : undefined;
resourceInputs["webhookIds"] = args ? args.webhookIds : undefined;
resourceInputs["alertState"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Rule.__pulumiType, name, resourceInputs, opts);
}
}
exports.Rule = Rule;
/** @internal */
Rule.__pulumiType = 'volcengine:cloud_monitor/rule:Rule';
//# sourceMappingURL=rule.js.map