1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. storage
  5. getBucketObject
Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi

gcp.storage.getBucketObject

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi

    Gets an existing object inside an existing bucket in Google Cloud Storage service (GCS). See the official documentation and API.

    Example Usage

    Example picture stored within a folder.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const picture = gcp.storage.getBucketObject({
        name: "folder/butterfly01.jpg",
        bucket: "image-store",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    picture = gcp.storage.get_bucket_object(name="folder/butterfly01.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.LookupBucketObject(ctx, &storage.LookupBucketObjectArgs{
    			Name:   pulumi.StringRef("folder/butterfly01.jpg"),
    			Bucket: pulumi.StringRef("image-store"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var picture = Gcp.Storage.GetBucketObject.Invoke(new()
        {
            Name = "folder/butterfly01.jpg",
            Bucket = "image-store",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.storage.StorageFunctions;
    import com.pulumi.gcp.storage.inputs.GetBucketObjectArgs;
    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) {
            final var picture = StorageFunctions.getBucketObject(GetBucketObjectArgs.builder()
                .name("folder/butterfly01.jpg")
                .bucket("image-store")
                .build());
    
        }
    }
    
    variables:
      picture:
        fn::invoke:
          Function: gcp:storage:getBucketObject
          Arguments:
            name: folder/butterfly01.jpg
            bucket: image-store
    

    Using getBucketObject

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getBucketObject(args: GetBucketObjectArgs, opts?: InvokeOptions): Promise<GetBucketObjectResult>
    function getBucketObjectOutput(args: GetBucketObjectOutputArgs, opts?: InvokeOptions): Output<GetBucketObjectResult>
    def get_bucket_object(bucket: Optional[str] = None,
                          name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetBucketObjectResult
    def get_bucket_object_output(bucket: Optional[pulumi.Input[str]] = None,
                          name: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetBucketObjectResult]
    func LookupBucketObject(ctx *Context, args *LookupBucketObjectArgs, opts ...InvokeOption) (*LookupBucketObjectResult, error)
    func LookupBucketObjectOutput(ctx *Context, args *LookupBucketObjectOutputArgs, opts ...InvokeOption) LookupBucketObjectResultOutput

    > Note: This function is named LookupBucketObject in the Go SDK.

    public static class GetBucketObject 
    {
        public static Task<GetBucketObjectResult> InvokeAsync(GetBucketObjectArgs args, InvokeOptions? opts = null)
        public static Output<GetBucketObjectResult> Invoke(GetBucketObjectInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetBucketObjectResult> getBucketObject(GetBucketObjectArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:storage/getBucketObject:getBucketObject
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Bucket string
    The name of the containing bucket.
    Name string
    The name of the object.
    Bucket string
    The name of the containing bucket.
    Name string
    The name of the object.
    bucket String
    The name of the containing bucket.
    name String
    The name of the object.
    bucket string
    The name of the containing bucket.
    name string
    The name of the object.
    bucket str
    The name of the containing bucket.
    name str
    The name of the object.
    bucket String
    The name of the containing bucket.
    name String
    The name of the object.

    getBucketObject Result

    The following output properties are available:

    CacheControl string
    (Computed) 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
    Content string
    ContentDisposition string
    (Computed) Content-Disposition of the object data.
    ContentEncoding string
    (Computed) Content-Encoding of the object data.
    ContentLanguage string
    (Computed) Content-Language of the object data.
    ContentType string
    (Computed) Content-Type of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".
    Crc32c string
    (Computed) Base 64 CRC32 hash of the uploaded data.
    CustomerEncryptions List<GetBucketObjectCustomerEncryption>
    DetectMd5hash string
    EventBasedHold bool
    (Computed) 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).
    Id string
    The provider-assigned unique ID for this managed resource.
    KmsKeyName string
    Md5hash string
    (Computed) Base 64 MD5 hash of the uploaded data.
    MediaLink string
    (Computed) A url reference to download this object.
    Metadata Dictionary<string, string>
    OutputName string
    Retentions List<GetBucketObjectRetention>
    SelfLink string
    (Computed) A url reference to this object.
    Source string
    StorageClass string
    (Computed) 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.
    TemporaryHold bool
    (Computed) Whether an object is under temporary hold. While this flag is set to true, the object is protected against deletion and overwrites.
    Bucket string
    Name string
    CacheControl string
    (Computed) 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
    Content string
    ContentDisposition string
    (Computed) Content-Disposition of the object data.
    ContentEncoding string
    (Computed) Content-Encoding of the object data.
    ContentLanguage string
    (Computed) Content-Language of the object data.
    ContentType string
    (Computed) Content-Type of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".
    Crc32c string
    (Computed) Base 64 CRC32 hash of the uploaded data.
    CustomerEncryptions []GetBucketObjectCustomerEncryption
    DetectMd5hash string
    EventBasedHold bool
    (Computed) 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).
    Id string
    The provider-assigned unique ID for this managed resource.
    KmsKeyName string
    Md5hash string
    (Computed) Base 64 MD5 hash of the uploaded data.
    MediaLink string
    (Computed) A url reference to download this object.
    Metadata map[string]string
    OutputName string
    Retentions []GetBucketObjectRetention
    SelfLink string
    (Computed) A url reference to this object.
    Source string
    StorageClass string
    (Computed) 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.
    TemporaryHold bool
    (Computed) Whether an object is under temporary hold. While this flag is set to true, the object is protected against deletion and overwrites.
    Bucket string
    Name string
    cacheControl String
    (Computed) 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
    content String
    contentDisposition String
    (Computed) Content-Disposition of the object data.
    contentEncoding String
    (Computed) Content-Encoding of the object data.
    contentLanguage String
    (Computed) Content-Language of the object data.
    contentType String
    (Computed) Content-Type of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".
    crc32c String
    (Computed) Base 64 CRC32 hash of the uploaded data.
    customerEncryptions List<GetBucketObjectCustomerEncryption>
    detectMd5hash String
    eventBasedHold Boolean
    (Computed) 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).
    id String
    The provider-assigned unique ID for this managed resource.
    kmsKeyName String
    md5hash String
    (Computed) Base 64 MD5 hash of the uploaded data.
    mediaLink String
    (Computed) A url reference to download this object.
    metadata Map<String,String>
    outputName String
    retentions List<GetBucketObjectRetention>
    selfLink String
    (Computed) A url reference to this object.
    source String
    storageClass String
    (Computed) 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.
    temporaryHold Boolean
    (Computed) Whether an object is under temporary hold. While this flag is set to true, the object is protected against deletion and overwrites.
    bucket String
    name String
    cacheControl string
    (Computed) 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
    content string
    contentDisposition string
    (Computed) Content-Disposition of the object data.
    contentEncoding string
    (Computed) Content-Encoding of the object data.
    contentLanguage string
    (Computed) Content-Language of the object data.
    contentType string
    (Computed) Content-Type of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".
    crc32c string
    (Computed) Base 64 CRC32 hash of the uploaded data.
    customerEncryptions GetBucketObjectCustomerEncryption[]
    detectMd5hash string
    eventBasedHold boolean
    (Computed) 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).
    id string
    The provider-assigned unique ID for this managed resource.
    kmsKeyName string
    md5hash string
    (Computed) Base 64 MD5 hash of the uploaded data.
    mediaLink string
    (Computed) A url reference to download this object.
    metadata {[key: string]: string}
    outputName string
    retentions GetBucketObjectRetention[]
    selfLink string
    (Computed) A url reference to this object.
    source string
    storageClass string
    (Computed) 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.
    temporaryHold boolean
    (Computed) Whether an object is under temporary hold. While this flag is set to true, the object is protected against deletion and overwrites.
    bucket string
    name string
    cache_control str
    (Computed) 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
    content str
    content_disposition str
    (Computed) Content-Disposition of the object data.
    content_encoding str
    (Computed) Content-Encoding of the object data.
    content_language str
    (Computed) Content-Language of the object data.
    content_type str
    (Computed) Content-Type of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".
    crc32c str
    (Computed) Base 64 CRC32 hash of the uploaded data.
    customer_encryptions Sequence[GetBucketObjectCustomerEncryption]
    detect_md5hash str
    event_based_hold bool
    (Computed) 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).
    id str
    The provider-assigned unique ID for this managed resource.
    kms_key_name str
    md5hash str
    (Computed) Base 64 MD5 hash of the uploaded data.
    media_link str
    (Computed) A url reference to download this object.
    metadata Mapping[str, str]
    output_name str
    retentions Sequence[GetBucketObjectRetention]
    self_link str
    (Computed) A url reference to this object.
    source str
    storage_class str
    (Computed) 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.
    temporary_hold bool
    (Computed) Whether an object is under temporary hold. While this flag is set to true, the object is protected against deletion and overwrites.
    bucket str
    name str
    cacheControl String
    (Computed) 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
    content String
    contentDisposition String
    (Computed) Content-Disposition of the object data.
    contentEncoding String
    (Computed) Content-Encoding of the object data.
    contentLanguage String
    (Computed) Content-Language of the object data.
    contentType String
    (Computed) Content-Type of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".
    crc32c String
    (Computed) Base 64 CRC32 hash of the uploaded data.
    customerEncryptions List<Property Map>
    detectMd5hash String
    eventBasedHold Boolean
    (Computed) 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).
    id String
    The provider-assigned unique ID for this managed resource.
    kmsKeyName String
    md5hash String
    (Computed) Base 64 MD5 hash of the uploaded data.
    mediaLink String
    (Computed) A url reference to download this object.
    metadata Map<String>
    outputName String
    retentions List<Property Map>
    selfLink String
    (Computed) A url reference to this object.
    source String
    storageClass String
    (Computed) 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.
    temporaryHold Boolean
    (Computed) Whether an object is under temporary hold. While this flag is set to true, the object is protected against deletion and overwrites.
    bucket String
    name String

    Supporting Types

    GetBucketObjectCustomerEncryption

    EncryptionAlgorithm string
    The encryption algorithm. Default: AES256
    EncryptionKey string
    Base64 encoded customer supplied encryption key.
    EncryptionAlgorithm string
    The encryption algorithm. Default: AES256
    EncryptionKey string
    Base64 encoded customer supplied encryption key.
    encryptionAlgorithm String
    The encryption algorithm. Default: AES256
    encryptionKey String
    Base64 encoded customer supplied encryption key.
    encryptionAlgorithm string
    The encryption algorithm. Default: AES256
    encryptionKey string
    Base64 encoded customer supplied encryption key.
    encryption_algorithm str
    The encryption algorithm. Default: AES256
    encryption_key str
    Base64 encoded customer supplied encryption key.
    encryptionAlgorithm String
    The encryption algorithm. Default: AES256
    encryptionKey String
    Base64 encoded customer supplied encryption key.

    GetBucketObjectRetention

    Mode string
    The object retention mode. Supported values include: "Unlocked", "Locked".
    RetainUntilTime string
    Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
    Mode string
    The object retention mode. Supported values include: "Unlocked", "Locked".
    RetainUntilTime string
    Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
    mode String
    The object retention mode. Supported values include: "Unlocked", "Locked".
    retainUntilTime String
    Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
    mode string
    The object retention mode. Supported values include: "Unlocked", "Locked".
    retainUntilTime string
    Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
    mode str
    The object retention mode. Supported values include: "Unlocked", "Locked".
    retain_until_time str
    Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
    mode String
    The object retention mode. Supported values include: "Unlocked", "Locked".
    retainUntilTime String
    Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi