gcs

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateExpireFileName added in v0.2.0

func CreateExpireFileName(expTime time.Duration) string

CreateExpireFileName creates a new name for an expire descriptor file on the Google Cloud Storage.

func Init added in v0.4.0

func Init()

Init initializes Google Coud Storage with the given bucket name in environment variable. Loads credentials from environment variable too.

func ParseURL added in v0.2.0

func ParseURL(u string) string

ParseURL parses object path from a signed URL.

func PullFileGCS

func PullFileGCS(dstFilename, u string, force bool) (ok bool)

PullFileGCS downloads a file from the Google Cloud Storage to the file system with given source path.

func PullGCS

func PullGCS(dst, src string, force bool) (ok bool)

PullGCS downloads a file or directory from the Google Cloud Storage to the file system with given destination and source path.

func PullPaths

func PullPaths(dst, src string) (string, string)

PullPaths returns source and destination paths to pull a file from Google Cloud Storage. Source path becomes a category prefixed path to the GCS Bucket, destination path becomes a relative path on the file system.

func PushGCS

func PushGCS(dst, src, expires string, force bool) (ok bool)

PushGCS uploads a file or directory from the file system to Google Cloud Storage to given destination with a human readable expire string. Returns if it was a success, otherwise the error has been logged.

func PushPaths

func PushPaths(dst, src string) (string, string)

PushPaths returns source and destination paths to push a file to Google Cloud Storage. Source path becomes a relative path on the file system, destination path becomes a category prefixed path to the GCS Bucket.

func UploadFile added in v0.2.0

func UploadFile(u, filename string) (ok bool)

UploadFile uploads a file given by its filename to the Google Cloud Storage.

func YankGCS

func YankGCS(name string) (ok bool)

YankGCS deletes a file or directory from the Google Cloud Storage.

func YankPath

func YankPath(f string) string

YankPath returns path to yank a file from Google Cloud Storage. Path becomes a category prefixed path to the GCS Bucket.

Types

type GenerateSignedURLsRequest added in v0.2.0

type GenerateSignedURLsRequest struct {
	Paths []string                      `json:"paths,omitempty"`
	Type  generateSignedURLsRequestType `json:"type,omitempty"`
}

GenerateSignedURLsRequest is the request for Push call. Contains a list of paths to upload, and if it's forced.

type GenerateSignedURLsResponse added in v0.2.0

type GenerateSignedURLsResponse struct {
	Urls  []*SignedURL `json:"urls,omitempty"`
	Error string       `json:"error,omitempty"`
}

GenerateSignedURLsResponse contain a list of Signed URLs. It can be used for multiple grcp calls.

type SignedURL added in v0.2.0

type SignedURL struct {
	URL    string `json:"url,omitempty"`
	Method string `json:"method,omitempty"`
}

SignedURL contains an url and its method type.

Jump to

Keyboard shortcuts

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