UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

120 lines 4.93 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.ObjectStorageKey = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a Linode Object Storage Key resource. This can be used to create, modify, and delete Linodes Object Storage Keys. * For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-object-storage-keys). * * ## Example Usage * * The following example shows how one might use this resource to create an Object Storage Key. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const foo = new linode.ObjectStorageKey("foo", {label: "image-access"}); * ``` * * The following example shows a key with limited access. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const foobar = new linode.ObjectStorageKey("foobar", { * label: "my-key", * bucketAccesses: [{ * bucketName: "my-bucket-name", * region: "us-mia", * permissions: "read_write", * }], * }); * ``` * * The following example shows how to grant a key the explicit access to multiple buckets. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const foo = new linode.ObjectStorageKey("foo", { * label: "image-access", * bucketAccesses: [ * { * bucketName: "foobar1", * region: "us-mia", * permissions: "read_write", * }, * { * bucketName: "foobar2", * region: "gb-lon", * permissions: "read_write", * }, * ], * }); * ``` */ class ObjectStorageKey extends pulumi.CustomResource { /** * Get an existing ObjectStorageKey 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 ObjectStorageKey(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ObjectStorageKey. 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'] === ObjectStorageKey.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accessKey"] = state ? state.accessKey : undefined; resourceInputs["bucketAccesses"] = state ? state.bucketAccesses : undefined; resourceInputs["label"] = state ? state.label : undefined; resourceInputs["limited"] = state ? state.limited : undefined; resourceInputs["regions"] = state ? state.regions : undefined; resourceInputs["regionsDetails"] = state ? state.regionsDetails : undefined; resourceInputs["secretKey"] = state ? state.secretKey : undefined; } else { const args = argsOrState; if ((!args || args.label === undefined) && !opts.urn) { throw new Error("Missing required property 'label'"); } resourceInputs["bucketAccesses"] = args ? args.bucketAccesses : undefined; resourceInputs["label"] = args ? args.label : undefined; resourceInputs["regions"] = args ? args.regions : undefined; resourceInputs["accessKey"] = undefined /*out*/; resourceInputs["limited"] = undefined /*out*/; resourceInputs["regionsDetails"] = undefined /*out*/; resourceInputs["secretKey"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["secretKey"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(ObjectStorageKey.__pulumiType, name, resourceInputs, opts); } } exports.ObjectStorageKey = ObjectStorageKey; /** @internal */ ObjectStorageKey.__pulumiType = 'linode:index/objectStorageKey:ObjectStorageKey'; //# sourceMappingURL=objectStorageKey.js.map