Documentation ¶
Overview ¶
Copyright 2021 The ChromiumOS Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBucketNotExist = errors.New("bucket does not exist")
View Source
var ErrObjectNotExist = errors.New("object does not exist")
Functions ¶
This section is empty.
Types ¶
type GSClient ¶
type GSClient struct {
// contains filtered or unexported fields
}
func NewGSTestClient ¶
func NewGSTestClient(client StorageClientInterface) *GSClient
func (*GSClient) DownloadFile ¶
DownloadFile downloads a file from a designated gsURL to a given path on the local file system. If the bucket does not exist, returns ErrBucketNotExist. If the object does not exist, returns ErrObjectNotExist.
type GSClientInterface ¶
type GSClientInterface interface { Upload(ctx context.Context, localFolder string, gsUrl string) error Close() }
For testing
type LocalObject ¶
Storage metadata for local file
type StorageClient ¶
type StorageClient struct {
// contains filtered or unexported fields
}
func NewStorageClientWithCredsFile ¶
func NewStorageClientWithCredsFile(ctx context.Context, credentialsFile string) (*StorageClient, error)
func NewStorageClientWithDefaultAccount ¶
func NewStorageClientWithDefaultAccount(ctx context.Context) (*StorageClient, error)
func (*StorageClient) Close ¶
func (c *StorageClient) Close()
func (*StorageClient) Read ¶
func (c *StorageClient) Read(ctx context.Context, gsObject GSObject, destFilePath string) (retErr error)
Read downloads a file from GCS to the given local path. If the bucket does not exist in GCS, the method returns ErrBucketNotExist. If the object does not exist in GCS, the method returns ErrObjectNotExist.
Click to show internal directories.
Click to hide internal directories.