s3

package
v0.0.0-...-e3e1202 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SignatureVersionV4 = "v4"
	SignatureVersionV2 = "v2"

	// SSEKMS config type constant to configure S3 server side encryption using KMS
	// https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html
	SSEKMS = "SSE-KMS"

	// SSES3 config type constant to configure S3 server side encryption with AES-256
	// https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html
	SSES3 = "SSE-S3"
)

Variables

This section is empty.

Functions

func NewBucketClient

func NewBucketClient(cfg Config, name string, logger log.Logger) (objstore.Bucket, error)

NewBucketClient creates a new S3 bucket client

func NewBucketReaderClient

func NewBucketReaderClient(cfg Config, name string, logger log.Logger) (objstore.BucketReader, error)

NewBucketReaderClient creates a new S3 bucket client

Types

type Config

type Config struct {
	Endpoint             string              `yaml:"endpoint"`
	Region               string              `yaml:"region"`
	BucketName           string              `yaml:"bucket_name"`
	SecretAccessKey      flagext.Secret      `yaml:"secret_access_key"`
	AccessKeyID          string              `yaml:"access_key_id"`
	Insecure             bool                `yaml:"insecure" category:"advanced"`
	SignatureVersion     string              `yaml:"signature_version" category:"advanced"`
	ListObjectsVersion   string              `yaml:"list_objects_version" category:"advanced"`
	BucketLookupType     s3.BucketLookupType `yaml:"bucket_lookup_type" category:"advanced"`
	StorageClass         string              `yaml:"storage_class" category:"experimental"`
	NativeAWSAuthEnabled bool                `yaml:"native_aws_auth_enabled" category:"experimental"`
	PartSize             uint64              `yaml:"part_size" category:"experimental"`
	SendContentMd5       bool                `yaml:"send_content_md5" category:"experimental"`
	STSEndpoint          string              `yaml:"sts_endpoint"`

	SSE  SSEConfig  `yaml:"sse"`
	HTTP HTTPConfig `yaml:"http"`
}

Config holds the config options for an S3 backend

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers the flags for s3 storage with the provided prefix

func (*Config) RegisterFlagsWithPrefix

func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix registers the flags for s3 storage with the provided prefix

func (*Config) Validate

func (cfg *Config) Validate() error

Validate config and returns error on failure

type HTTPConfig

type HTTPConfig struct {
	IdleConnTimeout       time.Duration `yaml:"idle_conn_timeout" category:"advanced"`
	ResponseHeaderTimeout time.Duration `yaml:"response_header_timeout" category:"advanced"`
	InsecureSkipVerify    bool          `yaml:"insecure_skip_verify" category:"advanced"`
	TLSHandshakeTimeout   time.Duration `yaml:"tls_handshake_timeout" category:"advanced"`
	ExpectContinueTimeout time.Duration `yaml:"expect_continue_timeout" category:"advanced"`
	MaxIdleConns          int           `yaml:"max_idle_connections" category:"advanced"`
	MaxIdleConnsPerHost   int           `yaml:"max_idle_connections_per_host" category:"advanced"`
	MaxConnsPerHost       int           `yaml:"max_connections_per_host" category:"advanced"`

	// Allow upstream callers to inject a round tripper
	Transport http.RoundTripper `yaml:"-"`

	TLSConfig TLSConfig `yaml:",inline"`
}

HTTPConfig stores the http.Transport configuration for the s3 minio client.

func (*HTTPConfig) RegisterFlagsWithPrefix

func (cfg *HTTPConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix registers the flags for s3 storage with the provided prefix

type SSEConfig

type SSEConfig struct {
	Type                 string `yaml:"type"`
	KMSKeyID             string `yaml:"kms_key_id"`
	KMSEncryptionContext string `yaml:"kms_encryption_context"`
}

SSEConfig configures S3 server side encryption struct that is going to receive user input (through config file or CLI)

func (*SSEConfig) BuildMinioConfig

func (cfg *SSEConfig) BuildMinioConfig() (encrypt.ServerSide, error)

BuildMinioConfig builds the SSE config expected by the Minio client.

func (*SSEConfig) BuildThanosConfig

func (cfg *SSEConfig) BuildThanosConfig() (s3.SSEConfig, error)

BuildThanosConfig builds the SSE config expected by the Thanos client.

func (*SSEConfig) RegisterFlags

func (cfg *SSEConfig) RegisterFlags(f *flag.FlagSet)

func (*SSEConfig) RegisterFlagsWithPrefix

func (cfg *SSEConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet

func (*SSEConfig) Validate

func (cfg *SSEConfig) Validate() error

type TLSConfig

type TLSConfig struct {
	CAPath     string `yaml:"tls_ca_path" category:"advanced"`
	CertPath   string `yaml:"tls_cert_path" category:"advanced"`
	KeyPath    string `yaml:"tls_key_path" category:"advanced"`
	ServerName string `yaml:"tls_server_name" category:"advanced"`
}

TLSConfig configures the options for TLS connections.

func (*TLSConfig) RegisterFlagsWithPrefix

func (cfg *TLSConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix registers the flags for s3 storage with the provided prefix.

Jump to

Keyboard shortcuts

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