Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DryRunImpl ¶
type DryRunImpl struct{}
DryRunImpl implements the GCSUploader and ImageDownloader interfaces (but doesn't actually upload or download anything)
func (*DryRunImpl) UploadBytes ¶
UploadBytes implements the GCSUploader interface.
func (*DryRunImpl) UploadJSON ¶
func (h *DryRunImpl) UploadJSON(_ context.Context, _ interface{}, tempFileName, gcsObjectPath string) error
UploadJSON implements the GCSUploader interface.
type GCSUploader ¶
type GCSUploader interface { // UploadBytes copies a local file to GCS. If data is provided, those // bytes may be used instead of read again from disk. // The dst string is assumed to have a gs:// prefix. // Currently only uploading from a local file to GCS is supported, that is // one cannot use gs://foo/bar as 'fileName' UploadBytes(ctx context.Context, data []byte, fallbackSrc, dst string) error // UploadJSON serializes the given data to JSON and uploads the result to GCS. // An implementation can use tempFileName for temporary storage of JSON data. UploadJSON(ctx context.Context, data interface{}, tempFileName, gcsObjectPath string) error }
GCSUploader implementations provide functions to upload to GCS.
type GsutilImpl ¶
type GsutilImpl struct{}
GsutilImpl implements the GCSUploader and ImageDownloader interfaces.
func (*GsutilImpl) UploadBytes ¶
UploadBytes shells out to gsutil to copy the given src to the given target. A path starting with "gs://" is assumed to be in GCS.
func (*GsutilImpl) UploadJSON ¶
func (g *GsutilImpl) UploadJSON(ctx context.Context, data interface{}, tempFileName, gcsObjPath string) error
UploadJSON serializes the given data to JSON and writes the result to the given tempFileName, then it copies the file to the given path in GCS. gcsObjPath is assumed to have the form: <bucket_name>/path/to/object