get Bucket Object Content
suspend fun getBucketObjectContent(argument: GetBucketObjectContentPlainArgs): GetBucketObjectContentResult
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
Example file object stored within a folder.
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);
Content copied to clipboard
import pulumi
import pulumi_gcp as gcp
key = gcp.storage.get_bucket_object_content(name="encryptedkey",
bucket="keystore")
pulumi.export("encrypted", key.content)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var key = Gcp.Storage.GetBucketObjectContent.Invoke(new()
{
Name = "encryptedkey",
Bucket = "keystore",
});
return new Dictionary<string, object?>
{
["encrypted"] = key.Apply(getBucketObjectContentResult => getBucketObjectContentResult.Content),
};
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/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
})
}
Content copied to clipboard
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.GetBucketObjectContentArgs;
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 key = StorageFunctions.getBucketObjectContent(GetBucketObjectContentArgs.builder()
.name("encryptedkey")
.bucket("keystore")
.build());
ctx.export("encrypted", key.applyValue(getBucketObjectContentResult -> getBucketObjectContentResult.content()));
}
}
Content copied to clipboard
variables:
key:
fn::invoke:
Function: gcp:storage:getBucketObjectContent
Arguments:
name: encryptedkey
bucket: keystore
outputs:
encrypted: ${key.content}
Content copied to clipboard
Return
A collection of values returned by getBucketObjectContent.
Parameters
argument
A collection of arguments for invoking getBucketObjectContent.
suspend fun getBucketObjectContent(bucket: String, content: String? = null, name: String): GetBucketObjectContentResult
Return
A collection of values returned by getBucketObjectContent.
Parameters
bucket
The name of the containing bucket.
content
(Computed) Content-Language of the object content.
name
The name of the object.
See also
suspend fun getBucketObjectContent(argument: suspend GetBucketObjectContentPlainArgsBuilder.() -> Unit): GetBucketObjectContentResult
Return
A collection of values returned by getBucketObjectContent.
Parameters
argument
Builder for com.pulumi.gcp.storage.kotlin.inputs.GetBucketObjectContentPlainArgs.