gcs

package
v0.0.0-...-7a27e4f Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package gcs allows users to run the gsutil command to upload data to Google Cloud storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGCS

func IsGCS(filePath string) bool

IsGCS returns true iff 'filePath' indicates a path on GCS.

Types

type GCS

type GCS struct {
	// contains filtered or unexported fields
}

GCS handles uploading fragments to GCS.

func New

func New(gsutilPath string) (*GCS, error)

Init initializes 'gcs' with the given path 'gsutilPath' to the "gsutil" program on the client's machine. It returns an error if it cannot find the gsutil command.

func (*GCS) ListTree

func (gcs *GCS) ListTree(root string, dirList []string) ([]string, error)

ListTree returns all the subdirectories specified in `dirList` that exist as top-level subdirectories under `root`. If none of these exist or if `root` does not exist, it returns an empty list.

func (*GCS) TransferTree

func (gcs *GCS) TransferTree(src, dst string, publiclyReadable bool) (string, error)

TransferTree initiates a gsutil recursive upload of the contents of the directory tree rooted at the 'src' path to the tree rooted at the 'dst' path, and returns the output of the command. One or both of these paths can begin with the "gs://" prefix to specify a GCS location. Transfers to GCS are marked with content-type "application/json", and are made world-readable iff 'publiclyReadable' is set. Failures cause an error (with the command output embedded) to be returned.

func (*GCS) TransferTreePaths

func (gcs *GCS) TransferTreePaths(src, dst string, publiclyReadable bool, trees []string) (string, error)

TransferTreePaths transfers all the paths in `trees` rooted at `src` to the same paths rooted at `dst`.

Jump to

Keyboard shortcuts

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