gcp-bucket-access
v1.9.0
Published
A reusable library for GCP bucket access in Pulumi projects
Maintainers
Readme
GCP Bucket Access Library
This library provides a reusable solution for accessing and managing GCP buckets in Pulumi projects.
Installation
npm install gcp-bucket-accessUsage
To use this package in your Pulumi project, first install it using npm, then import the functions you need:
import { readGcpBucketData, createGcpBucket } from 'gcp-bucket-access';Reading data from a GCP bucket
import { readGcpBucketData } from 'gcp-bucket-access';
const bucketName = 'thx-pulumi-backend-dev';
const fileName = 'gs://thx-pulumi-backend-dev/.pulumi/stacks/thx-dynatrace/dev.json';
async function readData() {
try {
const data = await readGcpBucketData(bucketName, fileName);
console.log('File contents:', data);
} catch (error) {
console.error('Error reading file:', error);
}
}
readData();API Reference
readGcpBucketData(bucketName: string, fileName: string): Promise<string>
Reads the contents of a file from a GCP bucket.
bucketName: The name of the GCP bucket.fileName: The path to the file within the bucket.
Returns a Promise that resolves with the file contents as a string.
Configuration
Make sure you have the necessary GCP credentials set up in your environment. You can do this by setting the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of your service account key file, or by using other GCP authentication methods supported by the Google Cloud client libraries.
License
This project is licensed under the MIT License.
