@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
150 lines • 7.21 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.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, { ...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?.bucket;
resourceInputs["cacheControl"] = state?.cacheControl;
resourceInputs["content"] = state?.content;
resourceInputs["contentDisposition"] = state?.contentDisposition;
resourceInputs["contentEncoding"] = state?.contentEncoding;
resourceInputs["contentLanguage"] = state?.contentLanguage;
resourceInputs["contentType"] = state?.contentType;
resourceInputs["crc32c"] = state?.crc32c;
resourceInputs["customerEncryption"] = state?.customerEncryption;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["detectMd5hash"] = state?.detectMd5hash;
resourceInputs["eventBasedHold"] = state?.eventBasedHold;
resourceInputs["forceEmptyContentType"] = state?.forceEmptyContentType;
resourceInputs["generation"] = state?.generation;
resourceInputs["kmsKeyName"] = state?.kmsKeyName;
resourceInputs["md5hash"] = state?.md5hash;
resourceInputs["md5hexhash"] = state?.md5hexhash;
resourceInputs["mediaLink"] = state?.mediaLink;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["name"] = state?.name;
resourceInputs["outputName"] = state?.outputName;
resourceInputs["retention"] = state?.retention;
resourceInputs["selfLink"] = state?.selfLink;
resourceInputs["source"] = state?.source;
resourceInputs["sourceMd5hash"] = state?.sourceMd5hash;
resourceInputs["storageClass"] = state?.storageClass;
resourceInputs["temporaryHold"] = state?.temporaryHold;
}
else {
const args = argsOrState;
if (args?.bucket === undefined && !opts.urn) {
throw new Error("Missing required property 'bucket'");
}
resourceInputs["bucket"] = args?.bucket;
resourceInputs["cacheControl"] = args?.cacheControl;
resourceInputs["content"] = args?.content ? pulumi.secret(args.content) : undefined;
resourceInputs["contentDisposition"] = args?.contentDisposition;
resourceInputs["contentEncoding"] = args?.contentEncoding;
resourceInputs["contentLanguage"] = args?.contentLanguage;
resourceInputs["contentType"] = args?.contentType;
resourceInputs["customerEncryption"] = args?.customerEncryption ? pulumi.secret(args.customerEncryption) : undefined;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["detectMd5hash"] = args?.detectMd5hash;
resourceInputs["eventBasedHold"] = args?.eventBasedHold;
resourceInputs["forceEmptyContentType"] = args?.forceEmptyContentType;
resourceInputs["kmsKeyName"] = args?.kmsKeyName;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["name"] = args?.name;
resourceInputs["retention"] = args?.retention;
resourceInputs["source"] = args?.source;
resourceInputs["sourceMd5hash"] = args?.sourceMd5hash;
resourceInputs["storageClass"] = args?.storageClass;
resourceInputs["temporaryHold"] = args?.temporaryHold;
resourceInputs["crc32c"] = undefined /*out*/;
resourceInputs["generation"] = undefined /*out*/;
resourceInputs["md5hash"] = undefined /*out*/;
resourceInputs["md5hexhash"] = 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
;