Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi
gcp.storage.getBucketObject
Explore with Pulumi AI
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/v8/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:
getBucketObject Result
The following output properties are available:
- Cache
Control 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
- Content
Disposition string - (Computed) Content-Disposition of the object data.
- Content
Encoding string - (Computed) Content-Encoding of the object data.
- Content
Language string - (Computed) Content-Language of the object data.
- Content
Type 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.
- Customer
Encryptions List<GetBucket Object Customer Encryption> - Detect
Md5hash string - Event
Based boolHold - (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).
- Generation int
- (Computed) The content generation of this object. Used for object versioning and soft delete.
- Id string
- The provider-assigned unique ID for this managed resource.
- Kms
Key stringName - Md5hash string
- (Computed) Base 64 MD5 hash of the uploaded data.
- Media
Link string - (Computed) A url reference to download this object.
- Metadata Dictionary<string, string>
- Output
Name string - Retentions
List<Get
Bucket Object Retention> - Self
Link string - (Computed) A url reference to this object.
- Source string
- Storage
Class 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. - 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 string
- Name string
- Cache
Control 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
- Content
Disposition string - (Computed) Content-Disposition of the object data.
- Content
Encoding string - (Computed) Content-Encoding of the object data.
- Content
Language string - (Computed) Content-Language of the object data.
- Content
Type 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.
- Customer
Encryptions []GetBucket Object Customer Encryption - Detect
Md5hash string - Event
Based boolHold - (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).
- Generation int
- (Computed) The content generation of this object. Used for object versioning and soft delete.
- Id string
- The provider-assigned unique ID for this managed resource.
- Kms
Key stringName - Md5hash string
- (Computed) Base 64 MD5 hash of the uploaded data.
- Media
Link string - (Computed) A url reference to download this object.
- Metadata map[string]string
- Output
Name string - Retentions
[]Get
Bucket Object Retention - Self
Link string - (Computed) A url reference to this object.
- Source string
- Storage
Class 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. - 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 string
- Name string
- cache
Control 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
- content
Disposition String - (Computed) Content-Disposition of the object data.
- content
Encoding String - (Computed) Content-Encoding of the object data.
- content
Language String - (Computed) Content-Language of the object data.
- content
Type 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.
- customer
Encryptions List<GetBucket Object Customer Encryption> - detect
Md5hash String - event
Based BooleanHold - (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).
- generation Integer
- (Computed) The content generation of this object. Used for object versioning and soft delete.
- id String
- The provider-assigned unique ID for this managed resource.
- kms
Key StringName - md5hash String
- (Computed) Base 64 MD5 hash of the uploaded data.
- media
Link String - (Computed) A url reference to download this object.
- metadata Map<String,String>
- output
Name String - retentions
List<Get
Bucket Object Retention> - self
Link String - (Computed) A url reference to this object.
- source String
- storage
Class 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. - temporary
Hold 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 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
- content
Disposition string - (Computed) Content-Disposition of the object data.
- content
Encoding string - (Computed) Content-Encoding of the object data.
- content
Language string - (Computed) Content-Language of the object data.
- content
Type 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.
- customer
Encryptions GetBucket Object Customer Encryption[] - detect
Md5hash string - event
Based booleanHold - (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).
- generation number
- (Computed) The content generation of this object. Used for object versioning and soft delete.
- id string
- The provider-assigned unique ID for this managed resource.
- kms
Key stringName - md5hash string
- (Computed) Base 64 MD5 hash of the uploaded data.
- media
Link string - (Computed) A url reference to download this object.
- metadata {[key: string]: string}
- output
Name string - retentions
Get
Bucket Object Retention[] - self
Link string - (Computed) A url reference to this object.
- source string
- storage
Class 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. - temporary
Hold 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[GetBucket Object Customer Encryption] - detect_
md5hash str - event_
based_ boolhold - (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).
- generation int
- (Computed) The content generation of this object. Used for object versioning and soft delete.
- id str
- The provider-assigned unique ID for this managed resource.
- kms_
key_ strname - 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[Get
Bucket Object Retention] - 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
- cache
Control 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
- content
Disposition String - (Computed) Content-Disposition of the object data.
- content
Encoding String - (Computed) Content-Encoding of the object data.
- content
Language String - (Computed) Content-Language of the object data.
- content
Type 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.
- customer
Encryptions List<Property Map> - detect
Md5hash String - event
Based BooleanHold - (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).
- generation Number
- (Computed) The content generation of this object. Used for object versioning and soft delete.
- id String
- The provider-assigned unique ID for this managed resource.
- kms
Key StringName - md5hash String
- (Computed) Base 64 MD5 hash of the uploaded data.
- media
Link String - (Computed) A url reference to download this object.
- metadata Map<String>
- output
Name String - retentions List<Property Map>
- self
Link String - (Computed) A url reference to this object.
- source String
- storage
Class 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. - temporary
Hold 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
- Encryption
Algorithm string - The encryption algorithm. Default: AES256
- Encryption
Key string - Base64 encoded customer supplied encryption key.
- Encryption
Algorithm string - The encryption algorithm. Default: AES256
- Encryption
Key string - Base64 encoded customer supplied encryption key.
- encryption
Algorithm String - The encryption algorithm. Default: AES256
- encryption
Key String - Base64 encoded customer supplied encryption key.
- encryption
Algorithm string - The encryption algorithm. Default: AES256
- encryption
Key string - Base64 encoded customer supplied encryption key.
- encryption_
algorithm str - The encryption algorithm. Default: AES256
- encryption_
key str - Base64 encoded customer supplied encryption key.
- encryption
Algorithm String - The encryption algorithm. Default: AES256
- encryption
Key String - Base64 encoded customer supplied encryption key.
GetBucketObjectRetention
- Mode string
- The object retention mode. Supported values include: "Unlocked", "Locked".
- Retain
Until stringTime - 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".
- Retain
Until stringTime - 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".
- retain
Until StringTime - 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".
- retain
Until stringTime - 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_ strtime - 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".
- retain
Until StringTime - 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.