"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.Key = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Provides a resource to manage kms key
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as volcengine from "@volcengine/pulumi";
 *
 * const fooKeyring = new volcengine.kms.Keyring("fooKeyring", {
 *     keyringName: "tf-test",
 *     description: "tf-test",
 *     projectName: "default",
 * });
 * const fooKey = new volcengine.kms.Key("fooKey", {
 *     keyringName: fooKeyring.keyringName,
 *     keyName: "mrk-tf-key-mod",
 *     description: "tf test key-mod",
 *     tags: [{
 *         key: "tfkey3",
 *         value: "tfvalue3",
 *     }],
 * });
 * const foo1 = new volcengine.kms.Key("foo1", {
 *     keyringName: fooKeyring.keyringName,
 *     keyName: "Tf-test-key-1",
 *     rotateState: "Enable",
 *     rotateInterval: 90,
 *     keySpec: "SYMMETRIC_128",
 *     description: "Tf test key with SYMMETRIC_128",
 *     keyUsage: "ENCRYPT_DECRYPT",
 *     protectionLevel: "SOFTWARE",
 *     origin: "CloudKMS",
 *     multiRegion: false,
 *     pendingWindowInDays: 30,
 *     tags: [
 *         {
 *             key: "tfk1",
 *             value: "tfv1",
 *         },
 *         {
 *             key: "tfk2",
 *             value: "tfv2",
 *         },
 *     ],
 * });
 * const foo2 = new volcengine.kms.Key("foo2", {
 *     keyringName: fooKeyring.keyringName,
 *     keyName: "mrk-Tf-test-key-2",
 *     keyUsage: "ENCRYPT_DECRYPT",
 *     origin: "External",
 *     multiRegion: true,
 * });
 * const _default = new volcengine.kms.KeyMaterial("default", {
 *     keyringName: fooKeyring.keyringName,
 *     keyName: foo2.keyName,
 *     encryptedKeyMaterial: "***",
 *     importToken: "***",
 *     expirationModel: "KEY_MATERIAL_EXPIRES",
 *     validTo: 1770999621,
 * });
 * ```
 *
 * ## Import
 *
 * KmsKey can be imported using the id, e.g.
 *
 * ```sh
 * $ pulumi import volcengine:kms/key:Key default resource_id
 * ```
 */
class Key extends pulumi.CustomResource {
    /**
     * Get an existing Key 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 Key(name, state, Object.assign(Object.assign({}, opts), { id: id }));
    }
    /**
     * Returns true if the given object is an instance of Key.  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'] === Key.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["creationDate"] = state ? state.creationDate : undefined;
            resourceInputs["customKeyStoreId"] = state ? state.customKeyStoreId : undefined;
            resourceInputs["description"] = state ? state.description : undefined;
            resourceInputs["keyMaterialExpireTime"] = state ? state.keyMaterialExpireTime : undefined;
            resourceInputs["keyName"] = state ? state.keyName : undefined;
            resourceInputs["keySpec"] = state ? state.keySpec : undefined;
            resourceInputs["keyUsage"] = state ? state.keyUsage : undefined;
            resourceInputs["keyringName"] = state ? state.keyringName : undefined;
            resourceInputs["lastRotationTime"] = state ? state.lastRotationTime : undefined;
            resourceInputs["multiRegion"] = state ? state.multiRegion : undefined;
            resourceInputs["multiRegionConfiguration"] = state ? state.multiRegionConfiguration : undefined;
            resourceInputs["origin"] = state ? state.origin : undefined;
            resourceInputs["pendingWindowInDays"] = state ? state.pendingWindowInDays : undefined;
            resourceInputs["protectionLevel"] = state ? state.protectionLevel : undefined;
            resourceInputs["rotateInterval"] = state ? state.rotateInterval : undefined;
            resourceInputs["rotateState"] = state ? state.rotateState : undefined;
            resourceInputs["rotationState"] = state ? state.rotationState : undefined;
            resourceInputs["scheduleDeleteTime"] = state ? state.scheduleDeleteTime : undefined;
            resourceInputs["scheduleRotationTime"] = state ? state.scheduleRotationTime : undefined;
            resourceInputs["state"] = state ? state.state : undefined;
            resourceInputs["tags"] = state ? state.tags : undefined;
            resourceInputs["trn"] = state ? state.trn : undefined;
            resourceInputs["updateDate"] = state ? state.updateDate : undefined;
            resourceInputs["xksKeyId"] = state ? state.xksKeyId : undefined;
        }
        else {
            const args = argsOrState;
            if ((!args || args.keyName === undefined) && !opts.urn) {
                throw new Error("Missing required property 'keyName'");
            }
            if ((!args || args.keyringName === undefined) && !opts.urn) {
                throw new Error("Missing required property 'keyringName'");
            }
            resourceInputs["customKeyStoreId"] = args ? args.customKeyStoreId : undefined;
            resourceInputs["description"] = args ? args.description : undefined;
            resourceInputs["keyName"] = args ? args.keyName : undefined;
            resourceInputs["keySpec"] = args ? args.keySpec : undefined;
            resourceInputs["keyUsage"] = args ? args.keyUsage : undefined;
            resourceInputs["keyringName"] = args ? args.keyringName : undefined;
            resourceInputs["multiRegion"] = args ? args.multiRegion : undefined;
            resourceInputs["origin"] = args ? args.origin : undefined;
            resourceInputs["pendingWindowInDays"] = args ? args.pendingWindowInDays : undefined;
            resourceInputs["protectionLevel"] = args ? args.protectionLevel : undefined;
            resourceInputs["rotateInterval"] = args ? args.rotateInterval : undefined;
            resourceInputs["rotateState"] = args ? args.rotateState : undefined;
            resourceInputs["tags"] = args ? args.tags : undefined;
            resourceInputs["xksKeyId"] = args ? args.xksKeyId : undefined;
            resourceInputs["creationDate"] = undefined /*out*/;
            resourceInputs["keyMaterialExpireTime"] = undefined /*out*/;
            resourceInputs["lastRotationTime"] = undefined /*out*/;
            resourceInputs["multiRegionConfiguration"] = undefined /*out*/;
            resourceInputs["rotationState"] = undefined /*out*/;
            resourceInputs["scheduleDeleteTime"] = undefined /*out*/;
            resourceInputs["scheduleRotationTime"] = undefined /*out*/;
            resourceInputs["state"] = undefined /*out*/;
            resourceInputs["trn"] = undefined /*out*/;
            resourceInputs["updateDate"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Key.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Key = Key;
/** @internal */
Key.__pulumiType = 'volcengine:kms/key:Key';
//# sourceMappingURL=key.js.map