UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

143 lines 5.94 kB
"use strict"; // *** 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.SpacesBucket = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a bucket resource for Spaces, DigitalOcean's object storage product. * * The [Spaces API](https://docs.digitalocean.com/reference/api/spaces-api/) was * designed to be interoperable with Amazon's AWS S3 API. This allows users to * interact with the service while using the tools they already know. Spaces * mirrors S3's authentication framework and requests to Spaces require a key pair * similar to Amazon's Access ID and Secret Key. * * The authentication requirement can be met by either setting the * `SPACES_ACCESS_KEY_ID` and `SPACES_SECRET_ACCESS_KEY` environment variables or * the provider's `spacesAccessId` and `spacesSecretKey` arguments to the * access ID and secret you generate via the DigitalOcean control panel. For * example: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const static_assets = new digitalocean.SpacesBucket("static-assets", {}); * ``` * * For more information, See [An Introduction to DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) * * ## Example Usage * * ### Create a New Bucket * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const foobar = new digitalocean.SpacesBucket("foobar", { * name: "foobar", * region: digitalocean.Region.NYC3, * }); * ``` * * ### Create a New Bucket With CORS Rules * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const foobar = new digitalocean.SpacesBucket("foobar", { * name: "foobar", * region: digitalocean.Region.NYC3, * corsRules: [ * { * allowedHeaders: ["*"], * allowedMethods: ["GET"], * allowedOrigins: ["*"], * maxAgeSeconds: 3000, * }, * { * allowedHeaders: ["*"], * allowedMethods: [ * "PUT", * "POST", * "DELETE", * ], * allowedOrigins: ["https://www.example.com"], * maxAgeSeconds: 3000, * }, * ], * }); * ``` * * ## Import * * Buckets can be imported using the `region` and `name` attributes (delimited by a comma): * * ```sh * $ pulumi import digitalocean:index/spacesBucket:SpacesBucket foobar `region`,`name` * ``` */ class SpacesBucket extends pulumi.CustomResource { /** * Get an existing SpacesBucket 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 SpacesBucket(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of SpacesBucket. 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'] === SpacesBucket.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["acl"] = state ? state.acl : undefined; resourceInputs["bucketDomainName"] = state ? state.bucketDomainName : undefined; resourceInputs["bucketUrn"] = state ? state.bucketUrn : undefined; resourceInputs["corsRules"] = state ? state.corsRules : undefined; resourceInputs["endpoint"] = state ? state.endpoint : undefined; resourceInputs["forceDestroy"] = state ? state.forceDestroy : undefined; resourceInputs["lifecycleRules"] = state ? state.lifecycleRules : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["versioning"] = state ? state.versioning : undefined; } else { const args = argsOrState; resourceInputs["acl"] = args ? args.acl : undefined; resourceInputs["corsRules"] = args ? args.corsRules : undefined; resourceInputs["forceDestroy"] = args ? args.forceDestroy : undefined; resourceInputs["lifecycleRules"] = args ? args.lifecycleRules : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["versioning"] = args ? args.versioning : undefined; resourceInputs["bucketDomainName"] = undefined /*out*/; resourceInputs["bucketUrn"] = undefined /*out*/; resourceInputs["endpoint"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(SpacesBucket.__pulumiType, name, resourceInputs, opts); } } exports.SpacesBucket = SpacesBucket; /** @internal */ SpacesBucket.__pulumiType = 'digitalocean:index/spacesBucket:SpacesBucket'; //# sourceMappingURL=spacesBucket.js.map