Documentation
¶
Index ¶
Constants ¶
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.
const NoneCredentialsSource = "none"
NoneCredentialsSource specifies that credentials are explicitly empty and that the client should be restricted to a read-only scope.
const ServiceAccountFileCredentialsSource = "static"
ServiceAccountFileCredentialsSource specifies that a service account file included in json_key should be used for authentication.
Variables ¶
var ErrEmptyBucketName = errors.New("bucket_name must be set")
ErrEmptyBucketName is returned when a bucket_name in the config is empty
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.
var ErrNonPositiveHTTPRequestTimeout = errors.New("http_request_timeout must be greater than 0")
ErrNonPositiveHTTPRequestTimeout is returned when http_request_timeout is <= 0.
var ErrNonPositiveHTTPResponseHeaderTimeout = errors.New("http_response_header_timeout must be greater than 0")
ErrNonPositiveHTTPResponseHeaderTimeout is returned when http_response_header_timeout is <= 0.
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"`
// UniformBucketLevelAccess enables uniform bucket-level access control.
// When true, disables ACLs and uses only IAM for permissions.
// When false (default), buckets use fine-grained ACL-based access control.
// https://cloud.google.com/storage/docs/uniform-bucket-level-access
UniformBucketLevelAccess bool `json:"uniform_bucket_level_access"`
// 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"`
// HTTPRequestTimeout specifies the maximum duration for each GCS HTTP request.
// If empty, requests have no client-side timeout.
HTTPRequestTimeout string `json:"http_request_timeout"`
// HTTPResponseHeaderTimeout specifies how long to wait for response headers.
// If empty, no explicit response header timeout is configured.
HTTPResponseHeaderTimeout string `json:"http_response_header_timeout"`
EncryptionKeyEncoded string
EncryptionKeySha256 string
}
GCSCli represents the configuration for the gcscli
func NewFromReader ¶
NewFromReader returns the new gcscli configuration struct from the contents of the reader.
reader.Read() is expected to return valid JSON.