Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.24.0 published on Tuesday, May 17, 2022 by Pulumi

getBucketObjectContent

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

Warning: The object content will be saved in the state, and visiable to everyone who has access to the state file.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var key = Output.Create(Gcp.Storage.GetBucketObjectContent.InvokeAsync(new Gcp.Storage.GetBucketObjectContentArgs
        {
            Name = "encryptedkey",
            Bucket = "keystore",
        }));
        this.Encrypted = key.Apply(key => key.Content);
    }

    [Output("encrypted")]
    public Output<string> Encrypted { get; set; }
}
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 {
		key, err := storage.GetBucketObjectContent(ctx, &storage.GetBucketObjectContentArgs{
			Name:   "encryptedkey",
			Bucket: "keystore",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("encrypted", key.Content)
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var key = Output.of(StorageFunctions.getBucketObjectContent(GetBucketObjectContentArgs.builder()
            .name("encryptedkey")
            .bucket("keystore")
            .build()));

        ctx.export("encrypted", key.apply(getBucketObjectContentResult -> getBucketObjectContentResult.getContent()));
        }
}
import pulumi
import pulumi_gcp as gcp

key = gcp.storage.get_bucket_object_content(name="encryptedkey",
    bucket="keystore")
pulumi.export("encrypted", key.content)
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const key = gcp.storage.getBucketObjectContent({
    name: "encryptedkey",
    bucket: "keystore",
});
export const encrypted = key.then(key => key.content);
variables:
  key:
    Fn::Invoke:
      Function: gcp:storage:getBucketObjectContent
      Arguments:
        name: encryptedkey
        bucket: keystore
outputs:
  encrypted: ${key.content}

Using getBucketObjectContent

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 getBucketObjectContent(args: GetBucketObjectContentArgs, opts?: InvokeOptions): Promise<GetBucketObjectContentResult>
function getBucketObjectContentOutput(args: GetBucketObjectContentOutputArgs, opts?: InvokeOptions): Output<GetBucketObjectContentResult>
def get_bucket_object_content(bucket: Optional[str] = None,
                              content: Optional[str] = None,
                              name: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetBucketObjectContentResult
def get_bucket_object_content_output(bucket: Optional[pulumi.Input[str]] = None,
                              content: Optional[pulumi.Input[str]] = None,
                              name: Optional[pulumi.Input[str]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetBucketObjectContentResult]
func GetBucketObjectContent(ctx *Context, args *GetBucketObjectContentArgs, opts ...InvokeOption) (*GetBucketObjectContentResult, error)
func GetBucketObjectContentOutput(ctx *Context, args *GetBucketObjectContentOutputArgs, opts ...InvokeOption) GetBucketObjectContentResultOutput

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

public static class GetBucketObjectContent 
{
    public static Task<GetBucketObjectContentResult> InvokeAsync(GetBucketObjectContentArgs args, InvokeOptions? opts = null)
    public static Output<GetBucketObjectContentResult> Invoke(GetBucketObjectContentInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetBucketObjectContentResult> getBucketObjectContent(GetBucketObjectContentArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:storage/getBucketObjectContent:getBucketObjectContent
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Bucket string

The name of the containing bucket.

Name string

The name of the object.

Content string

(Computed) Content-Language of the object content.

Bucket string

The name of the containing bucket.

Name string

The name of the object.

Content string

(Computed) Content-Language of the object content.

bucket String

The name of the containing bucket.

name String

The name of the object.

content String

(Computed) Content-Language of the object content.

bucket string

The name of the containing bucket.

name string

The name of the object.

content string

(Computed) Content-Language of the object content.

bucket str

The name of the containing bucket.

name str

The name of the object.

content str

(Computed) Content-Language of the object content.

bucket String

The name of the containing bucket.

name String

The name of the object.

content String

(Computed) Content-Language of the object content.

getBucketObjectContent Result

The following output properties are available:

Bucket string
CacheControl string
ContentDisposition string
ContentEncoding string
ContentLanguage string
ContentType string
Crc32c string
CustomerEncryptions List<GetBucketObjectContentCustomerEncryption>
DetectMd5hash string
EventBasedHold bool
Id string

The provider-assigned unique ID for this managed resource.

KmsKeyName string
Md5hash string
MediaLink string
Metadata Dictionary<string, string>
Name string
OutputName string
SelfLink string
Source string
StorageClass string
TemporaryHold bool
Content string

(Computed) Content-Language of the object content.

Bucket string
CacheControl string
ContentDisposition string
ContentEncoding string
ContentLanguage string
ContentType string
Crc32c string
CustomerEncryptions []GetBucketObjectContentCustomerEncryption
DetectMd5hash string
EventBasedHold bool
Id string

The provider-assigned unique ID for this managed resource.

KmsKeyName string
Md5hash string
MediaLink string
Metadata map[string]string
Name string
OutputName string
SelfLink string
Source string
StorageClass string
TemporaryHold bool
Content string

(Computed) Content-Language of the object content.

bucket String
cacheControl String
contentDisposition String
contentEncoding String
contentLanguage String
contentType String
crc32c String
customerEncryptions ListBucketObjectContentCustomerEncryption>
detectMd5hash String
eventBasedHold Boolean
id String

The provider-assigned unique ID for this managed resource.

kmsKeyName String
md5hash String
mediaLink String
metadata Map
name String
outputName String
selfLink String
source String
storageClass String
temporaryHold Boolean
content String

(Computed) Content-Language of the object content.

bucket string
cacheControl string
contentDisposition string
contentEncoding string
contentLanguage string
contentType string
crc32c string
customerEncryptions GetBucketObjectContentCustomerEncryption[]
detectMd5hash string
eventBasedHold boolean
id string

The provider-assigned unique ID for this managed resource.

kmsKeyName string
md5hash string
mediaLink string
metadata {[key: string]: string}
name string
outputName string
selfLink string
source string
storageClass string
temporaryHold boolean
content string

(Computed) Content-Language of the object content.

bucket String
cacheControl String
contentDisposition String
contentEncoding String
contentLanguage String
contentType String
crc32c String
customerEncryptions List
detectMd5hash String
eventBasedHold Boolean
id String

The provider-assigned unique ID for this managed resource.

kmsKeyName String
md5hash String
mediaLink String
metadata Map
name String
outputName String
selfLink String
source String
storageClass String
temporaryHold Boolean
content String

(Computed) Content-Language of the object content.

Supporting Types

GetBucketObjectContentCustomerEncryption

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.