s3

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBucketRequired is returned if the bucket name is missing.
	ErrBucketRequired = errors.New("bucket name is required")

	// ErrEndpointRequired is returned if the endpoint is missing.
	ErrEndpointRequired = errors.New("endpoint is required")

	// ErrAccessKeyIDRequired is returned if the access key ID is missing.
	ErrAccessKeyIDRequired = errors.New("access key ID is required")

	// ErrSecretAccessKeyRequired is returned if the secret access key is missing.
	ErrSecretAccessKeyRequired = errors.New("secret access key is required")

	// ErrInvalidEndpointScheme is returned if the endpoint scheme is missing or invalid.
	ErrInvalidEndpointScheme = errors.New("S3 endpoint must include scheme (http:// or https://)")
)

Functions

func GetEndpointWithoutScheme

func GetEndpointWithoutScheme(endpoint string) string

GetEndpointWithoutScheme returns the endpoint without the scheme prefix. This is useful since MinIO SDK expects endpoint without scheme.

func IsHTTPS

func IsHTTPS(endpoint string) bool

IsHTTPS returns true if the endpoint uses HTTPS.

func ValidateConfig

func ValidateConfig(cfg Config) error

ValidateConfig validates the S3 configuration.

Types

type Config

type Config struct {
	// Bucket is the S3 bucket name
	Bucket string
	// Region is the AWS region (optional)
	Region string
	// Endpoint is the S3-compatible endpoint URL with scheme (http:// or https://)
	Endpoint string
	// AccessKeyID is the access key for authentication
	AccessKeyID string
	// SecretAccessKey is the secret key for authentication
	SecretAccessKey string
	// ForcePathStyle forces path-style addressing (bucket.s3.com/key vs s3.com/bucket/key)
	// Set to true for MinIO and other S3-compatible services
	// Set to false for AWS S3 (default)
	ForcePathStyle bool
	// Prefix is an optional path prefix for all keys stored in the bucket
	Prefix string
	// Transport is the HTTP transport to use (optional, used for testing)
	Transport http.RoundTripper
}

Config holds the configuration for S3 storage.

Jump to

Keyboard shortcuts

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