UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

142 lines 7.5 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.BucketObject = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Creates a new object inside an existing bucket in Google cloud storage service (GCS). * [ACLs](https://cloud.google.com/storage/docs/access-control/lists) can be applied using the `gcp.storage.ObjectACL` resource. * For more information see * [the official documentation](https://cloud.google.com/storage/docs/key-terms#objects) * and * [API](https://cloud.google.com/storage/docs/json_api/v1/objects). * * A datasource can be used to retrieve the data of the stored object: * * * `gcp.storage.getBucketObjectContent`: Retrieves the content within a specified bucket object in Google Cloud Storage Service (GCS) * * ## Example Usage * * Example creating a public object in an existing `image-store` bucket. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const picture = new gcp.storage.BucketObject("picture", { * name: "butterfly01", * source: new pulumi.asset.FileAsset("/images/nature/garden-tiger-moth.jpg"), * bucket: "image-store", * }); * ``` * * Example creating an empty folder in an existing `image-store` bucket. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const emptyFolder = new gcp.storage.BucketObject("empty_folder", { * name: "empty_folder/", * content: " ", * bucket: "image-store", * }); * ``` * * ## Import * * This resource does not support import. */ class BucketObject extends pulumi.CustomResource { /** * Get an existing BucketObject 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 BucketObject(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of BucketObject. 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'] === BucketObject.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["bucket"] = state ? state.bucket : undefined; resourceInputs["cacheControl"] = state ? state.cacheControl : undefined; resourceInputs["content"] = state ? state.content : 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["crc32c"] = state ? state.crc32c : undefined; resourceInputs["customerEncryption"] = state ? state.customerEncryption : undefined; resourceInputs["detectMd5hash"] = state ? state.detectMd5hash : undefined; resourceInputs["eventBasedHold"] = state ? state.eventBasedHold : undefined; resourceInputs["generation"] = state ? state.generation : undefined; resourceInputs["kmsKeyName"] = state ? state.kmsKeyName : undefined; resourceInputs["md5hash"] = state ? state.md5hash : undefined; resourceInputs["mediaLink"] = state ? state.mediaLink : undefined; resourceInputs["metadata"] = state ? state.metadata : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["outputName"] = state ? state.outputName : undefined; resourceInputs["retention"] = state ? state.retention : undefined; resourceInputs["selfLink"] = state ? state.selfLink : undefined; resourceInputs["source"] = state ? state.source : undefined; resourceInputs["storageClass"] = state ? state.storageClass : undefined; resourceInputs["temporaryHold"] = state ? state.temporaryHold : undefined; } else { const args = argsOrState; if ((!args || args.bucket === undefined) && !opts.urn) { throw new Error("Missing required property 'bucket'"); } resourceInputs["bucket"] = args ? args.bucket : undefined; resourceInputs["cacheControl"] = args ? args.cacheControl : undefined; resourceInputs["content"] = (args === null || args === void 0 ? void 0 : args.content) ? pulumi.secret(args.content) : 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["customerEncryption"] = (args === null || args === void 0 ? void 0 : args.customerEncryption) ? pulumi.secret(args.customerEncryption) : undefined; resourceInputs["detectMd5hash"] = args ? args.detectMd5hash : undefined; resourceInputs["eventBasedHold"] = args ? args.eventBasedHold : undefined; resourceInputs["kmsKeyName"] = args ? args.kmsKeyName : undefined; resourceInputs["metadata"] = args ? args.metadata : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["retention"] = args ? args.retention : undefined; resourceInputs["source"] = args ? args.source : undefined; resourceInputs["storageClass"] = args ? args.storageClass : undefined; resourceInputs["temporaryHold"] = args ? args.temporaryHold : undefined; resourceInputs["crc32c"] = undefined /*out*/; resourceInputs["generation"] = undefined /*out*/; resourceInputs["md5hash"] = undefined /*out*/; resourceInputs["mediaLink"] = undefined /*out*/; resourceInputs["outputName"] = undefined /*out*/; resourceInputs["selfLink"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["content", "customerEncryption"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(BucketObject.__pulumiType, name, resourceInputs, opts); } } exports.BucketObject = BucketObject; /** @internal */ BucketObject.__pulumiType = 'gcp:storage/bucketObject:BucketObject'; //# sourceMappingURL=bucketObject.js.map