@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
148 lines • 6.36 kB
JavaScript
;
// *** 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.BucketObject = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* 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,
*
* ]
*
* } }
*/
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, Object.assign(Object.assign({}, 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["acl"] = state ? state.acl : undefined;
resourceInputs["bucket"] = state ? state.bucket : undefined;
resourceInputs["content"] = state ? state.content : undefined;
resourceInputs["contentType"] = state ? state.contentType : undefined;
resourceInputs["encryption"] = state ? state.encryption : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["key"] = state ? state.key : undefined;
resourceInputs["kmsKeyId"] = state ? state.kmsKeyId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["size"] = state ? state.size : undefined;
resourceInputs["source"] = state ? state.source : undefined;
resourceInputs["storageClass"] = state ? state.storageClass : undefined;
resourceInputs["versionId"] = state ? state.versionId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.bucket === undefined) && !opts.urn) {
throw new Error("Missing required property 'bucket'");
}
if ((!args || args.key === undefined) && !opts.urn) {
throw new Error("Missing required property 'key'");
}
resourceInputs["acl"] = args ? args.acl : undefined;
resourceInputs["bucket"] = args ? args.bucket : undefined;
resourceInputs["content"] = args ? args.content : undefined;
resourceInputs["contentType"] = args ? args.contentType : undefined;
resourceInputs["encryption"] = args ? args.encryption : undefined;
resourceInputs["etag"] = args ? args.etag : undefined;
resourceInputs["key"] = args ? args.key : undefined;
resourceInputs["kmsKeyId"] = args ? args.kmsKeyId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["source"] = args ? args.source : undefined;
resourceInputs["storageClass"] = args ? args.storageClass : undefined;
resourceInputs["size"] = undefined /*out*/;
resourceInputs["versionId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(BucketObject.__pulumiType, name, resourceInputs, opts);
}
}
exports.BucketObject = BucketObject;
/** @internal */
BucketObject.__pulumiType = 'huaweicloud:Obs/bucketObject:BucketObject';
//# sourceMappingURL=bucketObject.js.map