UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

115 lines 4.77 kB
"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.HmacKey = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * The hmacKeys resource represents an HMAC key within Cloud Storage. The resource * consists of a secret and HMAC key metadata. HMAC keys can be used as credentials * for service accounts. * * To get more information about HmacKey, see: * * * [API documentation](https://cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys) * * How-to Guides * * [Official Documentation](https://cloud.google.com/storage/docs/authentication/managing-hmackeys) * * ## Example Usage * * ### Storage Hmac Key * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // Create a new service account * const serviceAccount = new gcp.serviceaccount.Account("service_account", {accountId: "my-svc-acc"}); * //Create the HMAC key for the associated service account * const key = new gcp.storage.HmacKey("key", {serviceAccountEmail: serviceAccount.email}); * ``` * * ## Import * * HmacKey can be imported using any of these accepted formats: * * * `projects/{{project}}/hmacKeys/{{access_id}}` * * * `{{project}}/{{access_id}}` * * * `{{access_id}}` * * When using the `pulumi import` command, HmacKey can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:storage/hmacKey:HmacKey default projects/{{project}}/hmacKeys/{{access_id}} * ``` * * ```sh * $ pulumi import gcp:storage/hmacKey:HmacKey default {{project}}/{{access_id}} * ``` * * ```sh * $ pulumi import gcp:storage/hmacKey:HmacKey default {{access_id}} * ``` */ class HmacKey extends pulumi.CustomResource { /** * Get an existing HmacKey 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 HmacKey(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of HmacKey. 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'] === HmacKey.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accessId"] = state ? state.accessId : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["secret"] = state ? state.secret : undefined; resourceInputs["serviceAccountEmail"] = state ? state.serviceAccountEmail : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["timeCreated"] = state ? state.timeCreated : undefined; resourceInputs["updated"] = state ? state.updated : undefined; } else { const args = argsOrState; if ((!args || args.serviceAccountEmail === undefined) && !opts.urn) { throw new Error("Missing required property 'serviceAccountEmail'"); } resourceInputs["project"] = args ? args.project : undefined; resourceInputs["serviceAccountEmail"] = args ? args.serviceAccountEmail : undefined; resourceInputs["state"] = args ? args.state : undefined; resourceInputs["accessId"] = undefined /*out*/; resourceInputs["secret"] = undefined /*out*/; resourceInputs["timeCreated"] = undefined /*out*/; resourceInputs["updated"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["secret"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(HmacKey.__pulumiType, name, resourceInputs, opts); } } exports.HmacKey = HmacKey; /** @internal */ HmacKey.__pulumiType = 'gcp:storage/hmacKey:HmacKey'; //# sourceMappingURL=hmacKey.js.map