"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.TagPipelineRulesets = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
 * Provides a Datadog Tag Pipeline Ruleset Order resource that can be used to manage the order of Tag Pipeline Rulesets.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as datadog from "@pulumi/datadog";
 *
 * // ============================================================================
 * // Example 1: Basic Usage - Manage the order of tag pipeline rulesets
 * // ============================================================================
 * // This example shows the default behavior where UI-defined rulesets that are
 * // not in Terraform will be preserved at the end of the order.
 * const first = new datadog.TagPipelineRuleset("first", {
 *     name: "Standardize Environment Tags",
 *     enabled: true,
 *     rules: [{
 *         name: "map-env",
 *         enabled: true,
 *         mapping: [{
 *             destinationKey: "env",
 *             ifTagExists: "replace",
 *             sourceKeys: [
 *                 "environment",
 *                 "stage",
 *             ],
 *         }],
 *     }],
 * });
 * const second = new datadog.TagPipelineRuleset("second", {
 *     name: "Assign Team Tags",
 *     enabled: true,
 *     rules: [{
 *         name: "assign-team",
 *         enabled: true,
 *         query: [{
 *             query: "service:web* OR service:api*",
 *             ifTagExists: "do_not_apply",
 *             addition: [{
 *                 key: "team",
 *                 value: "backend",
 *             }],
 *         }],
 *     }],
 * });
 * const third = new datadog.TagPipelineRuleset("third", {
 *     name: "Enrich Service Metadata",
 *     enabled: true,
 *     rules: [{
 *         name: "lookup-service",
 *         enabled: true,
 *         referenceTable: [{
 *             tableName: "service_catalog",
 *             caseInsensitivity: true,
 *             ifTagExists: "append",
 *             sourceKeys: ["service"],
 *             fieldPairs: [{
 *                 inputColumn: "owner_team",
 *                 outputKey: "owner",
 *             }],
 *         }],
 *     }],
 * });
 * // Manage the order of tag pipeline rulesets
 * // Rulesets are executed in the order specified in ruleset_ids
 * // UI-defined rulesets not in this list will be preserved at the end
 * const order = new datadog.TagPipelineRulesets("order", {rulesetIds: [
 *     first.id,
 *     second.id,
 *     third.id,
 * ]});
 * // ============================================================================
 * // Example 2: Override UI-defined rulesets (override_ui_defined_resources = true)
 * // ============================================================================
 * // When set to true, any rulesets created via the UI that are not defined in Terraform
 * // will be automatically deleted during pulumi up.
 * const managedFirst = new datadog.TagPipelineRuleset("managed_first", {
 *     name: "Standardize Environment Tags",
 *     enabled: true,
 *     rules: [{
 *         name: "map-env",
 *         enabled: true,
 *         mapping: [{
 *             destinationKey: "env",
 *             ifTagExists: "replace",
 *             sourceKeys: [
 *                 "environment",
 *                 "stage",
 *             ],
 *         }],
 *     }],
 * });
 * const managedSecond = new datadog.TagPipelineRuleset("managed_second", {
 *     name: "Assign Team Tags",
 *     enabled: true,
 *     rules: [{
 *         name: "assign-team",
 *         enabled: true,
 *         query: [{
 *             query: "service:web*",
 *             ifTagExists: "do_not_apply",
 *             addition: [{
 *                 key: "team",
 *                 value: "frontend",
 *             }],
 *         }],
 *     }],
 * });
 * // Manage order with override_ui_defined_resources = true
 * // This will delete any rulesets created via the UI that are not in this list
 * const orderOverride = new datadog.TagPipelineRulesets("order_override", {
 *     overrideUiDefinedResources: true,
 *     rulesetIds: [
 *         managedFirst.id,
 *         managedSecond.id,
 *     ],
 * });
 * // ============================================================================
 * // Example 3: Preserve UI-defined rulesets (override_ui_defined_resources = false)
 * // ============================================================================
 * // When set to false (default), UI-defined rulesets that are not in Terraform
 * // will be preserved at the end of the order. However, if unmanaged rulesets
 * // are in the middle of the order, Terraform will error and require you to either:
 * // 1. Import the unmanaged rulesets
 * // 2. Set override_ui_defined_resources = true
 * // 3. Manually reorder or delete them in the Datadog UI
 * const preserveFirst = new datadog.TagPipelineRuleset("preserve_first", {
 *     name: "Standardize Environment Tags",
 *     enabled: true,
 *     rules: [{
 *         name: "map-env",
 *         enabled: true,
 *         mapping: [{
 *             destinationKey: "env",
 *             ifTagExists: "replace",
 *             sourceKeys: [
 *                 "environment",
 *                 "stage",
 *             ],
 *         }],
 *     }],
 * });
 * const preserveSecond = new datadog.TagPipelineRuleset("preserve_second", {
 *     name: "Assign Team Tags",
 *     enabled: true,
 *     rules: [{
 *         name: "assign-team",
 *         enabled: true,
 *         query: [{
 *             query: "service:web*",
 *             ifTagExists: "do_not_apply",
 *             addition: [{
 *                 key: "team",
 *                 value: "frontend",
 *             }],
 *         }],
 *     }],
 * });
 * // Manage order with override_ui_defined_resources = false (default)
 * // UI-defined rulesets will be preserved at the end of the order
 * // Terraform will warn if unmanaged rulesets exist at the end
 * // Terraform will error if unmanaged rulesets are in the middle
 * const orderPreserve = new datadog.TagPipelineRulesets("order_preserve", {
 *     overrideUiDefinedResources: false,
 *     rulesetIds: [
 *         preserveFirst.id,
 *         preserveSecond.id,
 *     ],
 * });
 * ```
 *
 * ## Import
 *
 * The `pulumi import` command can be used, for example:
 *
 * ```sh
 * $ pulumi import datadog:index/tagPipelineRulesets:TagPipelineRulesets my_rulesets order
 * ```
 */
class TagPipelineRulesets extends pulumi.CustomResource {
    /**
     * Get an existing TagPipelineRulesets 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 TagPipelineRulesets(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'datadog:index/tagPipelineRulesets:TagPipelineRulesets';
    /**
     * Returns true if the given object is an instance of TagPipelineRulesets.  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'] === TagPipelineRulesets.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["overrideUiDefinedResources"] = state?.overrideUiDefinedResources;
            resourceInputs["rulesetIds"] = state?.rulesetIds;
        }
        else {
            const args = argsOrState;
            if (args?.rulesetIds === undefined && !opts.urn) {
                throw new Error("Missing required property 'rulesetIds'");
            }
            resourceInputs["overrideUiDefinedResources"] = args?.overrideUiDefinedResources;
            resourceInputs["rulesetIds"] = args?.rulesetIds;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(TagPipelineRulesets.__pulumiType, name, resourceInputs, opts);
    }
}
exports.TagPipelineRulesets = TagPipelineRulesets;
//# sourceMappingURL=tagPipelineRulesets.js.map