google

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidServiceAccount = errors.New("invalid service account")

Functions

This section is empty.

Types

type Config

type Config struct {
	ServiceAccountFile string
}

type ServiceAccount

type ServiceAccount struct {
	Type                    string `json:"type"`
	ProjectID               string `json:"project_id"`
	PrivateKeyID            string `json:"private_key_id"`
	PrivateKey              string `json:"private_key"`
	ClientEmail             string `json:"client_email"`
	ClientID                string `json:"client_id"`
	AuthURI                 string `json:"auth_uri"`
	TokenURI                string `json:"token_uri"`
	AuthProviderX509CertURL string `json:"auth_provider_x509_cert_url"`
	ClientX509CertURL       string `json:"client_x509_cert_url"`
}

type StorageClient

type StorageClient struct {
	*storage.Client
	// contains filtered or unexported fields
}

func NewStore

func NewStore(ctx context.Context, cfg Config) (StorageClient, error)

func (StorageClient) CreateBucket

func (s StorageClient) CreateBucket(ctx context.Context, bucketName string) error

func (StorageClient) ExistsObject

func (s StorageClient) ExistsObject(ctx context.Context, bucket, fileName string) (bool, error)

func (StorageClient) ListBuckets

func (s StorageClient) ListBuckets(ctx context.Context) ([]string, error)

func (StorageClient) ListOjbect

func (s StorageClient) ListOjbect(ctx context.Context, bucketName, path string) ([]string, error)

func (StorageClient) ReadObject

func (s StorageClient) ReadObject(ctx context.Context, bucketName, fileName string) ([]byte, error)

func (StorageClient) WriteToObject

func (s StorageClient) WriteToObject(ctx context.Context, bucketName, fileName string, data []byte) error

Jump to

Keyboard shortcuts

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