gcp.storage.getBucket
Explore with Pulumi AI
Gets an existing bucket in Google Cloud Storage service (GCS). See the official documentation and API.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var my_bucket = Gcp.Storage.GetBucket.Invoke(new()
{
Name = "my-bucket",
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := storage.LookupBucket(ctx, &storage.LookupBucketArgs{
Name: "my-bucket",
}, nil)
if err != nil {
return err
}
return nil
})
}
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.GetBucketArgs;
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 my-bucket = StorageFunctions.getBucket(GetBucketArgs.builder()
.name("my-bucket")
.build());
}
}
import pulumi
import pulumi_gcp as gcp
my_bucket = gcp.storage.get_bucket(name="my-bucket")
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const my-bucket = gcp.storage.getBucket({
name: "my-bucket",
});
variables:
my-bucket:
fn::invoke:
Function: gcp:storage:getBucket
Arguments:
name: my-bucket
Using getBucket
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 getBucket(args: GetBucketArgs, opts?: InvokeOptions): Promise<GetBucketResult>
function getBucketOutput(args: GetBucketOutputArgs, opts?: InvokeOptions): Output<GetBucketResult>
def get_bucket(name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetBucketResult
def get_bucket_output(name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetBucketResult]
func LookupBucket(ctx *Context, args *LookupBucketArgs, opts ...InvokeOption) (*LookupBucketResult, error)
func LookupBucketOutput(ctx *Context, args *LookupBucketOutputArgs, opts ...InvokeOption) LookupBucketResultOutput
> Note: This function is named LookupBucket
in the Go SDK.
public static class GetBucket
{
public static Task<GetBucketResult> InvokeAsync(GetBucketArgs args, InvokeOptions? opts = null)
public static Output<GetBucketResult> Invoke(GetBucketInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetBucketResult> getBucket(GetBucketArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: gcp:storage/getBucket:getBucket
arguments:
# arguments dictionary
The following arguments are supported:
- Name string
The name of the bucket.
- Name string
The name of the bucket.
- name String
The name of the bucket.
- name string
The name of the bucket.
- name str
The name of the bucket.
- name String
The name of the bucket.
getBucket Result
The following output properties are available:
- Autoclasses
List<Get
Bucket Autoclass> - Cors
List<Get
Bucket Cor> - Custom
Placement List<GetConfigs Bucket Custom Placement Config> - Default
Event boolBased Hold - Encryptions
List<Get
Bucket Encryption> - Force
Destroy bool - Id string
The provider-assigned unique ID for this managed resource.
- Labels Dictionary<string, string>
- Lifecycle
Rules List<GetBucket Lifecycle Rule> - Location string
- Loggings
List<Get
Bucket Logging> - Name string
- Project string
- Public
Access stringPrevention - Requester
Pays bool - Retention
Policies List<GetBucket Retention Policy> - Self
Link string - Storage
Class string - Uniform
Bucket boolLevel Access - Url string
- Versionings
List<Get
Bucket Versioning> - Websites
List<Get
Bucket Website>
- Autoclasses
[]Get
Bucket Autoclass - Cors
[]Get
Bucket Cor - Custom
Placement []GetConfigs Bucket Custom Placement Config - Default
Event boolBased Hold - Encryptions
[]Get
Bucket Encryption - Force
Destroy bool - Id string
The provider-assigned unique ID for this managed resource.
- Labels map[string]string
- Lifecycle
Rules []GetBucket Lifecycle Rule - Location string
- Loggings
[]Get
Bucket Logging - Name string
- Project string
- Public
Access stringPrevention - Requester
Pays bool - Retention
Policies []GetBucket Retention Policy - Self
Link string - Storage
Class string - Uniform
Bucket boolLevel Access - Url string
- Versionings
[]Get
Bucket Versioning - Websites
[]Get
Bucket Website
- autoclasses
List<Get
Bucket Autoclass> - cors
List<Get
Bucket Cor> - custom
Placement List<GetConfigs Bucket Custom Placement Config> - default
Event BooleanBased Hold - encryptions
List<Get
Bucket Encryption> - force
Destroy Boolean - id String
The provider-assigned unique ID for this managed resource.
- labels Map<String,String>
- lifecycle
Rules List<GetBucket Lifecycle Rule> - location String
- loggings
List<Get
Bucket Logging> - name String
- project String
- public
Access StringPrevention - requester
Pays Boolean - retention
Policies List<GetBucket Retention Policy> - self
Link String - storage
Class String - uniform
Bucket BooleanLevel Access - url String
- versionings
List<Get
Bucket Versioning> - websites
List<Get
Bucket Website>
- autoclasses
Get
Bucket Autoclass[] - cors
Get
Bucket Cor[] - custom
Placement GetConfigs Bucket Custom Placement Config[] - default
Event booleanBased Hold - encryptions
Get
Bucket Encryption[] - force
Destroy boolean - id string
The provider-assigned unique ID for this managed resource.
- labels {[key: string]: string}
- lifecycle
Rules GetBucket Lifecycle Rule[] - location string
- loggings
Get
Bucket Logging[] - name string
- project string
- public
Access stringPrevention - requester
Pays boolean - retention
Policies GetBucket Retention Policy[] - self
Link string - storage
Class string - uniform
Bucket booleanLevel Access - url string
- versionings
Get
Bucket Versioning[] - websites
Get
Bucket Website[]
- autoclasses
Sequence[Get
Bucket Autoclass] - cors
Sequence[Get
Bucket Cor] - custom_
placement_ Sequence[Getconfigs Bucket Custom Placement Config] - default_
event_ boolbased_ hold - encryptions
Sequence[Get
Bucket Encryption] - force_
destroy bool - id str
The provider-assigned unique ID for this managed resource.
- labels Mapping[str, str]
- lifecycle_
rules Sequence[GetBucket Lifecycle Rule] - location str
- loggings
Sequence[Get
Bucket Logging] - name str
- project str
- public_
access_ strprevention - requester_
pays bool - retention_
policies Sequence[GetBucket Retention Policy] - self_
link str - storage_
class str - uniform_
bucket_ boollevel_ access - url str
- versionings
Sequence[Get
Bucket Versioning] - websites
Sequence[Get
Bucket Website]
- autoclasses List<Property Map>
- cors List<Property Map>
- custom
Placement List<Property Map>Configs - default
Event BooleanBased Hold - encryptions List<Property Map>
- force
Destroy Boolean - id String
The provider-assigned unique ID for this managed resource.
- labels Map<String>
- lifecycle
Rules List<Property Map> - location String
- loggings List<Property Map>
- name String
- project String
- public
Access StringPrevention - requester
Pays Boolean - retention
Policies List<Property Map> - self
Link String - storage
Class String - uniform
Bucket BooleanLevel Access - url String
- versionings List<Property Map>
- websites List<Property Map>
Supporting Types
GetBucketAutoclass
- Enabled bool
- Enabled bool
- enabled Boolean
- enabled boolean
- enabled bool
- enabled Boolean
GetBucketCor
- Max
Age intSeconds - Methods List<string>
- Origins List<string>
- Response
Headers List<string>
- Max
Age intSeconds - Methods []string
- Origins []string
- Response
Headers []string
- max
Age IntegerSeconds - methods List<String>
- origins List<String>
- response
Headers List<String>
- max
Age numberSeconds - methods string[]
- origins string[]
- response
Headers string[]
- max_
age_ intseconds - methods Sequence[str]
- origins Sequence[str]
- response_
headers Sequence[str]
- max
Age NumberSeconds - methods List<String>
- origins List<String>
- response
Headers List<String>
GetBucketCustomPlacementConfig
- Data
Locations List<string>
- Data
Locations []string
- data
Locations List<String>
- data
Locations string[]
- data_
locations Sequence[str]
- data
Locations List<String>
GetBucketEncryption
- Default
Kms stringKey Name
- Default
Kms stringKey Name
- default
Kms StringKey Name
- default
Kms stringKey Name
- default
Kms StringKey Name
GetBucketLifecycleRule
GetBucketLifecycleRuleAction
- Storage
Class string - Type string
- Storage
Class string - Type string
- storage
Class String - type String
- storage
Class string - type string
- storage_
class str - type str
- storage
Class String - type String
GetBucketLifecycleRuleCondition
- Age int
- Created
Before string - Custom
Time stringBefore - Days
Since intCustom Time - Days
Since intNoncurrent Time - Matches
Prefixes List<string> - Matches
Storage List<string>Classes - Matches
Suffixes List<string> - Noncurrent
Time stringBefore - Num
Newer intVersions - With
State string
- Age int
- Created
Before string - Custom
Time stringBefore - Days
Since intCustom Time - Days
Since intNoncurrent Time - Matches
Prefixes []string - Matches
Storage []stringClasses - Matches
Suffixes []string - Noncurrent
Time stringBefore - Num
Newer intVersions - With
State string
- age Integer
- created
Before String - custom
Time StringBefore - days
Since IntegerCustom Time - days
Since IntegerNoncurrent Time - matches
Prefixes List<String> - matches
Storage List<String>Classes - matches
Suffixes List<String> - noncurrent
Time StringBefore - num
Newer IntegerVersions - with
State String
- age number
- created
Before string - custom
Time stringBefore - days
Since numberCustom Time - days
Since numberNoncurrent Time - matches
Prefixes string[] - matches
Storage string[]Classes - matches
Suffixes string[] - noncurrent
Time stringBefore - num
Newer numberVersions - with
State string
- age int
- created_
before str - custom_
time_ strbefore - days_
since_ intcustom_ time - days_
since_ intnoncurrent_ time - matches_
prefixes Sequence[str] - matches_
storage_ Sequence[str]classes - matches_
suffixes Sequence[str] - noncurrent_
time_ strbefore - num_
newer_ intversions - with_
state str
- age Number
- created
Before String - custom
Time StringBefore - days
Since NumberCustom Time - days
Since NumberNoncurrent Time - matches
Prefixes List<String> - matches
Storage List<String>Classes - matches
Suffixes List<String> - noncurrent
Time StringBefore - num
Newer NumberVersions - with
State String
GetBucketLogging
- Log
Bucket string - Log
Object stringPrefix
- Log
Bucket string - Log
Object stringPrefix
- log
Bucket String - log
Object StringPrefix
- log
Bucket string - log
Object stringPrefix
- log_
bucket str - log_
object_ strprefix
- log
Bucket String - log
Object StringPrefix
GetBucketRetentionPolicy
- Is
Locked bool - Retention
Period int
- Is
Locked bool - Retention
Period int
- is
Locked Boolean - retention
Period Integer
- is
Locked boolean - retention
Period number
- is_
locked bool - retention_
period int
- is
Locked Boolean - retention
Period Number
GetBucketVersioning
- Enabled bool
- Enabled bool
- enabled Boolean
- enabled boolean
- enabled bool
- enabled Boolean
GetBucketWebsite
- Main
Page stringSuffix - Not
Found stringPage
- Main
Page stringSuffix - Not
Found stringPage
- main
Page StringSuffix - not
Found StringPage
- main
Page stringSuffix - not
Found stringPage
- main_
page_ strsuffix - not_
found_ strpage
- main
Page StringSuffix - not
Found StringPage
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.