"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.Tag = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * This resource provides the Tag resource in Oracle Cloud Infrastructure Identity service.
 * Api doc link for the resource: https://docs.oracle.com/iaas/api/#/en/identity/latest/Tag
 *
 * Example terraform configs related to the resource : https://github.com/oracle/terraform-provider-oci/tree/master/examples/identity
 *
 * Creates a new tag in the specified tag namespace.
 *
 * The tag requires either the OCID or the name of the tag namespace that will contain this
 * tag definition.
 *
 * You must specify a *name* for the tag, which must be unique across all tags in the tag namespace
 * and cannot be changed. The name can contain any ASCII character except the space (_) or period (.) characters.
 * Names are case insensitive. That means, for example, "myTag" and "mytag" are not allowed in the same namespace.
 * If you specify a name that's already in use in the tag namespace, a 409 error is returned.
 *
 * The tag must have a *description*. It does not have to be unique, and you can change it with
 * [UpdateTag](https://docs.cloud.oracle.com/iaas/api/#/en/identity/latest/Tag/UpdateTag).
 *
 * The tag must have a value type, which is specified with a validator. Tags can use either a
 * static value or a list of possible values. Static values are entered by a user applying the tag
 * to a resource. Lists are created by you and the user must apply a value from the list. Lists
 * are validiated.
 *
 * * If no `validator` is set, the user applying the tag to a resource can type in a static
 *   value or leave the tag value empty.
 * * If a `validator` is set, the user applying the tag to a resource must select from a list
 *   of values that you supply with [EnumTagDefinitionValidator](https://docs.cloud.oracle.com/iaas/api/#/en/identity/latest/datatypes/EnumTagDefinitionValidator).
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as oci from "@pulumi/oci";
 *
 * const testTag = new oci.identity.Tag("test_tag", {
 *     description: tagDescription,
 *     name: tagName,
 *     tagNamespaceId: testTagNamespace.id,
 *     definedTags: {
 *         "Operations.CostCenter": "42",
 *     },
 *     freeformTags: {
 *         Department: "Finance",
 *     },
 *     isCostTracking: tagIsCostTracking === "true",
 *     validator: {
 *         validatorType: tagValidatorValidatorType,
 *         values: tagValidatorValues,
 *     },
 *     isRetired: false,
 * });
 * ```
 *
 * ## Import
 *
 * Tags can be imported using the `tagNamespaceId` and `tagName`, e.g.
 *
 * ```sh
 * $ pulumi import oci:Identity/tag:Tag test_tag "tagNamespaces/{tagNamespaceId}/tags/{tagName}"
 * ```
 */
class Tag extends pulumi.CustomResource {
    /**
     * Get an existing Tag 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 Tag(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'oci:Identity/tag:Tag';
    /**
     * Returns true if the given object is an instance of Tag.  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'] === Tag.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["definedTags"] = state?.definedTags;
            resourceInputs["description"] = state?.description;
            resourceInputs["freeformTags"] = state?.freeformTags;
            resourceInputs["isCostTracking"] = state?.isCostTracking;
            resourceInputs["isRetired"] = state?.isRetired;
            resourceInputs["name"] = state?.name;
            resourceInputs["state"] = state?.state;
            resourceInputs["tagNamespaceId"] = state?.tagNamespaceId;
            resourceInputs["timeCreated"] = state?.timeCreated;
            resourceInputs["validator"] = state?.validator;
        }
        else {
            const args = argsOrState;
            if (args?.description === undefined && !opts.urn) {
                throw new Error("Missing required property 'description'");
            }
            if (args?.tagNamespaceId === undefined && !opts.urn) {
                throw new Error("Missing required property 'tagNamespaceId'");
            }
            resourceInputs["definedTags"] = args?.definedTags;
            resourceInputs["description"] = args?.description;
            resourceInputs["freeformTags"] = args?.freeformTags;
            resourceInputs["isCostTracking"] = args?.isCostTracking;
            resourceInputs["isRetired"] = args?.isRetired;
            resourceInputs["name"] = args?.name;
            resourceInputs["tagNamespaceId"] = args?.tagNamespaceId;
            resourceInputs["validator"] = args?.validator;
            resourceInputs["state"] = undefined /*out*/;
            resourceInputs["timeCreated"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Tag.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Tag = Tag;
//# sourceMappingURL=tag.js.map