Documentation ¶
Overview ¶
Bifrost interface for Google Cloud Storage
Index ¶
- type GoogleCloudStorage
- func (g *GoogleCloudStorage) Config() *types.BridgeConfig
- func (g *GoogleCloudStorage) DeleteFile(fileFace interface{}) error
- func (g *GoogleCloudStorage) Disconnect() error
- func (g *GoogleCloudStorage) IsConnected() bool
- func (g *GoogleCloudStorage) UploadFile(fileFace interface{}) (*types.UploadedFile, error)
- func (g *GoogleCloudStorage) UploadFolder(foldFace interface{}) ([]*types.UploadedFile, error)
- func (g *GoogleCloudStorage) UploadMultiFile(multiFace interface{}) ([]*types.UploadedFile, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoogleCloudStorage ¶
type GoogleCloudStorage struct { // Provider is the name of the cloud storage service to use. Provider types.Provider // DefaultBucket is the Google Cloud Storage bucket to use for storage DefaultBucket string // CredentialsFile is the path to the Google Cloud Storage credentials file CredentialsFile string // Project is the Google Cloud Storage project to use for storage Project string // DefaultTimeout is the time-to-live for time-dependent Google Cloud Storage operations DefaultTimeout int64 // Client is the Google Cloud Storage client Client *storage.Client // EnableDebug enables debug logging. EnableDebug bool // PublicRead enables public read access to uploaded files. PublicRead bool // UseAsync enables asynchronous operations with go routines. UseAsync bool }
GoogleCloudStorage is the Google Cloud Storage struct
func (*GoogleCloudStorage) Config ¶
func (g *GoogleCloudStorage) Config() *types.BridgeConfig
Config returns the Google Cloud Storage configuration.
func (*GoogleCloudStorage) DeleteFile ¶
func (g *GoogleCloudStorage) DeleteFile(fileFace interface{}) error
DeleteFile deletes a file from Google Cloud Storage and returns an error if one occurs.
Note: DeleteFile requires that a default bucket be set in bifrost.BridgeConfig.
func (*GoogleCloudStorage) Disconnect ¶
func (g *GoogleCloudStorage) Disconnect() error
Disconnect closes the Google Cloud Storage connection and returns an error if one occurs.
Disconnect should only be called when the connection is no longer needed.
func (*GoogleCloudStorage) IsConnected ¶
func (g *GoogleCloudStorage) IsConnected() bool
IsConnected returns true if the Google Cloud Storage client is connected.
func (*GoogleCloudStorage) UploadFile ¶
func (g *GoogleCloudStorage) UploadFile(fileFace interface{}) (*types.UploadedFile, error)
UploadFile uploads a file to Google Cloud Storage and returns an error if one occurs.
Note: UploadFile requires that a default bucket be set in bifrost.BridgeConfig.
func (*GoogleCloudStorage) UploadFolder ¶
func (g *GoogleCloudStorage) UploadFolder(foldFace interface{}) ([]*types.UploadedFile, error)
UploadFolder uploads a folder to the provider storage and returns an error if one occurs.
Note: for some providers, UploadFolder requires that a default bucket be set in bifrost.BridgeConfig.
func (*GoogleCloudStorage) UploadMultiFile ¶
func (g *GoogleCloudStorage) UploadMultiFile(multiFace interface{}) ([]*types.UploadedFile, error)
UploadMultiFile uploads mutliple files to the provider storage and returns an error if one occurs. If any of the uploads fail, the error is appended to the []UploadedFile.Error and also logged when debug is enabled while the rest of the uploads continue.
Note: for some providers, UploadMultiFile requires that a default bucket be set in bifrost.BridgeConfig.