config

package
v0.0.225 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 34

Documentation

Index

Constants

View Source
const DefaultCredentialsSource = ""

DefaultCredentialsSource specifies that credentials should be detected. Application Default Credentials will be used if avaliable. A read-only client will be used otherwise.

View Source
const NoneCredentialsSource = "none"

NoneCredentialsSource specifies that credentials are explicitly empty and that the client should be restricted to a read-only scope.

View Source
const ServiceAccountFileCredentialsSource = "static"

ServiceAccountFileCredentialsSource specifies that a service account file included in json_key should be used for authentication.

Variables

View Source
var ErrEmptyBucketName = errors.New("bucket_name must be set")

ErrEmptyBucketName is returned when a bucket_name in the config is empty

View Source
var ErrEmptyServiceAccountFile = errors.New("json_key must be set")

ErrEmptyServiceAccountFile is returned when json_key in the config is empty when StaticCredentialsSource is explicitly requested.

View Source
var ErrWrongLengthEncryptionKey = errors.New("encryption_key not 32 bytes")

ErrWrongLengthEncryptionKey is returned when a non-nil encryption_key in the config is not exactly 32 bytes.

Functions

This section is empty.

Types

type GCSCli

type GCSCli struct {
	// BucketName is the GCS bucket operations will use.
	BucketName string `json:"bucket_name"`
	// CredentialsSource is the location of a Service Account File.
	// If left empty, Application Default Credentials will be used if available.
	// If equal to 'none', read-only scope will be used.
	// If equal to 'static', json_key will be used.
	CredentialsSource string `json:"credentials_source"`
	// ServiceAccountFile is the contents of a JSON Service Account File.
	// Required if credentials_source is 'static', otherwise ignored.
	ServiceAccountFile string `json:"json_key"`
	// StorageClass is the type of storage used for objects added to the bucket
	// https://cloud.google.com/storage/docs/storage-classes
	StorageClass string `json:"storage_class"`
	// EncryptionKey is a Customer-Supplied encryption key used to
	// encrypt objects added to the bucket.
	// If left empty, no explicit encryption key will be used;
	// GCS transparently encrypts data using server-side encryption keys.
	// https://cloud.google.com/storage/docs/encryption
	EncryptionKey []byte `json:"encryption_key"`

	EncryptionKeyEncoded string
	EncryptionKeySha256  string
}

GCSCli represents the configuration for the gcscli

func NewFromReader

func NewFromReader(reader io.Reader) (GCSCli, error)

NewFromReader returns the new gcscli configuration struct from the contents of the reader.

reader.Read() is expected to return valid JSON.

Jump to

Keyboard shortcuts

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