UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

109 lines 4.45 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.SpacesBucketPolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## Example Usage * * ### Limiting access to specific IP addresses * * ```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 foobarSpacesBucketPolicy = new digitalocean.SpacesBucketPolicy("foobar", { * region: foobar.region, * bucket: foobar.name, * policy: pulumi.jsonStringify({ * Version: "2012-10-17", * Statement: [{ * Sid: "IPAllow", * Effect: "Deny", * Principal: "*", * Action: "s3:*", * Resource: [ * pulumi.interpolate`arn:aws:s3:::${foobar.name}`, * pulumi.interpolate`arn:aws:s3:::${foobar.name}/*`, * ], * Condition: { * NotIpAddress: { * "aws:SourceIp": "54.240.143.0/24", * }, * }, * }], * }), * }); * ``` * * !> **Warning:** Before using this policy, replace the 54.240.143.0/24 IP address range in this example with an appropriate value for your use case. Otherwise, you will lose the ability to access your bucket. * * ## Import * * Bucket policies can be imported using the `region` and `bucket` attributes (delimited by a comma): * * ```sh * $ pulumi import digitalocean:index/spacesBucketPolicy:SpacesBucketPolicy foobar `region`,`bucket` * ``` */ class SpacesBucketPolicy extends pulumi.CustomResource { /** * Get an existing SpacesBucketPolicy 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 SpacesBucketPolicy(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of SpacesBucketPolicy. 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'] === SpacesBucketPolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["bucket"] = state ? state.bucket : undefined; resourceInputs["policy"] = state ? state.policy : undefined; resourceInputs["region"] = state ? state.region : undefined; } else { const args = argsOrState; if ((!args || args.bucket === undefined) && !opts.urn) { throw new Error("Missing required property 'bucket'"); } if ((!args || args.policy === undefined) && !opts.urn) { throw new Error("Missing required property 'policy'"); } if ((!args || args.region === undefined) && !opts.urn) { throw new Error("Missing required property 'region'"); } resourceInputs["bucket"] = args ? args.bucket : undefined; resourceInputs["policy"] = args ? args.policy : undefined; resourceInputs["region"] = args ? args.region : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(SpacesBucketPolicy.__pulumiType, name, resourceInputs, opts); } } exports.SpacesBucketPolicy = SpacesBucketPolicy; /** @internal */ SpacesBucketPolicy.__pulumiType = 'digitalocean:index/spacesBucketPolicy:SpacesBucketPolicy'; //# sourceMappingURL=spacesBucketPolicy.js.map