Documentation ¶
Index ¶
- Variables
- func ValidateSecret(secret *corev1.Secret) error
- type GCSClient
- func (c *GCSClient) BucketExists(ctx context.Context, bucketName string) (bool, error)
- func (c *GCSClient) Close(ctx context.Context)
- func (c *GCSClient) FGetObject(ctx context.Context, bucketName, objectName, localPath string) (string, error)
- func (c *GCSClient) ObjectIsNotFound(err error) bool
- func (c *GCSClient) VisitObjects(ctx context.Context, bucketName string, visit func(path, etag string) error) error
Constants ¶
This section is empty.
Variables ¶
var ( // IteratorDone is returned when the looping of objects/content // has reached the end of the iteration. IteratorDone = iterator.Done // ErrorDirectoryExists is an error returned when the filename provided // is a directory. ErrorDirectoryExists = errors.New("filename is a directory") )
Functions ¶
func ValidateSecret ¶
ValidateSecret validates the credential secret. The provided Secret may be nil.
Types ¶
type GCSClient ¶ added in v0.22.0
type GCSClient struct { // client for interacting with the Google Cloud // Storage APIs. *gcpstorage.Client }
GCSClient is a minimal Google Cloud Storage client for fetching objects.
func NewClient ¶
NewClient creates a new GCP storage client. The Client will automatically look for the Google Application Credential environment variable or look for the Google Application Credential file.
func (*GCSClient) BucketExists ¶ added in v0.22.0
BucketExists returns if an object storage bucket with the provided name exists, or returns a (client) error.
func (*GCSClient) FGetObject ¶ added in v0.22.0
func (c *GCSClient) FGetObject(ctx context.Context, bucketName, objectName, localPath string) (string, error)
FGetObject gets the object from the provided object storage bucket, and writes it to targetPath. It returns the etag of the successfully fetched file, or any error.
func (*GCSClient) ObjectIsNotFound ¶ added in v0.22.0
ObjectIsNotFound checks if the error provided is storage.ErrObjectNotExist.
func (*GCSClient) VisitObjects ¶ added in v0.22.0
func (c *GCSClient) VisitObjects(ctx context.Context, bucketName string, visit func(path, etag string) error) error
VisitObjects iterates over the items in the provided object storage bucket, calling visit for every item. If the underlying client or the visit callback returns an error, it returns early.