BucketObject

class BucketObject : KotlinCustomResource

Provides a resource to put a object(content or file) to a oss bucket.

Example Usage

Uploading a file to a bucket

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomInteger;
import com.pulumi.random.RandomIntegerArgs;
import com.pulumi.alicloud.oss.Bucket;
import com.pulumi.alicloud.oss.BucketArgs;
import com.pulumi.alicloud.oss.BucketObject;
import com.pulumi.alicloud.oss.BucketObjectArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var defaultRandomInteger = new RandomInteger("defaultRandomInteger", RandomIntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var defaultBucket = new Bucket("defaultBucket", BucketArgs.builder()
.bucket(defaultRandomInteger.result().applyValue(result -> String.format("terraform-example-%s", result)))
.acl("private")
.build());
var defaultBucketObject = new BucketObject("defaultBucketObject", BucketObjectArgs.builder()
.bucket(defaultBucket.bucket())
.key("example_key")
.source("./main.tf")
.build());
}
}

Uploading a content to a bucket

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomInteger;
import com.pulumi.random.RandomIntegerArgs;
import com.pulumi.alicloud.oss.Bucket;
import com.pulumi.alicloud.oss.BucketArgs;
import com.pulumi.alicloud.oss.BucketObject;
import com.pulumi.alicloud.oss.BucketObjectArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var defaultRandomInteger = new RandomInteger("defaultRandomInteger", RandomIntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var defaultBucket = new Bucket("defaultBucket", BucketArgs.builder()
.bucket(defaultRandomInteger.result().applyValue(result -> String.format("terraform-example-%s", result)))
.acl("private")
.build());
var defaultBucketObject = new BucketObject("defaultBucketObject", BucketObjectArgs.builder()
.bucket(defaultBucket.bucket())
.key("example_key")
.content("the content that you want to upload.")
.build());
}
}

Properties

Link copied to clipboard
val acl: Output<String>?

The canned ACL to apply. Defaults to "private".

Link copied to clipboard
val bucket: Output<String>

The name of the bucket to put the file in.

Link copied to clipboard
val cacheControl: Output<String>?

Specifies caching behavior along the request/reply chain. Read RFC2616 Cache-Control for further details.

Link copied to clipboard
val content: Output<String>?

The literal content being uploaded to the bucket.

Link copied to clipboard

Specifies presentational information for the object. Read RFC2616 Content-Disposition for further details.

Link copied to clipboard
val contentEncoding: Output<String>?

Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. Read RFC2616 Content-Encoding for further details.

Link copied to clipboard
val contentLength: Output<String>

the content length of request.

Link copied to clipboard
val contentMd5: Output<String>?

The MD5 value of the content. Read MD5 for computing method.

Link copied to clipboard
val contentType: Output<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.

Link copied to clipboard
val etag: Output<String>

the ETag generated for the object (an MD5 sum of the object content).

Link copied to clipboard
val expires: Output<String>?

Specifies expire date for the the request/response. Read RFC2616 Expires for further details.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val key: Output<String>

The name of the object once it is in the bucket.

Link copied to clipboard
val kmsKeyId: Output<String>?

Specifies the primary key managed by KMS. This parameter is valid when the value of server_side_encryption is set to KMS. Either source or content must be provided to specify the bucket content. These two arguments are mutually-exclusive.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Specifies server-side encryption of the object in OSS. Valid values are AES256, KMS. Default value is AES256.

Link copied to clipboard
val source: Output<String>?

The path to the source file being uploaded to the bucket.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val versionId: Output<String>

A unique version ID value for the object, if bucket versioning is enabled.