UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

263 lines (262 loc) 9.19 kB
import * as pulumi from "@pulumi/pulumi"; /** * Provides an OBS bucket object resource. * * ## Example Usage * ### Uploading to a bucket * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * * const object = new huaweicloud.Obs.BucketObject("object", { * bucket: "your_bucket_name", * content: "some object content", * contentType: "application/xml", * key: "new_key_from_content", * }); * ``` * ### Uploading a file to a bucket * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const examplebucket = new huaweicloud.obs.Bucket("examplebucket", { * bucket: "examplebuckettftest", * acl: "private", * }); * const object = new huaweicloud.obs.BucketObject("object", { * bucket: examplebucket.bucket, * key: "new_key_from_file", * source: "index.html", * }); * ``` * ### Server Side Encryption with OBS Default Master Key * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * * const examplebucketObject = new huaweicloud.Obs.BucketObject("examplebucket_object", { * bucket: "your_bucket_name", * encryption: true, * key: "someobject", * source: "index.html", * }); * ``` * * ## Import * * OBS bucket object can be imported using the bucket and key separated by a slash, e.g. bash * * ```sh * $ pulumi import huaweicloud:Obs/bucketObject:BucketObject object bucket/key * ``` * * Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`encryption`, `source`, `acl` and `kms_key_id`. It is generally recommended running `terraform plan` after importing an object. You can then decide if changes should be applied to the object, or the resource definition should be updated to align with the object. Also you can ignore changes as below. hcl resource "huaweicloud_obs_bucket_object" "object" { * * ... * * lifecycle { * * ignore_changes = [ * * encryption, source, acl, kms_key_id, * * ] * * } } */ 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 ACL policy to apply. Defaults to `private`. */ readonly acl: pulumi.Output<string | undefined>; /** * The name of the bucket to put the file in. */ readonly bucket: pulumi.Output<string>; /** * The literal content being uploaded to the bucket. */ readonly content: pulumi.Output<string | undefined>; /** * A standard MIME type describing the format of the object data, e.g. * application/octet-stream. All Valid MIME Types are valid for this input. */ readonly contentType: pulumi.Output<string>; /** * Whether enable server-side encryption of the object in SSE-KMS mode. */ readonly encryption: pulumi.Output<boolean | undefined>; /** * Specifies the unique identifier of the object content. It can be used to trigger updates. * The only meaningful value is `md5(file("pathToFile"))`. */ readonly etag: pulumi.Output<string>; /** * The name of the object once it is in the bucket. */ readonly key: pulumi.Output<string>; /** * The ID of the kms key. If omitted, the default master key will be used. */ readonly kmsKeyId: pulumi.Output<string | undefined>; /** * The region in which to create the OBS bucket object resource. If omitted, the * provider-level region will be used. Changing this creates a new OBS bucket object resource. */ readonly region: pulumi.Output<string>; /** * the size of the object in bytes. */ readonly size: pulumi.Output<number>; /** * The path to the source file being uploaded to the bucket. */ readonly source: pulumi.Output<string | undefined>; /** * Specifies the storage class of the object. Defaults to `STANDARD`. */ readonly storageClass: pulumi.Output<string>; /** * A unique version ID value for the object, if bucket versioning is enabled. */ readonly versionId: pulumi.Output<string>; /** * 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 ACL policy to apply. Defaults to `private`. */ acl?: pulumi.Input<string>; /** * The name of the bucket to put the file in. */ bucket?: pulumi.Input<string>; /** * The literal content being uploaded to the bucket. */ content?: pulumi.Input<string>; /** * A standard MIME type describing the format of the object data, e.g. * application/octet-stream. All Valid MIME Types are valid for this input. */ contentType?: pulumi.Input<string>; /** * Whether enable server-side encryption of the object in SSE-KMS mode. */ encryption?: pulumi.Input<boolean>; /** * Specifies the unique identifier of the object content. It can be used to trigger updates. * The only meaningful value is `md5(file("pathToFile"))`. */ etag?: pulumi.Input<string>; /** * The name of the object once it is in the bucket. */ key?: pulumi.Input<string>; /** * The ID of the kms key. If omitted, the default master key will be used. */ kmsKeyId?: pulumi.Input<string>; /** * The region in which to create the OBS bucket object resource. If omitted, the * provider-level region will be used. Changing this creates a new OBS bucket object resource. */ region?: pulumi.Input<string>; /** * the size of the object in bytes. */ size?: pulumi.Input<number>; /** * The path to the source file being uploaded to the bucket. */ source?: pulumi.Input<string>; /** * Specifies the storage class of the object. Defaults to `STANDARD`. */ storageClass?: pulumi.Input<string>; /** * A unique version ID value for the object, if bucket versioning is enabled. */ versionId?: pulumi.Input<string>; } /** * The set of arguments for constructing a BucketObject resource. */ export interface BucketObjectArgs { /** * The ACL policy to apply. Defaults to `private`. */ acl?: pulumi.Input<string>; /** * The name of the bucket to put the file in. */ bucket: pulumi.Input<string>; /** * The literal content being uploaded to the bucket. */ content?: pulumi.Input<string>; /** * A standard MIME type describing the format of the object data, e.g. * application/octet-stream. All Valid MIME Types are valid for this input. */ contentType?: pulumi.Input<string>; /** * Whether enable server-side encryption of the object in SSE-KMS mode. */ encryption?: pulumi.Input<boolean>; /** * Specifies the unique identifier of the object content. It can be used to trigger updates. * The only meaningful value is `md5(file("pathToFile"))`. */ etag?: pulumi.Input<string>; /** * The name of the object once it is in the bucket. */ key: pulumi.Input<string>; /** * The ID of the kms key. If omitted, the default master key will be used. */ kmsKeyId?: pulumi.Input<string>; /** * The region in which to create the OBS bucket object resource. If omitted, the * provider-level region will be used. Changing this creates a new OBS bucket object resource. */ region?: pulumi.Input<string>; /** * The path to the source file being uploaded to the bucket. */ source?: pulumi.Input<string>; /** * Specifies the storage class of the object. Defaults to `STANDARD`. */ storageClass?: pulumi.Input<string>; }