UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

141 lines 7.06 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.SpacesBucketObject = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a bucket object resource for Spaces, DigitalOcean's object storage product. * The `digitalocean.SpacesBucketObject` resource allows the provider to upload content * to Spaces. * * 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 Key in a Spaces 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, * }); * const index = new digitalocean.SpacesBucketObject("index", { * region: foobar.region, * bucket: foobar.name, * key: "index.html", * content: "<html><body><p>This page is empty.</p></body></html>", * contentType: "text/html", * }); * ``` * * ## Import * * Importing this resource is not supported. */ class SpacesBucketObject extends pulumi.CustomResource { /** * Get an existing SpacesBucketObject 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 SpacesBucketObject(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of SpacesBucketObject. 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'] === SpacesBucketObject.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["acl"] = state ? state.acl : undefined; resourceInputs["bucket"] = state ? state.bucket : undefined; resourceInputs["cacheControl"] = state ? state.cacheControl : undefined; resourceInputs["content"] = state ? state.content : undefined; resourceInputs["contentBase64"] = state ? state.contentBase64 : undefined; resourceInputs["contentDisposition"] = state ? state.contentDisposition : undefined; resourceInputs["contentEncoding"] = state ? state.contentEncoding : undefined; resourceInputs["contentLanguage"] = state ? state.contentLanguage : undefined; resourceInputs["contentType"] = state ? state.contentType : undefined; resourceInputs["etag"] = state ? state.etag : undefined; resourceInputs["forceDestroy"] = state ? state.forceDestroy : undefined; resourceInputs["key"] = state ? state.key : undefined; resourceInputs["metadata"] = state ? state.metadata : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["source"] = state ? state.source : undefined; resourceInputs["versionId"] = state ? state.versionId : undefined; resourceInputs["websiteRedirect"] = state ? state.websiteRedirect : undefined; } else { const args = argsOrState; if ((!args || args.bucket === undefined) && !opts.urn) { throw new Error("Missing required property 'bucket'"); } if ((!args || args.key === undefined) && !opts.urn) { throw new Error("Missing required property 'key'"); } if ((!args || args.region === undefined) && !opts.urn) { throw new Error("Missing required property 'region'"); } resourceInputs["acl"] = args ? args.acl : undefined; resourceInputs["bucket"] = args ? args.bucket : undefined; resourceInputs["cacheControl"] = args ? args.cacheControl : undefined; resourceInputs["content"] = args ? args.content : undefined; resourceInputs["contentBase64"] = args ? args.contentBase64 : undefined; resourceInputs["contentDisposition"] = args ? args.contentDisposition : undefined; resourceInputs["contentEncoding"] = args ? args.contentEncoding : undefined; resourceInputs["contentLanguage"] = args ? args.contentLanguage : undefined; resourceInputs["contentType"] = args ? args.contentType : undefined; resourceInputs["etag"] = args ? args.etag : undefined; resourceInputs["forceDestroy"] = args ? args.forceDestroy : undefined; resourceInputs["key"] = args ? args.key : undefined; resourceInputs["metadata"] = args ? args.metadata : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["source"] = args ? args.source : undefined; resourceInputs["websiteRedirect"] = args ? args.websiteRedirect : undefined; resourceInputs["versionId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(SpacesBucketObject.__pulumiType, name, resourceInputs, opts); } } exports.SpacesBucketObject = SpacesBucketObject; /** @internal */ SpacesBucketObject.__pulumiType = 'digitalocean:index/spacesBucketObject:SpacesBucketObject'; //# sourceMappingURL=spacesBucketObject.js.map