BucketObjectArgs

data class BucketObjectArgs(val bucket: Output<String>? = null, val cacheControl: Output<String>? = null, val content: Output<String>? = null, val contentDisposition: Output<String>? = null, val contentEncoding: Output<String>? = null, val contentLanguage: Output<String>? = null, val contentType: Output<String>? = null, val customerEncryption: Output<BucketObjectCustomerEncryptionArgs>? = null, val detectMd5hash: Output<String>? = null, val eventBasedHold: Output<Boolean>? = null, val kmsKeyName: Output<String>? = null, val metadata: Output<Map<String, String>>? = null, val name: Output<String>? = null, val retention: Output<BucketObjectRetentionArgs>? = null, val source: Output<AssetOrArchive>? = null, val storageClass: Output<String>? = null, val temporaryHold: Output<Boolean>? = null) : ConvertibleToJava<BucketObjectArgs>

Creates a new object inside an existing bucket in Google cloud storage service (GCS). ACLs can be applied using the gcp.storage.ObjectACL resource. For more information see the official documentation and API.

Example Usage

Example creating a public object in an existing image-store bucket.

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",
});
import pulumi
import pulumi_gcp as gcp
picture = gcp.storage.BucketObject("picture",
name="butterfly01",
source=pulumi.FileAsset("/images/nature/garden-tiger-moth.jpg"),
bucket="image-store")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var picture = new Gcp.Storage.BucketObject("picture", new()
{
Name = "butterfly01",
Source = new FileAsset("/images/nature/garden-tiger-moth.jpg"),
Bucket = "image-store",
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := storage.NewBucketObject(ctx, "picture", &storage.BucketObjectArgs{
Name: pulumi.String("butterfly01"),
Source: pulumi.NewFileAsset("/images/nature/garden-tiger-moth.jpg"),
Bucket: pulumi.String("image-store"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.BucketObject;
import com.pulumi.gcp.storage.BucketObjectArgs;
import com.pulumi.asset.FileAsset;
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 picture = new BucketObject("picture", BucketObjectArgs.builder()
.name("butterfly01")
.source(new FileAsset("/images/nature/garden-tiger-moth.jpg"))
.bucket("image-store")
.build());
}
}
resources:
picture:
type: gcp:storage:BucketObject
properties:
name: butterfly01
source:
fn::FileAsset: /images/nature/garden-tiger-moth.jpg
bucket: image-store

Example creating an empty folder in an existing image-store bucket.

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 pulumi
import pulumi_gcp as gcp
empty_folder = gcp.storage.BucketObject("empty_folder",
name="empty_folder/",
content=" ",
bucket="image-store")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var emptyFolder = new Gcp.Storage.BucketObject("empty_folder", new()
{
Name = "empty_folder/",
Content = " ",
Bucket = "image-store",
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := storage.NewBucketObject(ctx, "empty_folder", &storage.BucketObjectArgs{
Name: pulumi.String("empty_folder/"),
Content: pulumi.String(" "),
Bucket: pulumi.String("image-store"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.BucketObject;
import com.pulumi.gcp.storage.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 emptyFolder = new BucketObject("emptyFolder", BucketObjectArgs.builder()
.name("empty_folder/")
.content(" ")
.bucket("image-store")
.build());
}
}
resources:
emptyFolder:
type: gcp:storage:BucketObject
name: empty_folder
properties:
name: empty_folder/
content: ' '
bucket: image-store

Import

This resource does not support import.

Constructors

Link copied to clipboard
constructor(bucket: Output<String>? = null, cacheControl: Output<String>? = null, content: Output<String>? = null, contentDisposition: Output<String>? = null, contentEncoding: Output<String>? = null, contentLanguage: Output<String>? = null, contentType: Output<String>? = null, customerEncryption: Output<BucketObjectCustomerEncryptionArgs>? = null, detectMd5hash: Output<String>? = null, eventBasedHold: Output<Boolean>? = null, kmsKeyName: Output<String>? = null, metadata: Output<Map<String, String>>? = null, name: Output<String>? = null, retention: Output<BucketObjectRetentionArgs>? = null, source: Output<AssetOrArchive>? = null, storageClass: Output<String>? = null, temporaryHold: Output<Boolean>? = null)

Properties

Link copied to clipboard
val bucket: Output<String>? = null

The name of the containing bucket.

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

Cache-Control 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

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

Data as string to be uploaded. Must be defined if source is not. Note: The content field is marked as sensitive.

Link copied to clipboard
val contentDisposition: Output<String>? = null

Content-Disposition of the object data.

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

Content-Encoding of the object data.

Link copied to clipboard
val contentLanguage: Output<String>? = null

Content-Language of the object data.

Link copied to clipboard
val contentType: Output<String>? = null

Content-Type of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".

Link copied to clipboard

Enables object encryption with Customer-Supplied Encryption Key (CSEK). Google documentation about CSEK. Structure is documented below.

Link copied to clipboard
val detectMd5hash: Output<String>? = null
Link copied to clipboard
val eventBasedHold: Output<Boolean>? = null

Whether an object is under event-based hold. 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).

Link copied to clipboard
val kmsKeyName: Output<String>? = null

The resource name of the Cloud KMS key that will be used to encrypt the object.

Link copied to clipboard
val metadata: Output<Map<String, String>>? = null

User-provided metadata, in key/value pairs. One of the following is required:

Link copied to clipboard
val name: Output<String>? = null

The name of the object. If you're interpolating the name of this object, see output_name instead.

Link copied to clipboard

The object retention settings for the object. The retention settings allow an object to be retained until a provided date. Structure is documented below.

Link copied to clipboard
val source: Output<AssetOrArchive>? = null

A path to the data you want to upload. Must be defined if content is not.

Link copied to clipboard
val storageClass: Output<String>? = null

The StorageClass 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 class.

Link copied to clipboard
val temporaryHold: Output<Boolean>? = null

Whether an object is under temporary hold. While this flag is set to true, the object is protected against deletion and overwrites.

Functions

Link copied to clipboard
open override fun toJava(): BucketObjectArgs