"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServiceLevelObjective = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
 * Provides a Datadog service level objective resource. This can be used to create and manage Datadog service level objectives.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as datadog from "@pulumi/datadog";
 *
 * // Metric-Based SLO
 * // Create a new Datadog service level objective
 * const foo = new datadog.ServiceLevelObjective("foo", {
 *     name: "Example Metric SLO",
 *     type: "metric",
 *     description: "My custom metric SLO",
 *     query: {
 *         numerator: "sum:my.custom.count.metric{type:good_events}.as_count()",
 *         denominator: "sum:my.custom.count.metric{*}.as_count()",
 *     },
 *     thresholds: [
 *         {
 *             timeframe: "7d",
 *             target: 99.9,
 *             warning: 99.99,
 *         },
 *         {
 *             timeframe: "30d",
 *             target: 99.9,
 *             warning: 99.99,
 *         },
 *     ],
 *     timeframe: "30d",
 *     targetThreshold: 99.9,
 *     warningThreshold: 99.99,
 *     tags: [
 *         "foo:bar",
 *         "baz",
 *     ],
 * });
 * // Metric-Based SLO using sli_specification.count
 * // Create a new Datadog service level objective
 * const metricCountSpecSlo = new datadog.ServiceLevelObjective("metric_count_spec_slo", {
 *     name: "Example Metric Count Spec SLO",
 *     type: "metric",
 *     description: "My custom metric count spec SLO",
 *     sliSpecification: {
 *         count: {
 *             goodEventsFormula: "query1",
 *             badEventsFormula: "query2",
 *             queries: [
 *                 {
 *                     metricQuery: {
 *                         name: "query1",
 *                         query: "sum:my.custom.count.metric{type:good_events}.as_count()",
 *                     },
 *                 },
 *                 {
 *                     metricQuery: {
 *                         name: "query2",
 *                         query: "sum:my.custom.count.metric{type:bad_events}.as_count()",
 *                     },
 *                 },
 *             ],
 *         },
 *     },
 *     thresholds: [
 *         {
 *             timeframe: "7d",
 *             target: 99.9,
 *             warning: 99.99,
 *         },
 *         {
 *             timeframe: "30d",
 *             target: 99.9,
 *             warning: 99.99,
 *         },
 *     ],
 *     timeframe: "30d",
 *     targetThreshold: 99.9,
 *     warningThreshold: 99.99,
 *     tags: [
 *         "foo:bar",
 *         "baz",
 *     ],
 * });
 * // Monitor-Based SLO
 * // Create a new Datadog service level objective
 * const bar = new datadog.ServiceLevelObjective("bar", {
 *     name: "Example Monitor SLO",
 *     type: "monitor",
 *     description: "My custom monitor SLO",
 *     monitorIds: [
 *         1,
 *         2,
 *         3,
 *     ],
 *     thresholds: [
 *         {
 *             timeframe: "7d",
 *             target: 99.9,
 *             warning: 99.99,
 *         },
 *         {
 *             timeframe: "30d",
 *             target: 99.9,
 *             warning: 99.99,
 *         },
 *     ],
 *     timeframe: "30d",
 *     targetThreshold: 99.9,
 *     warningThreshold: 99.99,
 *     tags: [
 *         "foo:bar",
 *         "baz",
 *     ],
 * });
 * const timeSliceSlo = new datadog.ServiceLevelObjective("time_slice_slo", {
 *     name: "Example Time Slice SLO",
 *     type: "time_slice",
 *     description: "My custom time slice SLO",
 *     sliSpecification: {
 *         timeSlice: {
 *             query: {
 *                 formula: {
 *                     formulaExpression: "query1",
 *                 },
 *                 queries: [{
 *                     metricQuery: {
 *                         name: "query1",
 *                         query: "avg:my.custom.count.metric{*}.as_count()",
 *                     },
 *                 }],
 *             },
 *             comparator: ">",
 *             threshold: 0.9,
 *         },
 *     },
 *     thresholds: [{
 *         timeframe: "7d",
 *         target: 99.9,
 *         warning: 99.99,
 *     }],
 *     timeframe: "7d",
 *     targetThreshold: 99.9,
 *     warningThreshold: 99.99,
 *     tags: [
 *         "service:myservice",
 *         "team:myteam",
 *     ],
 * });
 * ```
 *
 * ## Import
 *
 * The `pulumi import` command can be used, for example:
 *
 * Service Level Objectives can be imported using their string ID, e.g.
 *
 * ```sh
 * $ pulumi import datadog:index/serviceLevelObjective:ServiceLevelObjective baz 12345678901234567890123456789012
 * ```
 */
class ServiceLevelObjective extends pulumi.CustomResource {
    /**
     * Get an existing ServiceLevelObjective 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 ServiceLevelObjective(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'datadog:index/serviceLevelObjective:ServiceLevelObjective';
    /**
     * Returns true if the given object is an instance of ServiceLevelObjective.  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'] === ServiceLevelObjective.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["description"] = state?.description;
            resourceInputs["forceDelete"] = state?.forceDelete;
            resourceInputs["groups"] = state?.groups;
            resourceInputs["monitorIds"] = state?.monitorIds;
            resourceInputs["name"] = state?.name;
            resourceInputs["query"] = state?.query;
            resourceInputs["sliSpecification"] = state?.sliSpecification;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["targetThreshold"] = state?.targetThreshold;
            resourceInputs["thresholds"] = state?.thresholds;
            resourceInputs["timeframe"] = state?.timeframe;
            resourceInputs["type"] = state?.type;
            resourceInputs["validate"] = state?.validate;
            resourceInputs["warningThreshold"] = state?.warningThreshold;
        }
        else {
            const args = argsOrState;
            if (args?.name === undefined && !opts.urn) {
                throw new Error("Missing required property 'name'");
            }
            if (args?.thresholds === undefined && !opts.urn) {
                throw new Error("Missing required property 'thresholds'");
            }
            if (args?.type === undefined && !opts.urn) {
                throw new Error("Missing required property 'type'");
            }
            resourceInputs["description"] = args?.description;
            resourceInputs["forceDelete"] = args?.forceDelete;
            resourceInputs["groups"] = args?.groups;
            resourceInputs["monitorIds"] = args?.monitorIds;
            resourceInputs["name"] = args?.name;
            resourceInputs["query"] = args?.query;
            resourceInputs["sliSpecification"] = args?.sliSpecification;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["targetThreshold"] = args?.targetThreshold;
            resourceInputs["thresholds"] = args?.thresholds;
            resourceInputs["timeframe"] = args?.timeframe;
            resourceInputs["type"] = args?.type;
            resourceInputs["validate"] = args?.validate;
            resourceInputs["warningThreshold"] = args?.warningThreshold;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(ServiceLevelObjective.__pulumiType, name, resourceInputs, opts);
    }
}
exports.ServiceLevelObjective = ServiceLevelObjective;
//# sourceMappingURL=serviceLevelObjective.js.map