@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
200 lines • 8.99 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BucketObject = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(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",
* });
* ```
*
* Example creating an contexts for an object.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bucketObject = new gcp.storage.BucketObject("bucket_object", {
* bucket: "test-bucket",
* name: "test-object",
* content: "test-content",
* contexts: {
* customs: [
* {
* key: "testKey",
* value: "test",
* },
* {
* key: "testKeyTwo",
* value: "test",
* },
* ],
* },
* });
* ```
*
* ## 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 });
}
/** @internal */
static __pulumiType = 'gcp:storage/bucketObject:BucketObject';
/**
* 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["contexts"] = state?.contexts;
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["contexts"] = args?.contexts;
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;
//# sourceMappingURL=bucketObject.js.map