1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. storage
  5. getBucketObjects
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

gcp.storage.getBucketObjects

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

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

    Example Usage

    Example files stored within a bucket.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const files = gcp.storage.getBucketObjects({
        bucket: "file-store",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    files = gcp.storage.get_bucket_objects(bucket="file-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.GetBucketObjects(ctx, &storage.GetBucketObjectsArgs{
    			Bucket: "file-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 files = Gcp.Storage.GetBucketObjects.Invoke(new()
        {
            Bucket = "file-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.GetBucketObjectsArgs;
    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 files = StorageFunctions.getBucketObjects(GetBucketObjectsArgs.builder()
                .bucket("file-store")
                .build());
    
        }
    }
    
    variables:
      files:
        fn::invoke:
          Function: gcp:storage:getBucketObjects
          Arguments:
            bucket: file-store
    

    Using getBucketObjects

    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 getBucketObjects(args: GetBucketObjectsArgs, opts?: InvokeOptions): Promise<GetBucketObjectsResult>
    function getBucketObjectsOutput(args: GetBucketObjectsOutputArgs, opts?: InvokeOptions): Output<GetBucketObjectsResult>
    def get_bucket_objects(bucket: Optional[str] = None,
                           match_glob: Optional[str] = None,
                           prefix: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetBucketObjectsResult
    def get_bucket_objects_output(bucket: Optional[pulumi.Input[str]] = None,
                           match_glob: Optional[pulumi.Input[str]] = None,
                           prefix: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetBucketObjectsResult]
    func GetBucketObjects(ctx *Context, args *GetBucketObjectsArgs, opts ...InvokeOption) (*GetBucketObjectsResult, error)
    func GetBucketObjectsOutput(ctx *Context, args *GetBucketObjectsOutputArgs, opts ...InvokeOption) GetBucketObjectsResultOutput

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

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

    The following arguments are supported:

    Bucket string
    The name of the containing bucket.
    MatchGlob string
    A glob pattern used to filter results (for example, foo*bar).
    Prefix string
    Filter results to include only objects whose names begin with this prefix.
    Bucket string
    The name of the containing bucket.
    MatchGlob string
    A glob pattern used to filter results (for example, foo*bar).
    Prefix string
    Filter results to include only objects whose names begin with this prefix.
    bucket String
    The name of the containing bucket.
    matchGlob String
    A glob pattern used to filter results (for example, foo*bar).
    prefix String
    Filter results to include only objects whose names begin with this prefix.
    bucket string
    The name of the containing bucket.
    matchGlob string
    A glob pattern used to filter results (for example, foo*bar).
    prefix string
    Filter results to include only objects whose names begin with this prefix.
    bucket str
    The name of the containing bucket.
    match_glob str
    A glob pattern used to filter results (for example, foo*bar).
    prefix str
    Filter results to include only objects whose names begin with this prefix.
    bucket String
    The name of the containing bucket.
    matchGlob String
    A glob pattern used to filter results (for example, foo*bar).
    prefix String
    Filter results to include only objects whose names begin with this prefix.

    getBucketObjects Result

    The following output properties are available:

    Bucket string
    BucketObjects List<GetBucketObjectsBucketObject>
    A list of retrieved objects contained in the provided GCS bucket. Structure is defined below.
    Id string
    The provider-assigned unique ID for this managed resource.
    MatchGlob string
    Prefix string
    Bucket string
    BucketObjects []GetBucketObjectsBucketObject
    A list of retrieved objects contained in the provided GCS bucket. Structure is defined below.
    Id string
    The provider-assigned unique ID for this managed resource.
    MatchGlob string
    Prefix string
    bucket String
    bucketObjects List<GetBucketObjectsBucketObject>
    A list of retrieved objects contained in the provided GCS bucket. Structure is defined below.
    id String
    The provider-assigned unique ID for this managed resource.
    matchGlob String
    prefix String
    bucket string
    bucketObjects GetBucketObjectsBucketObject[]
    A list of retrieved objects contained in the provided GCS bucket. Structure is defined below.
    id string
    The provider-assigned unique ID for this managed resource.
    matchGlob string
    prefix string
    bucket str
    bucket_objects Sequence[GetBucketObjectsBucketObject]
    A list of retrieved objects contained in the provided GCS bucket. Structure is defined below.
    id str
    The provider-assigned unique ID for this managed resource.
    match_glob str
    prefix str
    bucket String
    bucketObjects List<Property Map>
    A list of retrieved objects contained in the provided GCS bucket. Structure is defined below.
    id String
    The provider-assigned unique ID for this managed resource.
    matchGlob String
    prefix String

    Supporting Types

    GetBucketObjectsBucketObject

    ContentType string
    Content-Type of the object data.
    MediaLink string
    A url reference to download this object.
    Name string
    The name of the object.
    SelfLink string
    A url reference to this object.
    StorageClass string
    The StorageClass of the bucket object.
    ContentType string
    Content-Type of the object data.
    MediaLink string
    A url reference to download this object.
    Name string
    The name of the object.
    SelfLink string
    A url reference to this object.
    StorageClass string
    The StorageClass of the bucket object.
    contentType String
    Content-Type of the object data.
    mediaLink String
    A url reference to download this object.
    name String
    The name of the object.
    selfLink String
    A url reference to this object.
    storageClass String
    The StorageClass of the bucket object.
    contentType string
    Content-Type of the object data.
    mediaLink string
    A url reference to download this object.
    name string
    The name of the object.
    selfLink string
    A url reference to this object.
    storageClass string
    The StorageClass of the bucket object.
    content_type str
    Content-Type of the object data.
    media_link str
    A url reference to download this object.
    name str
    The name of the object.
    self_link str
    A url reference to this object.
    storage_class str
    The StorageClass of the bucket object.
    contentType String
    Content-Type of the object data.
    mediaLink String
    A url reference to download this object.
    name String
    The name of the object.
    selfLink String
    A url reference to this object.
    storageClass String
    The StorageClass of the bucket 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.29.0 published on Wednesday, Jun 26, 2024 by Pulumi