gcs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendConfig

type BackendConfig struct {
	BackendName     string `yaml:"name"`
	CredentialsFile string `yaml:"credsfile"`
	Bucket          string `yaml:"bucketname"`
}

BackendConfig is the data structure containing all information required to connect to a Google Cloud Storage account

func (*BackendConfig) Name

func (conf *BackendConfig) Name() string

Name returns the name configured for this Google Cloud Storage Backend

func (*BackendConfig) Validate

func (conf *BackendConfig) Validate() error

Validate validates the Google Cloud Storage Backend and returns the first error that occured during validation.

type Client

type Client struct {
	Conn   *storage.Client
	Config BackendConfig
}

Client is an Google Cloud Storage Client Object

func New

func New(ctx context.Context, conf BackendConfig) *Client

New creates a new Google Cloud Storage client

func (*Client) BackendName

func (c *Client) BackendName() string

BackendName returns 'Google Cloud Storage'

func (*Client) Bucket

func (c *Client) Bucket() string

Bucket returns the Google Cloud Storage Bucket Name

func (*Client) BucketExists

func (c *Client) BucketExists(ctx context.Context, name string) (bool, error)

BucketExists returns if a particular bucket exists and is reachable by the Google Cloud Storage client

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

Connect connects the Google Cloud Storage client to the backend service and authenticates

func (*Client) Disconnect

func (c *Client) Disconnect(ctx context.Context) error

Disconnect terminates the connection of the Google Cloud Storage client with the backend server

func (*Client) Name

func (c *Client) Name() string

Name returns the Google Cloud Storage Client Name

func (*Client) ObjectExists

func (c *Client) ObjectExists(ctx context.Context, name string) (bool, error)

ObjectExists returns if a particular object exists and is reachable by the Google Cloud Storage client

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, name string, file io.Reader, filesize int64) error

UploadFile uploads a file to the Google Cloud Storage Backend, with a name of name.

Jump to

Keyboard shortcuts

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