@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
143 lines • 5.59 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.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, { ...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?.acl;
resourceInputs["bucketDomainName"] = state?.bucketDomainName;
resourceInputs["bucketUrn"] = state?.bucketUrn;
resourceInputs["corsRules"] = state?.corsRules;
resourceInputs["endpoint"] = state?.endpoint;
resourceInputs["forceDestroy"] = state?.forceDestroy;
resourceInputs["lifecycleRules"] = state?.lifecycleRules;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
resourceInputs["versioning"] = state?.versioning;
}
else {
const args = argsOrState;
resourceInputs["acl"] = args?.acl;
resourceInputs["corsRules"] = args?.corsRules;
resourceInputs["forceDestroy"] = args?.forceDestroy;
resourceInputs["lifecycleRules"] = args?.lifecycleRules;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
resourceInputs["versioning"] = args?.versioning;
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