Class BucketObject


  • public class BucketObject
    extends com.pulumi.resources.CustomResource
    Creates a new object inside an existing bucket in Google cloud storage service (GCS). [ACLs](https://cloud.google.com/storage/docs/access-control/lists) can be applied using the `gcp.storage.ObjectACL` resource. For more information see [the official documentation](https://cloud.google.com/storage/docs/key-terms#objects) and [API](https://cloud.google.com/storage/docs/json_api/v1/objects). ## Example Usage Example creating a public object in an existing `image-store` bucket. ```java 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() .bucket("image-store") .source(new FileAsset("/images/nature/garden-tiger-moth.jpg")) .build()); } } ``` Example creating an empty folder in an existing `image-store` bucket. ```java 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() .bucket("image-store") .content(" ") .build()); } } ``` ## Import This resource does not support import.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> bucket()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> cacheControl()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> content()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> contentDisposition()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> contentEncoding()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> contentLanguage()  
      com.pulumi.core.Output<java.lang.String> contentType()  
      com.pulumi.core.Output<java.lang.String> crc32c()  
      com.pulumi.core.Output<java.util.Optional<BucketObjectCustomerEncryption>> customerEncryption()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> detectMd5hash()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> eventBasedHold()  
      static BucketObject get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, BucketObjectState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> kmsKeyName()  
      com.pulumi.core.Output<java.lang.String> md5hash()  
      com.pulumi.core.Output<java.lang.String> mediaLink()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> metadata()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> outputName()  
      com.pulumi.core.Output<java.lang.String> selfLink()  
      com.pulumi.core.Output<java.util.Optional<com.pulumi.asset.AssetOrArchive>> source()  
      com.pulumi.core.Output<java.lang.String> storageClass()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> temporaryHold()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BucketObject

        public BucketObject​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • BucketObject

        public BucketObject​(java.lang.String name,
                            BucketObjectArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • BucketObject

        public BucketObject​(java.lang.String name,
                            BucketObjectArgs args,
                            @Nullable
                            com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • bucket

        public com.pulumi.core.Output<java.lang.String> bucket()
        Returns:
        The name of the containing bucket.
      • cacheControl

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> cacheControl()
        Returns:
        [Cache-Control](https://tools.ietf.org/html/rfc7234#section-5.2) 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
      • content

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> content()
        Returns:
        Data as `string` to be uploaded. Must be defined if `source` is not. **Note**: The `content` field is marked as sensitive.
      • contentDisposition

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> contentDisposition()
        Returns:
        [Content-Disposition](https://tools.ietf.org/html/rfc6266) of the object data.
      • contentEncoding

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> contentEncoding()
        Returns:
        [Content-Encoding](https://tools.ietf.org/html/rfc7231#section-3.1.2.2) of the object data.
      • contentLanguage

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> contentLanguage()
        Returns:
        [Content-Language](https://tools.ietf.org/html/rfc7231#section-3.1.3.2) of the object data.
      • contentType

        public com.pulumi.core.Output<java.lang.String> contentType()
        Returns:
        [Content-Type](https://tools.ietf.org/html/rfc7231#section-3.1.1.5) of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".
      • crc32c

        public com.pulumi.core.Output<java.lang.String> crc32c()
        Returns:
        (Computed) Base 64 CRC32 hash of the uploaded data.
      • customerEncryption

        public com.pulumi.core.Output<java.util.Optional<BucketObjectCustomerEncryption>> customerEncryption()
        Returns:
        Enables object encryption with Customer-Supplied Encryption Key (CSEK). Google [documentation about CSEK.](https://cloud.google.com/storage/docs/encryption/customer-supplied-keys) Structure is documented below.
      • detectMd5hash

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> detectMd5hash()
      • eventBasedHold

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> eventBasedHold()
        Returns:
        Whether an object is under [event-based hold](https://cloud.google.com/storage/docs/object-holds#hold-types). 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).
      • kmsKeyName

        public com.pulumi.core.Output<java.lang.String> kmsKeyName()
        Returns:
        The resource name of the Cloud KMS key that will be used to [encrypt](https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys) the object.
      • md5hash

        public com.pulumi.core.Output<java.lang.String> md5hash()
        Returns:
        (Computed) Base 64 MD5 hash of the uploaded data.
      • mediaLink

        public com.pulumi.core.Output<java.lang.String> mediaLink()
        Returns:
        (Computed) A url reference to download this object.
      • metadata

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> metadata()
        Returns:
        User-provided metadata, in key/value pairs. One of the following is required:
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        The name of the object. If you're interpolating the name of this object, see `output_name` instead.
      • outputName

        public com.pulumi.core.Output<java.lang.String> outputName()
        Returns:
        (Computed) The name of the object. Use this field in interpolations with `gcp.storage.ObjectACL` to recreate `gcp.storage.ObjectACL` resources when your `gcp.storage.BucketObject` is recreated.
      • selfLink

        public com.pulumi.core.Output<java.lang.String> selfLink()
        Returns:
        (Computed) A url reference to this object.
      • source

        public com.pulumi.core.Output<java.util.Optional<com.pulumi.asset.AssetOrArchive>> source()
        Returns:
        A path to the data you want to upload. Must be defined if `content` is not. ***
      • storageClass

        public com.pulumi.core.Output<java.lang.String> storageClass()
        Returns:
        The [StorageClass](https://cloud.google.com/storage/docs/storage-classes) 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](https://cloud.google.com/storage/docs/storage-classes#standard) class.
      • temporaryHold

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> temporaryHold()
        Returns:
        Whether an object is under [temporary hold](https://cloud.google.com/storage/docs/object-holds#hold-types). While this flag is set to true, the object is protected against deletion and overwrites.
      • get

        public static BucketObject get​(java.lang.String name,
                                       com.pulumi.core.Output<java.lang.String> id,
                                       @Nullable
                                       BucketObjectState state,
                                       @Nullable
                                       com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.