"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.AlertingRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Provides a resource to manage vmp alerting rule
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as volcengine from "@volcengine/pulumi";
 *
 * const fooWorkspace = new volcengine.vmp.Workspace("fooWorkspace", {
 *     instanceTypeId: "vmp.standard.15d",
 *     deleteProtectionEnabled: false,
 *     description: "acc-test-1",
 *     username: "admin123",
 *     password: "Pass123456",
 * });
 * const fooContact = new volcengine.vmp.Contact("fooContact", {
 *     email: "acctest1@tftest.com",
 *     webhook: {
 *         address: "https://www.acctest1.com",
 *     },
 *     larkBotWebhook: {
 *         address: "https://www.acctest1.com",
 *     },
 *     dingTalkBotWebhook: {
 *         address: "https://www.dingacctest1.com",
 *         atMobiles: ["18046891812"],
 *     },
 *     phoneNumber: {
 *         countryCode: "+86",
 *         number: "18310101010",
 *     },
 * });
 * const foo1Contact = new volcengine.vmp.Contact("foo1Contact", {
 *     email: "acctest2@tftest.com",
 *     webhook: {
 *         address: "https://www.acctest2.com",
 *     },
 *     larkBotWebhook: {
 *         address: "https://www.acctest2.com",
 *     },
 *     dingTalkBotWebhook: {
 *         address: "https://www.dingacctest2.com",
 *         atMobiles: ["18046891813"],
 *     },
 *     phoneNumber: {
 *         countryCode: "+86",
 *         number: "18310101011",
 *     },
 * });
 * const fooContactGroup = new volcengine.vmp.ContactGroup("fooContactGroup", {contactIds: [fooContact.id]});
 * const foo1ContactGroup = new volcengine.vmp.ContactGroup("foo1ContactGroup", {contactIds: [foo1Contact.id]});
 * const fooNotifyPolicy = new volcengine.vmp.NotifyPolicy("fooNotifyPolicy", {
 *     description: "acc-test-1",
 *     levels: [
 *         {
 *             level: "P1",
 *             contactGroupIds: [fooContactGroup.id],
 *             channels: [
 *                 "Email",
 *                 "Webhook",
 *             ],
 *         },
 *         {
 *             level: "P0",
 *             contactGroupIds: [foo1ContactGroup.id],
 *             channels: ["LarkBotWebhook"],
 *         },
 *     ],
 * });
 * const fooNotifyGroupPolicy = new volcengine.vmp.NotifyGroupPolicy("fooNotifyGroupPolicy", {
 *     description: "acc-test-1",
 *     levels: [
 *         {
 *             level: "P2",
 *             groupBies: ["__rule__"],
 *             groupWait: "35",
 *             groupInterval: "60",
 *             repeatInterval: "70",
 *         },
 *         {
 *             level: "P0",
 *             groupBies: ["__rule__"],
 *             groupWait: "30",
 *             groupInterval: "60",
 *             repeatInterval: "70",
 *         },
 *         {
 *             level: "P1",
 *             groupBies: ["__rule__"],
 *             groupWait: "40",
 *             groupInterval: "75",
 *             repeatInterval: "75",
 *         },
 *     ],
 * });
 * const fooAlertingRule = new volcengine.vmp.AlertingRule("fooAlertingRule", {
 *     description: "acc-test-1",
 *     notifyPolicyId: fooNotifyPolicy.id,
 *     notifyGroupPolicyId: fooNotifyGroupPolicy.id,
 *     query: {
 *         workspaceId: fooWorkspace.id,
 *         promQl: "sum(up)",
 *     },
 *     levels: [
 *         {
 *             level: "P0",
 *             "for": "0s",
 *             comparator: ">=",
 *             threshold: 2,
 *         },
 *         {
 *             level: "P1",
 *             "for": "0s",
 *             comparator: ">=",
 *             threshold: 1,
 *         },
 *         {
 *             level: "P2",
 *             "for": "0s",
 *             comparator: ">=",
 *             threshold: 0.5,
 *         },
 *     ],
 *     annotations: [{
 *         name: "annotation",
 *         value: "acc-test",
 *     }],
 *     labels: [{
 *         name: "label",
 *         value: "acc-test",
 *     }],
 * });
 * ```
 *
 * ## Import
 *
 * VmpAlertingRule can be imported using the id, e.g.
 *
 * ```sh
 * $ pulumi import volcengine:vmp/alertingRule:AlertingRule default 5bd29e81-2717-4ac8-a1a6-d76da2b1****
 * ```
 */
class AlertingRule extends pulumi.CustomResource {
    /**
     * Get an existing AlertingRule 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 AlertingRule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
    }
    /**
     * Returns true if the given object is an instance of AlertingRule.  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'] === AlertingRule.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["annotations"] = state ? state.annotations : undefined;
            resourceInputs["createTime"] = state ? state.createTime : undefined;
            resourceInputs["description"] = state ? state.description : undefined;
            resourceInputs["labels"] = state ? state.labels : undefined;
            resourceInputs["levels"] = state ? state.levels : undefined;
            resourceInputs["name"] = state ? state.name : undefined;
            resourceInputs["notifyGroupPolicyId"] = state ? state.notifyGroupPolicyId : undefined;
            resourceInputs["notifyPolicyId"] = state ? state.notifyPolicyId : undefined;
            resourceInputs["query"] = state ? state.query : undefined;
            resourceInputs["status"] = state ? state.status : undefined;
            resourceInputs["tags"] = state ? state.tags : undefined;
            resourceInputs["updateTime"] = state ? state.updateTime : undefined;
        }
        else {
            const args = argsOrState;
            if ((!args || args.levels === undefined) && !opts.urn) {
                throw new Error("Missing required property 'levels'");
            }
            if ((!args || args.notifyGroupPolicyId === undefined) && !opts.urn) {
                throw new Error("Missing required property 'notifyGroupPolicyId'");
            }
            if ((!args || args.query === undefined) && !opts.urn) {
                throw new Error("Missing required property 'query'");
            }
            resourceInputs["annotations"] = args ? args.annotations : undefined;
            resourceInputs["description"] = args ? args.description : undefined;
            resourceInputs["labels"] = args ? args.labels : undefined;
            resourceInputs["levels"] = args ? args.levels : undefined;
            resourceInputs["name"] = args ? args.name : undefined;
            resourceInputs["notifyGroupPolicyId"] = args ? args.notifyGroupPolicyId : undefined;
            resourceInputs["notifyPolicyId"] = args ? args.notifyPolicyId : undefined;
            resourceInputs["query"] = args ? args.query : undefined;
            resourceInputs["tags"] = args ? args.tags : undefined;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["status"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(AlertingRule.__pulumiType, name, resourceInputs, opts);
    }
}
exports.AlertingRule = AlertingRule;
/** @internal */
AlertingRule.__pulumiType = 'volcengine:vmp/alertingRule:AlertingRule';
//# sourceMappingURL=alertingRule.js.map