Documentation ¶
Index ¶
Constants ¶
const ( Bucket = "bucket" Endpoint = "endpoint" Prefix = "prefix" DoNotUseTLS = "donotusetls" DoNotVerifyTLS = "donotverifytls" )
config exported name consts
const ( BucketNameKey = "bucket" EndpointKey = "endpoint" PrefixKey = "prefix" DisableTLSKey = "disable_tls" DisableTLSVerificationKey = "disable_tls_verification" AccessKey = "aws_access_key_id" SecretAccessKey = "aws_secret_access_key" SessionToken = "aws_session_token" )
config file keys
const (
FilesystemPath = "path"
)
const (
StorageProviderTypeKey = "provider"
)
Variables ¶
var ErrVerifyingConfigStorage = clues.New("verifying configs in corso config file")
var StringToProviderType = map[string]ProviderType{ ProviderUnknown.String(): ProviderUnknown, ProviderS3.String(): ProviderS3, ProviderFilesystem.String(): ProviderFilesystem, }
Functions ¶
This section is empty.
Types ¶
type CommonConfig ¶
type CommonConfig struct { credentials.Corso // requires: CorsoPassphrase KopiaCfgDir string }
func (CommonConfig) StringConfig ¶
func (c CommonConfig) StringConfig() (map[string]string, error)
StringConfig transforms a commonConfig struct into a plain map[string]string. All values in the original struct which serialize into the map are expected to be strings.
type Configurer ¶
type Configurer interface { common.StringConfigurer // ApplyOverrides fetches config from file, processes overrides // from sources like environment variables and flags, and updates the // underlying configuration accordingly. ApplyConfigOverrides( g Getter, readConfigFromStore bool, matchFromConfig bool, overrides map[string]string, ) error WriteConfigToStorer // contains filtered or unexported methods }
func NewStorageConfig ¶
func NewStorageConfig(provider ProviderType) (Configurer, error)
type FilesystemConfig ¶
type FilesystemConfig struct {
Path string
}
func (*FilesystemConfig) ApplyConfigOverrides ¶
func (FilesystemConfig) StringConfig ¶
func (c FilesystemConfig) StringConfig() (map[string]string, error)
TODO(pandeyabs): We need to sanitize paths e.g. handle relative paths, make paths cross platform compatible, etc.
func (FilesystemConfig) WriteConfigToStore ¶
func (c FilesystemConfig) WriteConfigToStore( s Setter, )
type ProviderType ¶
type ProviderType int
const ( ProviderUnknown ProviderType = 0 // Unknown Provider ProviderS3 ProviderType = 1 // S3 ProviderFilesystem ProviderType = 2 // Filesystem )
func (ProviderType) String ¶
func (i ProviderType) String() string
type S3Config ¶
type S3Config struct { credentials.AWS Bucket string // required Endpoint string Prefix string DoNotUseTLS bool DoNotVerifyTLS bool }
func (*S3Config) ApplyConfigOverrides ¶
func (*S3Config) StringConfig ¶
StringConfig transforms a s3Config struct into a plain map[string]string. All values in the original struct which serialize into the map are expected to be strings.
func (*S3Config) WriteConfigToStore ¶
type Storage ¶
type Storage struct { Provider ProviderType Config map[string]string // TODO: These are AWS S3 specific -> move these out SessionTags map[string]string Role string SessionName string SessionDuration string // QueryParams allows passing custom query parameters to S3 GET object // requests. Parameters prefixed by `x-` will be ignored by S3 (no functional // changes) but added to server access logs. These KV-pairs are session // specific and won't be persisted to or sourced from the corso config file. QueryParams map[string]string }
Storage defines a storage provider, along with any configuration required to set up or communicate with that provider.
func NewStorage ¶
func NewStorage(p ProviderType, cfgs ...common.StringConfigurer) (Storage, error)
NewStorage aggregates all the supplied configurations into a single configuration.
func NewStorageUsingRole ¶
func NewStorageUsingRole( p ProviderType, roleARN string, sessionName string, sessionTags map[string]string, queryParams map[string]string, duration string, cfgs ...common.StringConfigurer, ) (Storage, error)
NewStorageUsingRole supports specifying an AWS IAM role the storage provider should assume.
func (Storage) CommonConfig ¶
func (s Storage) CommonConfig() (CommonConfig, error)
CommonConfig retrieves the CommonConfig details from the Storage config.
func (Storage) GetStorageConfigHash ¶
func (Storage) StorageConfig ¶
func (s Storage) StorageConfig() (Configurer, error)
func (Storage) ToFilesystemConfig ¶
func (s Storage) ToFilesystemConfig() (*FilesystemConfig, error)
func (Storage) ToS3Config ¶
type WriteConfigToStorer ¶
type WriteConfigToStorer interface { WriteConfigToStore( s Setter, ) }
WriteConfigToStorer writes config key value pairs to provided store.