storage

package
v0.0.0-...-cb19c07 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StorageSignedURLService

type StorageSignedURLService struct {
	ServiceAccountName   string
	ServiceAccountID     string
	IAMService           *iam.Service
	IAMCredentialsClient *credentials.IamCredentialsClient
}

StorageSignedURLService is Storage Signed URL Util Service

func NewStorageSignedURLService

func NewStorageSignedURLService(ctx context.Context, serviceAccountName string, serviceAccountID string, iamService *iam.Service, iamCredentialsClient *credentials.IamCredentialsClient) (*StorageSignedURLService, error)

NewStorageSignedURLService is StorageServiceを生成する

利用するServiceAccountの roles/iam.serviceAccountTokenCreator https://cloud.google.com/iam/docs/service-accounts?hl=en#the_service_account_token_creator_role を持っている必要がある serviceAccountName is SignedURLを発行するServiceAccountの @ より前の値。ex. hoge@projectid.iam.gserviceaccount.com の場合は "hoge" serviceAccountID is serviceAccountNameに指定したものと同じServiceAccountのID。format "projects/%s/serviceAccounts/%s"。 iamService is iamService

func (*StorageSignedURLService) CreateDownloadURL

func (s *StorageSignedURLService) CreateDownloadURL(ctx context.Context, bucket string, object string, queryParameters url.Values, expires time.Time) (string, error)

func (*StorageSignedURLService) CreatePutObjectURL

func (s *StorageSignedURLService) CreatePutObjectURL(ctx context.Context, bucket string, object string, contentType string, contentLength int64, expires time.Time) (string, error)

CreateSignedURLForPutObject is ObjectをPutするSignedURLを発行する

https://cloud.google.com/blog/ja/products/gcp/uploading-images-directly-to-cloud-storage-by-using-signed-url を参考に作られている

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL