@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
141 lines • 6.39 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.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, { ...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?.acl;
resourceInputs["bucket"] = state?.bucket;
resourceInputs["cacheControl"] = state?.cacheControl;
resourceInputs["content"] = state?.content;
resourceInputs["contentBase64"] = state?.contentBase64;
resourceInputs["contentDisposition"] = state?.contentDisposition;
resourceInputs["contentEncoding"] = state?.contentEncoding;
resourceInputs["contentLanguage"] = state?.contentLanguage;
resourceInputs["contentType"] = state?.contentType;
resourceInputs["etag"] = state?.etag;
resourceInputs["forceDestroy"] = state?.forceDestroy;
resourceInputs["key"] = state?.key;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["region"] = state?.region;
resourceInputs["source"] = state?.source;
resourceInputs["versionId"] = state?.versionId;
resourceInputs["websiteRedirect"] = state?.websiteRedirect;
}
else {
const args = argsOrState;
if (args?.bucket === undefined && !opts.urn) {
throw new Error("Missing required property 'bucket'");
}
if (args?.key === undefined && !opts.urn) {
throw new Error("Missing required property 'key'");
}
if (args?.region === undefined && !opts.urn) {
throw new Error("Missing required property 'region'");
}
resourceInputs["acl"] = args?.acl;
resourceInputs["bucket"] = args?.bucket;
resourceInputs["cacheControl"] = args?.cacheControl;
resourceInputs["content"] = args?.content;
resourceInputs["contentBase64"] = args?.contentBase64;
resourceInputs["contentDisposition"] = args?.contentDisposition;
resourceInputs["contentEncoding"] = args?.contentEncoding;
resourceInputs["contentLanguage"] = args?.contentLanguage;
resourceInputs["contentType"] = args?.contentType;
resourceInputs["etag"] = args?.etag;
resourceInputs["forceDestroy"] = args?.forceDestroy;
resourceInputs["key"] = args?.key;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["region"] = args?.region;
resourceInputs["source"] = args?.source;
resourceInputs["websiteRedirect"] = args?.websiteRedirect;
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