s3

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EndpointFlagName        = withFlagPrefix("endpoint")
	EnableTLSFlagName       = withFlagPrefix("enable-tls")
	CredentialTypeFlagName  = withFlagPrefix("credential-type")
	AccessKeyIDFlagName     = withFlagPrefix("access-key-id")     // #nosec G101
	AccessKeySecretFlagName = withFlagPrefix("access-key-secret") // #nosec G101
	BucketFlagName          = withFlagPrefix("bucket")
	PathFlagName            = withFlagPrefix("path")
	TimeoutFlagName         = withFlagPrefix("timeout")
)

Functions

func CLIFlags

func CLIFlags(envPrefix, category string) []cli.Flag

CLIFlags ... used for S3 backend configuration category is used to group the flags in the help output (see https://cli.urfave.org/v2/examples/flags/#grouping)

Types

type Config

type Config struct {
	CredentialType  CredentialType
	Endpoint        string
	EnableTLS       bool
	AccessKeyID     string
	AccessKeySecret string
	Bucket          string
	Path            string
}

func ReadConfig

func ReadConfig(ctx *cli.Context) Config

func (Config) MarshalJSON added in v1.6.0

func (c Config) MarshalJSON() ([]byte, error)

Custom MarshalJSON function to control what gets included in the JSON output TODO: Probably best would be to separate config from secrets everywhere. Then we could just log the config and not worry about secrets.

type CredentialType

type CredentialType string
const (
	CredentialTypeStatic  CredentialType = "static"
	CredentialTypeIAM     CredentialType = "iam"
	CredentialTypeUnknown CredentialType = "unknown"
)

func StringToCredentialType

func StringToCredentialType(s string) CredentialType

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store ... S3 store client safe for concurrent use: https://github.com/minio/minio-go/issues/598#issuecomment-569457863

func NewStore added in v1.6.0

func NewStore(cfg Config) (*Store, error)

func (*Store) BackendType

func (s *Store) BackendType() common.BackendType

func (*Store) Get

func (s *Store) Get(ctx context.Context, key []byte) ([]byte, error)

func (*Store) Put

func (s *Store) Put(ctx context.Context, key []byte, value []byte) error

func (*Store) Verify

func (s *Store) Verify(_ context.Context, key []byte, value []byte) error

Jump to

Keyboard shortcuts

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