storage

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvProviderName               = "env"
	SharedCredentialsProviderName = "shared"
	StaticProviderName            = "static"
	RemoteProviderName            = "remote"
)
View Source
const DefaultAddressEncodingName = storage.Base64EncodingName

Variables

Functions

func AWSCredentialsFromChain

func AWSCredentialsFromChain(cpcs []*CredentialsProviderConfig) (*credentials.Credentials, error)

func StoreFromStorageConfig

func StoreFromStorageConfig(storageConfig *StorageConfig,
	logger log.Logger) (storage.NamedStore, error)

Types

type CredentialsProviderConfig

type CredentialsProviderConfig struct {
	Provider string
	*SharedCredentialsProviderConfig
	*StaticProviderConfig
}

func ProviderConfig

func ProviderConfig(provider credentials.Provider) (*CredentialsProviderConfig, error)

type FileSystemConfig

type FileSystemConfig struct {
	RootDirectory string
}

type GCSConfig added in v1.1.4

type GCSConfig struct {
	GCSBucket string
}

type IPFSConfig

type IPFSConfig struct {
	Protocol string
	Address  string
	Port     string
}

type ProviderName

type ProviderName string

type S3Config

type S3Config struct {
	S3Bucket                 string
	Prefix                   string
	Region                   string
	CredentialsProviderChain []*CredentialsProviderConfig
}

type SharedCredentialsProviderConfig

type SharedCredentialsProviderConfig struct {
	Filename string
	Profile  string
}

func (*SharedCredentialsProviderConfig) Provider

type StaticProviderConfig

type StaticProviderConfig struct {
	AccessKeyID     string
	SecretAccessKey string
	SessionToken    string
}

Almost the same a credentials.Value

func (*StaticProviderConfig) Provider

func (spc *StaticProviderConfig) Provider() (credentials.Provider, error)

type StorageConfig

type StorageConfig struct {
	// Acts a string enum
	StorageType StorageType
	// Address encoding name
	AddressEncoding string
	// Embedding a pointer to each type of config struct allows us to access the
	// relevant one, while at the same time those that are left as nil will be
	// omitted from being serialised.
	*FileSystemConfig
	*S3Config
	*GCSConfig
	*IPFSConfig
}

func ConfigFromString

func ConfigFromString(tomlString string) (*StorageConfig, error)

func DefaultFileSystemConfig

func DefaultFileSystemConfig() *StorageConfig

func DefaultGCSConfig added in v1.1.4

func DefaultGCSConfig() *StorageConfig

func DefaultIPFSConfig added in v1.1.4

func DefaultIPFSConfig() *StorageConfig

func DefaultMemoryConfig

func DefaultMemoryConfig() *StorageConfig

func DefaultS3Config

func DefaultS3Config() *StorageConfig

func NewFileSystemConfig

func NewFileSystemConfig(addressEncoding, rootDirectory string) *StorageConfig

func NewGCSConfig added in v1.1.4

func NewGCSConfig(addressEncoding, gcsBucket string) (*StorageConfig, error)

func NewIPFSConfig added in v1.1.4

func NewIPFSConfig(addressEncoding, proto, address, port string) *StorageConfig

func NewMemoryConfig

func NewMemoryConfig(addressEncoding string) *StorageConfig

func NewS3Config

func NewS3Config(addressEncoding, s3Bucket, s3Prefix, region string,
	providers ...credentials.Provider) (*StorageConfig, error)

func NewStorageConfig

func NewStorageConfig(storageType StorageType, addressEncoding string) *StorageConfig

func (*StorageConfig) TOMLString

func (storageConfig *StorageConfig) TOMLString() string

type StorageType

type StorageType string
const (
	Unspecified StorageType = ""
	Memory      StorageType = "memory"
	Filesystem  StorageType = "filesystem"
	S3          StorageType = "s3"
	GCS         StorageType = "gcs"
	IPFS        StorageType = "ipfs"
)

Jump to

Keyboard shortcuts

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