package
0.2.16
Repository: https://github.com/lytics/cloudstorage.git
Documentation: pkg.go.dev

# README

google cloud storage store

Cloudstorage abstraction package for gcs.

# the CloudStorage GCS JWT key is an env with full jwt token json encoded.
export CS_GCS_JWTKEY="{\"project_id\": \"lio-testing\", \"private_key_id\": \"

Example


// example with  CS_GCS_JWTKEY env var
conf := &cloudstorage.Config{
	Type:       google.StoreType,
	AuthMethod: google.AuthJWTKeySource,
	Project:    "my-google-project",
	Bucket:     "integration-tests-nl",
	TmpDir:     "/tmp/localcache/google",
}

// OR read from machine oauth locations
conf := &cloudstorage.Config{
	Type:       google.StoreType,
	AuthMethod: google.AuthGCEDefaultOAuthToken,
	Project:    "my-google-project",
	Bucket:     "integration-tests-nl",
	TmpDir:     "/tmp/localcache/google",
}

// OR metadata api if on google cloud
conf := &cloudstorage.Config{
	Type:       google.StoreType,
	AuthMethod: google.AuthGCEMetaKeySource,
	Project:    "my-google-project",
	Bucket:     "integration-tests-nl",
	TmpDir:     "/tmp/localcache/google",
}

// create store
store, err := cloudstorage.NewStore(conf)
if err != nil {
    return err
}


# Packages

No description provided by the author

# Functions

BuildDefaultGoogleTransporter builds a transpoter that wraps the google DefaultClient: Ref https://github.com/golang/oauth2/blob/master/google/default.go#L33 DefaultClient returns an HTTP Client that uses the DefaultTokenSource to obtain authentication credentials Ref : https://github.com/golang/oauth2/blob/master/google/default.go#L41 DefaultTokenSource is a token source that uses "Application Default Credentials".
The account may be empty or the string "default" to use the instance's main account.
BuildGoogleFileJWTTransporter creates a Google Storage Client using a JWT file for the jwt config.
BuildGoogleJWTTransporter create a GoogleOAuthClient from jwt config.
NewAPIStore create api store.
NewGCSStore Create Google Cloud Storage Store.
NewGoogleClient create new Google Storage Client.

# Constants

AuthGCEDefaultOAuthToken means use local auth where it (google client) checks variety of locations for local auth tokens.
AuthGCEMetaKeySource is flag saying to use gcemetadata.
AuthGoogleJWTKeySource is a string representing path to a file of JWT.
AuthJWTKeySource is for a complete string representing json of JWT.
StoreType = "gcs".

# Variables

GCSRetries number of times to retry for GCS.

# Structs

APIStore a google api store.
GcsFS Simple wrapper for accessing smaller GCS files, it doesn't currently implement a Reader/Writer interface so not useful for stream reading of large files yet.

# Interfaces

GoogleOAuthClient An interface so we can return any of the 3 Google transporter wrapper as a single interface.