@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
109 lines • 4.59 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.CryptoKeyVersion = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A `CryptoKeyVersion` represents an individual cryptographic key, and the associated key material.
*
* Destroying a cryptoKeyVersion will not delete the resource from the project.
*
* To get more information about CryptoKeyVersion, see:
*
* * [API documentation](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions)
* * How-to Guides
* * [Creating a key Version](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions/create)
*
* ## Example Usage
*
* ### Kms Crypto Key Version Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const keyring = new gcp.kms.KeyRing("keyring", {
* name: "keyring-example",
* location: "global",
* });
* const cryptokey = new gcp.kms.CryptoKey("cryptokey", {
* name: "crypto-key-example",
* keyRing: keyring.id,
* rotationPeriod: "7776000s",
* });
* const example_key = new gcp.kms.CryptoKeyVersion("example-key", {cryptoKey: cryptokey.id});
* ```
*
* ## Import
*
* CryptoKeyVersion can be imported using any of these accepted formats:
*
* * `{{name}}`
*
* When using the `pulumi import` command, CryptoKeyVersion can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:kms/cryptoKeyVersion:CryptoKeyVersion default {{name}}
* ```
*/
class CryptoKeyVersion extends pulumi.CustomResource {
/**
* Get an existing CryptoKeyVersion 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 CryptoKeyVersion(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of CryptoKeyVersion. 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'] === CryptoKeyVersion.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["algorithm"] = state?.algorithm;
resourceInputs["attestations"] = state?.attestations;
resourceInputs["cryptoKey"] = state?.cryptoKey;
resourceInputs["externalProtectionLevelOptions"] = state?.externalProtectionLevelOptions;
resourceInputs["generateTime"] = state?.generateTime;
resourceInputs["name"] = state?.name;
resourceInputs["protectionLevel"] = state?.protectionLevel;
resourceInputs["state"] = state?.state;
}
else {
const args = argsOrState;
if (args?.cryptoKey === undefined && !opts.urn) {
throw new Error("Missing required property 'cryptoKey'");
}
resourceInputs["cryptoKey"] = args?.cryptoKey;
resourceInputs["externalProtectionLevelOptions"] = args?.externalProtectionLevelOptions;
resourceInputs["state"] = args?.state;
resourceInputs["algorithm"] = undefined /*out*/;
resourceInputs["attestations"] = undefined /*out*/;
resourceInputs["generateTime"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["protectionLevel"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CryptoKeyVersion.__pulumiType, name, resourceInputs, opts);
}
}
exports.CryptoKeyVersion = CryptoKeyVersion;
/** @internal */
CryptoKeyVersion.__pulumiType = 'gcp:kms/cryptoKeyVersion:CryptoKeyVersion';
//# sourceMappingURL=cryptoKeyVersion.js.map
;