Categorygithub.com/boomauakim/gcs-signed-url-go
repository
0.0.0-20240924162045-9f052c3d07c7
Repository: https://github.com/boomauakim/gcs-signed-url-go.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

gcs-signed-url-go

This repository was created as a proof of concept for generating signed URLs for Google Cloud Storage (GCS).

Usage

  1. Install gcloud and follow these steps to Authenticate by using service account impersonation.
  2. Create a new file env file from the .env.example template and add your bucket name in the .env file.
  3. Start the application.
make run

API Endpoints

  1. Generate Signed URL for Retrieving an Object
TitleDescription
URL/gcs
MethodPOST
Request Body
{
"bucket": "your-bucket-name",
"object": "your-object-name"
}
Response Body
{
"url": "https://storage.googleapis.com/your-bucket-name/your-object-name?..."
}
  1. Generate a Signed URL for Uploading an Object
TitleDescription
URL/gcs/uploads
MethodGET
Response Body
{
"path": "temp/random-object-name",
"url": "https://storage.googleapis.com/your-bucket-name/temp/random-object-name?..."
}