Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi
gcp.storage.getBucketObjects
Explore with Pulumi AI
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/v8/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 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.
getBucketObjects Result
The following output properties are available:
- Bucket string
- Bucket
Objects List<GetBucket Objects Bucket Object> - 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.
- Match
Glob string - Prefix string
- Bucket string
- Bucket
Objects []GetBucket Objects Bucket Object - 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.
- Match
Glob string - Prefix string
- bucket String
- bucket
Objects List<GetBucket Objects Bucket Object> - 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.
- match
Glob String - prefix String
- bucket string
- bucket
Objects GetBucket Objects Bucket Object[] - 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.
- match
Glob string - prefix string
- bucket str
- bucket_
objects Sequence[GetBucket Objects Bucket Object] - 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
- bucket
Objects 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.
- match
Glob String - prefix String
Supporting Types
GetBucketObjectsBucketObject
- Content
Type string - Content-Type of the object data.
- Media
Link string - A url reference to download this object.
- Name string
- The name of the object.
- Self
Link string - A url reference to this object.
- Storage
Class string - The StorageClass of the bucket object.
- Content
Type string - Content-Type of the object data.
- Media
Link string - A url reference to download this object.
- Name string
- The name of the object.
- Self
Link string - A url reference to this object.
- Storage
Class string - The StorageClass of the bucket object.
- content
Type String - Content-Type of the object data.
- media
Link String - A url reference to download this object.
- name String
- The name of the object.
- self
Link String - A url reference to this object.
- storage
Class String - The StorageClass of the bucket object.
- content
Type string - Content-Type of the object data.
- media
Link string - A url reference to download this object.
- name string
- The name of the object.
- self
Link string - A url reference to this object.
- storage
Class 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.
- content
Type String - Content-Type of the object data.
- media
Link String - A url reference to download this object.
- name String
- The name of the object.
- self
Link String - A url reference to this object.
- storage
Class 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.