Permalink
Fetching contributors…
Cannot retrieve contributors at this time
258 lines (251 sloc) 13 KB
// *** 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! ***
import * as pulumi from "@pulumi/pulumi";
import * as utilities from "../utilities";
/**
* Creates a new bucket in Google cloud storage service (GCS).
* Once a bucket has been created, its location can't be changed.
* [ACLs](https://cloud.google.com/storage/docs/access-control/lists) can be applied using the `google_storage_bucket_acl` resource.
* For more information see
* [the official documentation](https://cloud.google.com/storage/docs/overview)
* and
* [API](https://cloud.google.com/storage/docs/json_api/v1/buckets).
*
*/
export class Bucket extends pulumi.CustomResource {
/**
* Get an existing Bucket 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.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: BucketState): Bucket {
return new Bucket(name, <any>state, { id });
}
/**
* The bucket's [Cross-Origin Resource Sharing (CORS)](https://www.w3.org/TR/cors/) configuration. Multiple blocks of this type are permitted. Structure is documented below.
*/
public readonly cors: pulumi.Output<{ maxAgeSeconds?: number, methods?: string[], origins?: string[], responseHeaders?: string[] }[] | undefined>;
/**
* The bucket's encryption configuration.
*/
public readonly encryption: pulumi.Output<{ defaultKmsKeyName: string } | undefined>;
/**
* When deleting a bucket, this
* boolean option will delete all contained objects. If you try to delete a
* bucket that contains objects, Terraform will fail that run.
*/
public readonly forceDestroy: pulumi.Output<boolean | undefined>;
/**
* A set of key/value label pairs to assign to the bucket.
*/
public readonly labels: pulumi.Output<{[key: string]: string} | undefined>;
/**
* The bucket's [Lifecycle Rules](https://cloud.google.com/storage/docs/lifecycle#configuration) configuration. Multiple blocks of this type are permitted. Structure is documented below.
*/
public readonly lifecycleRules: pulumi.Output<{ action: { storageClass?: string, type: string }, condition: { age?: number, createdBefore?: string, isLive?: boolean, matchesStorageClasses?: string[], numNewerVersions?: number } }[] | undefined>;
/**
* The [GCS location](https://cloud.google.com/storage/docs/bucket-locations)
*/
public readonly location: pulumi.Output<string | undefined>;
/**
* The bucket's [Access & Storage Logs](https://cloud.google.com/storage/docs/access-logs) configuration.
*/
public readonly logging: pulumi.Output<{ logBucket: string, logObjectPrefix: string } | undefined>;
/**
* The name of the bucket.
*/
public readonly name: pulumi.Output<string>;
/**
* The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
*/
public readonly project: pulumi.Output<string>;
/**
* The URI of the created resource.
*/
public /*out*/ readonly selfLink: pulumi.Output<string>;
/**
* The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`.
*/
public readonly storageClass: pulumi.Output<string | undefined>;
/**
* The base URL of the bucket, in the format `gs://<bucket-name>`.
*/
public /*out*/ readonly url: pulumi.Output<string>;
/**
* The bucket's [Versioning](https://cloud.google.com/storage/docs/object-versioning) configuration.
*/
public readonly versioning: pulumi.Output<{ enabled?: boolean } | undefined>;
/**
* Configuration if the bucket acts as a website. Structure is documented below.
*/
public readonly websites: pulumi.Output<{ mainPageSuffix?: string, notFoundPage?: string }[] | undefined>;
/**
* Create a Bucket 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?: BucketArgs, opts?: pulumi.CustomResourceOptions)
constructor(name: string, argsOrState?: BucketArgs | BucketState, opts?: pulumi.CustomResourceOptions) {
let inputs: pulumi.Inputs = {};
if (opts && opts.id) {
const state: BucketState = argsOrState as BucketState | undefined;
inputs["cors"] = state ? state.cors : undefined;
inputs["encryption"] = state ? state.encryption : undefined;
inputs["forceDestroy"] = state ? state.forceDestroy : undefined;
inputs["labels"] = state ? state.labels : undefined;
inputs["lifecycleRules"] = state ? state.lifecycleRules : undefined;
inputs["location"] = state ? state.location : undefined;
inputs["logging"] = state ? state.logging : undefined;
inputs["name"] = state ? state.name : undefined;
inputs["project"] = state ? state.project : undefined;
inputs["selfLink"] = state ? state.selfLink : undefined;
inputs["storageClass"] = state ? state.storageClass : undefined;
inputs["url"] = state ? state.url : undefined;
inputs["versioning"] = state ? state.versioning : undefined;
inputs["websites"] = state ? state.websites : undefined;
} else {
const args = argsOrState as BucketArgs | undefined;
inputs["cors"] = args ? args.cors : undefined;
inputs["encryption"] = args ? args.encryption : undefined;
inputs["forceDestroy"] = args ? args.forceDestroy : undefined;
inputs["labels"] = args ? args.labels : undefined;
inputs["lifecycleRules"] = args ? args.lifecycleRules : undefined;
inputs["location"] = args ? args.location : undefined;
inputs["logging"] = args ? args.logging : undefined;
inputs["name"] = args ? args.name : undefined;
inputs["project"] = args ? args.project : undefined;
inputs["storageClass"] = args ? args.storageClass : undefined;
inputs["versioning"] = args ? args.versioning : undefined;
inputs["websites"] = args ? args.websites : undefined;
inputs["selfLink"] = undefined /*out*/;
inputs["url"] = undefined /*out*/;
}
super("gcp:storage/bucket:Bucket", name, inputs, opts);
}
}
/**
* Input properties used for looking up and filtering Bucket resources.
*/
export interface BucketState {
/**
* The bucket's [Cross-Origin Resource Sharing (CORS)](https://www.w3.org/TR/cors/) configuration. Multiple blocks of this type are permitted. Structure is documented below.
*/
readonly cors?: pulumi.Input<pulumi.Input<{ maxAgeSeconds?: pulumi.Input<number>, methods?: pulumi.Input<pulumi.Input<string>[]>, origins?: pulumi.Input<pulumi.Input<string>[]>, responseHeaders?: pulumi.Input<pulumi.Input<string>[]> }>[]>;
/**
* The bucket's encryption configuration.
*/
readonly encryption?: pulumi.Input<{ defaultKmsKeyName: pulumi.Input<string> }>;
/**
* When deleting a bucket, this
* boolean option will delete all contained objects. If you try to delete a
* bucket that contains objects, Terraform will fail that run.
*/
readonly forceDestroy?: pulumi.Input<boolean>;
/**
* A set of key/value label pairs to assign to the bucket.
*/
readonly labels?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* The bucket's [Lifecycle Rules](https://cloud.google.com/storage/docs/lifecycle#configuration) configuration. Multiple blocks of this type are permitted. Structure is documented below.
*/
readonly lifecycleRules?: pulumi.Input<pulumi.Input<{ action: pulumi.Input<{ storageClass?: pulumi.Input<string>, type: pulumi.Input<string> }>, condition: pulumi.Input<{ age?: pulumi.Input<number>, createdBefore?: pulumi.Input<string>, isLive?: pulumi.Input<boolean>, matchesStorageClasses?: pulumi.Input<pulumi.Input<string>[]>, numNewerVersions?: pulumi.Input<number> }> }>[]>;
/**
* The [GCS location](https://cloud.google.com/storage/docs/bucket-locations)
*/
readonly location?: pulumi.Input<string>;
/**
* The bucket's [Access & Storage Logs](https://cloud.google.com/storage/docs/access-logs) configuration.
*/
readonly logging?: pulumi.Input<{ logBucket: pulumi.Input<string>, logObjectPrefix?: pulumi.Input<string> }>;
/**
* The name of the bucket.
*/
readonly name?: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
*/
readonly project?: pulumi.Input<string>;
/**
* The URI of the created resource.
*/
readonly selfLink?: pulumi.Input<string>;
/**
* The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`.
*/
readonly storageClass?: pulumi.Input<string>;
/**
* The base URL of the bucket, in the format `gs://<bucket-name>`.
*/
readonly url?: pulumi.Input<string>;
/**
* The bucket's [Versioning](https://cloud.google.com/storage/docs/object-versioning) configuration.
*/
readonly versioning?: pulumi.Input<{ enabled?: pulumi.Input<boolean> }>;
/**
* Configuration if the bucket acts as a website. Structure is documented below.
*/
readonly websites?: pulumi.Input<pulumi.Input<{ mainPageSuffix?: pulumi.Input<string>, notFoundPage?: pulumi.Input<string> }>[]>;
}
/**
* The set of arguments for constructing a Bucket resource.
*/
export interface BucketArgs {
/**
* The bucket's [Cross-Origin Resource Sharing (CORS)](https://www.w3.org/TR/cors/) configuration. Multiple blocks of this type are permitted. Structure is documented below.
*/
readonly cors?: pulumi.Input<pulumi.Input<{ maxAgeSeconds?: pulumi.Input<number>, methods?: pulumi.Input<pulumi.Input<string>[]>, origins?: pulumi.Input<pulumi.Input<string>[]>, responseHeaders?: pulumi.Input<pulumi.Input<string>[]> }>[]>;
/**
* The bucket's encryption configuration.
*/
readonly encryption?: pulumi.Input<{ defaultKmsKeyName: pulumi.Input<string> }>;
/**
* When deleting a bucket, this
* boolean option will delete all contained objects. If you try to delete a
* bucket that contains objects, Terraform will fail that run.
*/
readonly forceDestroy?: pulumi.Input<boolean>;
/**
* A set of key/value label pairs to assign to the bucket.
*/
readonly labels?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* The bucket's [Lifecycle Rules](https://cloud.google.com/storage/docs/lifecycle#configuration) configuration. Multiple blocks of this type are permitted. Structure is documented below.
*/
readonly lifecycleRules?: pulumi.Input<pulumi.Input<{ action: pulumi.Input<{ storageClass?: pulumi.Input<string>, type: pulumi.Input<string> }>, condition: pulumi.Input<{ age?: pulumi.Input<number>, createdBefore?: pulumi.Input<string>, isLive?: pulumi.Input<boolean>, matchesStorageClasses?: pulumi.Input<pulumi.Input<string>[]>, numNewerVersions?: pulumi.Input<number> }> }>[]>;
/**
* The [GCS location](https://cloud.google.com/storage/docs/bucket-locations)
*/
readonly location?: pulumi.Input<string>;
/**
* The bucket's [Access & Storage Logs](https://cloud.google.com/storage/docs/access-logs) configuration.
*/
readonly logging?: pulumi.Input<{ logBucket: pulumi.Input<string>, logObjectPrefix?: pulumi.Input<string> }>;
/**
* The name of the bucket.
*/
readonly name?: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
*/
readonly project?: pulumi.Input<string>;
/**
* The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`.
*/
readonly storageClass?: pulumi.Input<string>;
/**
* The bucket's [Versioning](https://cloud.google.com/storage/docs/object-versioning) configuration.
*/
readonly versioning?: pulumi.Input<{ enabled?: pulumi.Input<boolean> }>;
/**
* Configuration if the bucket acts as a website. Structure is documented below.
*/
readonly websites?: pulumi.Input<pulumi.Input<{ mainPageSuffix?: pulumi.Input<string>, notFoundPage?: pulumi.Input<string> }>[]>;
}