Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi
gcp.storage.getBuckets
Explore with Pulumi AI
Gets a list of existing GCS buckets. See the official documentation and API.
Example Usage
Example GCS buckets.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = gcp.storage.getBuckets({
project: "example-project",
});
import pulumi
import pulumi_gcp as gcp
example = gcp.storage.get_buckets(project="example-project")
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.GetBuckets(ctx, &storage.GetBucketsArgs{
Project: pulumi.StringRef("example-project"),
}, 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 example = Gcp.Storage.GetBuckets.Invoke(new()
{
Project = "example-project",
});
});
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.GetBucketsArgs;
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 example = StorageFunctions.getBuckets(GetBucketsArgs.builder()
.project("example-project")
.build());
}
}
variables:
example:
fn::invoke:
Function: gcp:storage:getBuckets
Arguments:
project: example-project
Using getBuckets
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 getBuckets(args: GetBucketsArgs, opts?: InvokeOptions): Promise<GetBucketsResult>
function getBucketsOutput(args: GetBucketsOutputArgs, opts?: InvokeOptions): Output<GetBucketsResult>
def get_buckets(prefix: Optional[str] = None,
project: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetBucketsResult
def get_buckets_output(prefix: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetBucketsResult]
func GetBuckets(ctx *Context, args *GetBucketsArgs, opts ...InvokeOption) (*GetBucketsResult, error)
func GetBucketsOutput(ctx *Context, args *GetBucketsOutputArgs, opts ...InvokeOption) GetBucketsResultOutput
> Note: This function is named GetBuckets
in the Go SDK.
public static class GetBuckets
{
public static Task<GetBucketsResult> InvokeAsync(GetBucketsArgs args, InvokeOptions? opts = null)
public static Output<GetBucketsResult> Invoke(GetBucketsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetBucketsResult> getBuckets(GetBucketsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: gcp:storage/getBuckets:getBuckets
arguments:
# arguments dictionary
The following arguments are supported:
getBuckets Result
The following output properties are available:
- Buckets
List<Get
Buckets Bucket> - A list of all retrieved GCS buckets. Structure is defined below.
- Id string
- The provider-assigned unique ID for this managed resource.
- Prefix string
- Project string
- Buckets
[]Get
Buckets Bucket - A list of all retrieved GCS buckets. Structure is defined below.
- Id string
- The provider-assigned unique ID for this managed resource.
- Prefix string
- Project string
- buckets
List<Get
Buckets Bucket> - A list of all retrieved GCS buckets. Structure is defined below.
- id String
- The provider-assigned unique ID for this managed resource.
- prefix String
- project String
- buckets
Get
Buckets Bucket[] - A list of all retrieved GCS buckets. Structure is defined below.
- id string
- The provider-assigned unique ID for this managed resource.
- prefix string
- project string
- buckets
Sequence[Get
Buckets Bucket] - A list of all retrieved GCS buckets. Structure is defined below.
- id str
- The provider-assigned unique ID for this managed resource.
- prefix str
- project str
- buckets List<Property Map>
- A list of all retrieved GCS buckets. Structure is defined below.
- id String
- The provider-assigned unique ID for this managed resource.
- prefix String
- project String
Supporting Types
GetBucketsBucket
- Labels Dictionary<string, string>
- User-provided bucket labels, in key/value pairs.
- Location string
- The location of the bucket.
- Name string
- The name of the bucket.
- Self
Link string - A url reference to the bucket.
- Storage
Class string - The StorageClass of the bucket.
- Labels map[string]string
- User-provided bucket labels, in key/value pairs.
- Location string
- The location of the bucket.
- Name string
- The name of the bucket.
- Self
Link string - A url reference to the bucket.
- Storage
Class string - The StorageClass of the bucket.
- labels Map<String,String>
- User-provided bucket labels, in key/value pairs.
- location String
- The location of the bucket.
- name String
- The name of the bucket.
- self
Link String - A url reference to the bucket.
- storage
Class String - The StorageClass of the bucket.
- labels {[key: string]: string}
- User-provided bucket labels, in key/value pairs.
- location string
- The location of the bucket.
- name string
- The name of the bucket.
- self
Link string - A url reference to the bucket.
- storage
Class string - The StorageClass of the bucket.
- labels Mapping[str, str]
- User-provided bucket labels, in key/value pairs.
- location str
- The location of the bucket.
- name str
- The name of the bucket.
- self_
link str - A url reference to the bucket.
- storage_
class str - The StorageClass of the bucket.
- labels Map<String>
- User-provided bucket labels, in key/value pairs.
- location String
- The location of the bucket.
- name String
- The name of the bucket.
- self
Link String - A url reference to the bucket.
- storage
Class String - The StorageClass of the bucket.
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.