@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
396 lines (395 loc) • 18.5 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* 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.
*/
export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: BucketObjectState, opts?: pulumi.CustomResourceOptions): 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: any): obj is BucketObject;
/**
* The name of the containing bucket.
*/
readonly bucket: pulumi.Output<string>;
/**
* [Cache-Control](https://tools.ietf.org/html/rfc7234#section-5.2)
* directive to specify caching behavior of object data. If omitted and object is accessible to all anonymous users, the default will be public, max-age=3600
*/
readonly cacheControl: pulumi.Output<string | undefined>;
/**
* Data as `string` to be uploaded. Must be defined if `source` is not. **Note**: The `content` field is marked as sensitive.
*/
readonly content: pulumi.Output<string>;
/**
* [Content-Disposition](https://tools.ietf.org/html/rfc6266) of the object data.
*/
readonly contentDisposition: pulumi.Output<string | undefined>;
/**
* [Content-Encoding](https://tools.ietf.org/html/rfc7231#section-3.1.2.2) of the object data.
*/
readonly contentEncoding: pulumi.Output<string | undefined>;
/**
* [Content-Language](https://tools.ietf.org/html/rfc7231#section-3.1.3.2) of the object data.
*/
readonly contentLanguage: pulumi.Output<string | undefined>;
/**
* [Content-Type](https://tools.ietf.org/html/rfc7231#section-3.1.1.5) of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".
*/
readonly contentType: pulumi.Output<string>;
/**
* (Computed) Base 64 CRC32 hash of the uploaded data.
*/
readonly crc32c: pulumi.Output<string>;
/**
* Enables object encryption with Customer-Supplied Encryption Key (CSEK). Google [documentation about CSEK.](https://cloud.google.com/storage/docs/encryption/customer-supplied-keys)
* Structure is documented below.
*/
readonly customerEncryption: pulumi.Output<outputs.storage.BucketObjectCustomerEncryption | undefined>;
readonly deletionPolicy: pulumi.Output<string | undefined>;
readonly detectMd5hash: pulumi.Output<string | undefined>;
/**
* Whether an object is under [event-based hold](https://cloud.google.com/storage/docs/object-holds#hold-types). Event-based hold is a way to retain objects until an event occurs, which is signified by the hold's release (i.e. this value is set to false). After being released (set to false), such objects will be subject to bucket-level retention (if any).
*/
readonly eventBasedHold: pulumi.Output<boolean | undefined>;
/**
* When set to true, it ensure the object's Content-Type is empty.
*/
readonly forceEmptyContentType: pulumi.Output<boolean | undefined>;
/**
* (Computed) The content generation of this object. Used for object [versioning](https://cloud.google.com/storage/docs/object-versioning) and [soft delete](https://cloud.google.com/storage/docs/soft-delete).
*/
readonly generation: pulumi.Output<number>;
/**
* The resource name of the Cloud KMS key that will be used to [encrypt](https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys) the object.
*/
readonly kmsKeyName: pulumi.Output<string>;
/**
* (Computed) Base 64 MD5 hash of the uploaded data.
*/
readonly md5hash: pulumi.Output<string>;
/**
* (Computed) Hex value of md5hash`
*/
readonly md5hexhash: pulumi.Output<string>;
/**
* (Computed) A url reference to download this object.
*/
readonly mediaLink: pulumi.Output<string>;
/**
* User-provided metadata, in key/value pairs.
*
* One of the following is required:
*/
readonly metadata: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* The name of the object. If you're interpolating the name of this object, see `outputName` instead.
*/
readonly name: pulumi.Output<string>;
/**
* (Computed) The name of the object. Use this field in interpolations with `gcp.storage.ObjectACL` to recreate
* `gcp.storage.ObjectACL` resources when your `gcp.storage.BucketObject` is recreated.
*/
readonly outputName: pulumi.Output<string>;
/**
* The [object retention](http://cloud.google.com/storage/docs/object-lock) settings for the object. The retention settings allow an object to be retained until a provided date. Structure is documented below.
*/
readonly retention: pulumi.Output<outputs.storage.BucketObjectRetention | undefined>;
/**
* (Computed) A url reference to this object.
*/
readonly selfLink: pulumi.Output<string>;
/**
* A path to the data you want to upload. Must be defined
* if `content` is not.
*
* - - -
*/
readonly source: pulumi.Output<pulumi.asset.Asset | pulumi.asset.Archive | undefined>;
/**
* User-provided md5hash to trigger replacement of object in storage bucket, Must be Base 64 MD5 hash of the object data. The usual way to set this is filemd5("file.zip"), where "file.zip" is the local filename
*/
readonly sourceMd5hash: pulumi.Output<string | undefined>;
/**
* The [StorageClass](https://cloud.google.com/storage/docs/storage-classes) of the new bucket object.
* Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`. If not provided, this defaults to the bucket's default
* storage class or to a [standard](https://cloud.google.com/storage/docs/storage-classes#standard) class.
*/
readonly storageClass: pulumi.Output<string>;
/**
* Whether an object is under [temporary hold](https://cloud.google.com/storage/docs/object-holds#hold-types). While this flag is set to true, the object is protected against deletion and overwrites.
*/
readonly temporaryHold: pulumi.Output<boolean | undefined>;
/**
* Create a BucketObject resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: BucketObjectArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering BucketObject resources.
*/
export interface BucketObjectState {
/**
* The name of the containing bucket.
*/
bucket?: pulumi.Input<string>;
/**
* [Cache-Control](https://tools.ietf.org/html/rfc7234#section-5.2)
* directive to specify caching behavior of object data. If omitted and object is accessible to all anonymous users, the default will be public, max-age=3600
*/
cacheControl?: pulumi.Input<string>;
/**
* Data as `string` to be uploaded. Must be defined if `source` is not. **Note**: The `content` field is marked as sensitive.
*/
content?: pulumi.Input<string>;
/**
* [Content-Disposition](https://tools.ietf.org/html/rfc6266) of the object data.
*/
contentDisposition?: pulumi.Input<string>;
/**
* [Content-Encoding](https://tools.ietf.org/html/rfc7231#section-3.1.2.2) of the object data.
*/
contentEncoding?: pulumi.Input<string>;
/**
* [Content-Language](https://tools.ietf.org/html/rfc7231#section-3.1.3.2) of the object data.
*/
contentLanguage?: pulumi.Input<string>;
/**
* [Content-Type](https://tools.ietf.org/html/rfc7231#section-3.1.1.5) of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".
*/
contentType?: pulumi.Input<string>;
/**
* (Computed) Base 64 CRC32 hash of the uploaded data.
*/
crc32c?: pulumi.Input<string>;
/**
* Enables object encryption with Customer-Supplied Encryption Key (CSEK). Google [documentation about CSEK.](https://cloud.google.com/storage/docs/encryption/customer-supplied-keys)
* Structure is documented below.
*/
customerEncryption?: pulumi.Input<inputs.storage.BucketObjectCustomerEncryption>;
deletionPolicy?: pulumi.Input<string>;
detectMd5hash?: pulumi.Input<string>;
/**
* Whether an object is under [event-based hold](https://cloud.google.com/storage/docs/object-holds#hold-types). Event-based hold is a way to retain objects until an event occurs, which is signified by the hold's release (i.e. this value is set to false). After being released (set to false), such objects will be subject to bucket-level retention (if any).
*/
eventBasedHold?: pulumi.Input<boolean>;
/**
* When set to true, it ensure the object's Content-Type is empty.
*/
forceEmptyContentType?: pulumi.Input<boolean>;
/**
* (Computed) The content generation of this object. Used for object [versioning](https://cloud.google.com/storage/docs/object-versioning) and [soft delete](https://cloud.google.com/storage/docs/soft-delete).
*/
generation?: pulumi.Input<number>;
/**
* The resource name of the Cloud KMS key that will be used to [encrypt](https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys) the object.
*/
kmsKeyName?: pulumi.Input<string>;
/**
* (Computed) Base 64 MD5 hash of the uploaded data.
*/
md5hash?: pulumi.Input<string>;
/**
* (Computed) Hex value of md5hash`
*/
md5hexhash?: pulumi.Input<string>;
/**
* (Computed) A url reference to download this object.
*/
mediaLink?: pulumi.Input<string>;
/**
* User-provided metadata, in key/value pairs.
*
* One of the following is required:
*/
metadata?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The name of the object. If you're interpolating the name of this object, see `outputName` instead.
*/
name?: pulumi.Input<string>;
/**
* (Computed) The name of the object. Use this field in interpolations with `gcp.storage.ObjectACL` to recreate
* `gcp.storage.ObjectACL` resources when your `gcp.storage.BucketObject` is recreated.
*/
outputName?: pulumi.Input<string>;
/**
* The [object retention](http://cloud.google.com/storage/docs/object-lock) settings for the object. The retention settings allow an object to be retained until a provided date. Structure is documented below.
*/
retention?: pulumi.Input<inputs.storage.BucketObjectRetention>;
/**
* (Computed) A url reference to this object.
*/
selfLink?: pulumi.Input<string>;
/**
* A path to the data you want to upload. Must be defined
* if `content` is not.
*
* - - -
*/
source?: pulumi.Input<pulumi.asset.Asset | pulumi.asset.Archive>;
/**
* User-provided md5hash to trigger replacement of object in storage bucket, Must be Base 64 MD5 hash of the object data. The usual way to set this is filemd5("file.zip"), where "file.zip" is the local filename
*/
sourceMd5hash?: pulumi.Input<string>;
/**
* The [StorageClass](https://cloud.google.com/storage/docs/storage-classes) of the new bucket object.
* Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`. If not provided, this defaults to the bucket's default
* storage class or to a [standard](https://cloud.google.com/storage/docs/storage-classes#standard) class.
*/
storageClass?: pulumi.Input<string>;
/**
* Whether an object is under [temporary hold](https://cloud.google.com/storage/docs/object-holds#hold-types). While this flag is set to true, the object is protected against deletion and overwrites.
*/
temporaryHold?: pulumi.Input<boolean>;
}
/**
* The set of arguments for constructing a BucketObject resource.
*/
export interface BucketObjectArgs {
/**
* The name of the containing bucket.
*/
bucket: pulumi.Input<string>;
/**
* [Cache-Control](https://tools.ietf.org/html/rfc7234#section-5.2)
* directive to specify caching behavior of object data. If omitted and object is accessible to all anonymous users, the default will be public, max-age=3600
*/
cacheControl?: pulumi.Input<string>;
/**
* Data as `string` to be uploaded. Must be defined if `source` is not. **Note**: The `content` field is marked as sensitive.
*/
content?: pulumi.Input<string>;
/**
* [Content-Disposition](https://tools.ietf.org/html/rfc6266) of the object data.
*/
contentDisposition?: pulumi.Input<string>;
/**
* [Content-Encoding](https://tools.ietf.org/html/rfc7231#section-3.1.2.2) of the object data.
*/
contentEncoding?: pulumi.Input<string>;
/**
* [Content-Language](https://tools.ietf.org/html/rfc7231#section-3.1.3.2) of the object data.
*/
contentLanguage?: pulumi.Input<string>;
/**
* [Content-Type](https://tools.ietf.org/html/rfc7231#section-3.1.1.5) of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".
*/
contentType?: pulumi.Input<string>;
/**
* Enables object encryption with Customer-Supplied Encryption Key (CSEK). Google [documentation about CSEK.](https://cloud.google.com/storage/docs/encryption/customer-supplied-keys)
* Structure is documented below.
*/
customerEncryption?: pulumi.Input<inputs.storage.BucketObjectCustomerEncryption>;
deletionPolicy?: pulumi.Input<string>;
detectMd5hash?: pulumi.Input<string>;
/**
* Whether an object is under [event-based hold](https://cloud.google.com/storage/docs/object-holds#hold-types). Event-based hold is a way to retain objects until an event occurs, which is signified by the hold's release (i.e. this value is set to false). After being released (set to false), such objects will be subject to bucket-level retention (if any).
*/
eventBasedHold?: pulumi.Input<boolean>;
/**
* When set to true, it ensure the object's Content-Type is empty.
*/
forceEmptyContentType?: pulumi.Input<boolean>;
/**
* The resource name of the Cloud KMS key that will be used to [encrypt](https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys) the object.
*/
kmsKeyName?: pulumi.Input<string>;
/**
* User-provided metadata, in key/value pairs.
*
* One of the following is required:
*/
metadata?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The name of the object. If you're interpolating the name of this object, see `outputName` instead.
*/
name?: pulumi.Input<string>;
/**
* The [object retention](http://cloud.google.com/storage/docs/object-lock) settings for the object. The retention settings allow an object to be retained until a provided date. Structure is documented below.
*/
retention?: pulumi.Input<inputs.storage.BucketObjectRetention>;
/**
* A path to the data you want to upload. Must be defined
* if `content` is not.
*
* - - -
*/
source?: pulumi.Input<pulumi.asset.Asset | pulumi.asset.Archive>;
/**
* User-provided md5hash to trigger replacement of object in storage bucket, Must be Base 64 MD5 hash of the object data. The usual way to set this is filemd5("file.zip"), where "file.zip" is the local filename
*/
sourceMd5hash?: pulumi.Input<string>;
/**
* The [StorageClass](https://cloud.google.com/storage/docs/storage-classes) of the new bucket object.
* Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`. If not provided, this defaults to the bucket's default
* storage class or to a [standard](https://cloud.google.com/storage/docs/storage-classes#standard) class.
*/
storageClass?: pulumi.Input<string>;
/**
* Whether an object is under [temporary hold](https://cloud.google.com/storage/docs/object-holds#hold-types). While this flag is set to true, the object is protected against deletion and overwrites.
*/
temporaryHold?: pulumi.Input<boolean>;
}