@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
92 lines • 4.28 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.Grant = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource-based access control mechanism for a KMS customer master key.
*
* > **Note:** All arguments including the grant token will be stored in the raw state as plain-text.
* ## Import
*
* Using `pulumi import`, import KMS Grants using the Key ID and Grant ID separated by a colon (`:`). For example:
*
* ```sh
* $ pulumi import aws:kms/grant:Grant test 1234abcd-12ab-34cd-56ef-1234567890ab:abcde1237f76e4ba7987489ac329fbfba6ad343d6f7075dbd1ef191f0120514
* ```
*/
class Grant extends pulumi.CustomResource {
/**
* Get an existing Grant 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 Grant(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Grant. 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'] === Grant.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["constraints"] = state?.constraints;
resourceInputs["grantCreationTokens"] = state?.grantCreationTokens;
resourceInputs["grantId"] = state?.grantId;
resourceInputs["grantToken"] = state?.grantToken;
resourceInputs["granteePrincipal"] = state?.granteePrincipal;
resourceInputs["keyId"] = state?.keyId;
resourceInputs["name"] = state?.name;
resourceInputs["operations"] = state?.operations;
resourceInputs["region"] = state?.region;
resourceInputs["retireOnDelete"] = state?.retireOnDelete;
resourceInputs["retiringPrincipal"] = state?.retiringPrincipal;
}
else {
const args = argsOrState;
if (args?.granteePrincipal === undefined && !opts.urn) {
throw new Error("Missing required property 'granteePrincipal'");
}
if (args?.keyId === undefined && !opts.urn) {
throw new Error("Missing required property 'keyId'");
}
if (args?.operations === undefined && !opts.urn) {
throw new Error("Missing required property 'operations'");
}
resourceInputs["constraints"] = args?.constraints;
resourceInputs["grantCreationTokens"] = args?.grantCreationTokens;
resourceInputs["granteePrincipal"] = args?.granteePrincipal;
resourceInputs["keyId"] = args?.keyId;
resourceInputs["name"] = args?.name;
resourceInputs["operations"] = args?.operations;
resourceInputs["region"] = args?.region;
resourceInputs["retireOnDelete"] = args?.retireOnDelete;
resourceInputs["retiringPrincipal"] = args?.retiringPrincipal;
resourceInputs["grantId"] = undefined /*out*/;
resourceInputs["grantToken"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["grantToken"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Grant.__pulumiType, name, resourceInputs, opts);
}
}
exports.Grant = Grant;
/** @internal */
Grant.__pulumiType = 'aws:kms/grant:Grant';
//# sourceMappingURL=grant.js.map