UNPKG

@lbrlabs/pulumi-scaleway

Version:

A Pulumi package for creating and managing scaleway cloud resources.

102 lines 4.31 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ObjectBucketPolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Creates and manages Scaleway object storage bucket policy. * For more information, see [the documentation](https://www.scaleway.com/en/docs/storage/object/api-cli/using-bucket-policies/). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const bucket = new scaleway.ObjectBucket("bucket", {}); * const main = new scaleway.IamApplication("main", {description: "a description"}); * const policy = new scaleway.ObjectBucketPolicy("policy", { * bucket: bucket.name, * policy: pulumi.all([main.id, bucket.name, bucket.name]).apply(([id, bucketName, bucketName1]) => JSON.stringify({ * Version: "2023-04-17", * Id: "MyBucketPolicy", * Statement: [{ * Sid: "Delegate access", * Effect: "Allow", * Principal: { * SCW: `application_id:${id}`, * }, * Action: "s3:ListBucket", * Resource: [ * bucketName, * `${bucketName1}/*`, * ], * }], * })), * }); * ``` * * ## Import * * Buckets can be imported using the `{region}/{bucketName}` identifier, e.g. bash * * ```sh * $ pulumi import scaleway:index/objectBucketPolicy:ObjectBucketPolicy some_bucket fr-par/some-bucket * ``` */ class ObjectBucketPolicy extends pulumi.CustomResource { /** * Get an existing ObjectBucketPolicy 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 ObjectBucketPolicy(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ObjectBucketPolicy. 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'] === ObjectBucketPolicy.__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["projectId"] = state ? state.projectId : 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'"); } resourceInputs["bucket"] = args ? args.bucket : undefined; resourceInputs["policy"] = args ? args.policy : undefined; resourceInputs["projectId"] = args ? args.projectId : undefined; resourceInputs["region"] = args ? args.region : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ObjectBucketPolicy.__pulumiType, name, resourceInputs, opts); } } exports.ObjectBucketPolicy = ObjectBucketPolicy; /** @internal */ ObjectBucketPolicy.__pulumiType = 'scaleway:index/objectBucketPolicy:ObjectBucketPolicy'; //# sourceMappingURL=objectBucketPolicy.js.map