s3client

package
v0.0.0-...-e308f56 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package s3client provides shared S3 connection configuration and minio client construction.

A single Config block is declared in the global configuration and a ClientProvider lazily constructs a singleton *minio.Client that can be shared across multiple consumers (cache backends, strategies, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(ctx context.Context, config Config) (*minio.Client, error)

NewClient constructs a *minio.Client from the given Config. The standard AWS credential chain is used:

  1. Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN)
  2. AWS credentials file (~/.aws/credentials)
  3. IAM role from EC2 instance metadata or ECS container credentials

Types

type ClientProvider

type ClientProvider func() (*minio.Client, error)

ClientProvider is a function that lazily creates a singleton *minio.Client.

func NewClientProvider

func NewClientProvider(ctx context.Context, config Config) ClientProvider

NewClientProvider returns a ClientProvider that will construct the minio client at most once using the supplied Config.

type Config

type Config struct {
	Endpoint      string `hcl:"endpoint,optional" help:"S3 endpoint URL (e.g., s3.amazonaws.com or localhost:9000)." default:"s3.amazonaws.com"`
	Region        string `hcl:"region,optional" help:"S3 region." default:"us-west-2"`
	UseSSL        bool   `hcl:"use-ssl,optional" help:"Use SSL for S3 connections." default:"true"`
	SkipSSLVerify bool   `hcl:"skip-ssl-verify,optional" help:"Skip SSL certificate verification." default:"false"`
}

Config holds S3 connection parameters that are shared across all consumers. It is intended to be embedded as a global HCL block (e.g. `hcl:"s3,block"`).

Directories

Path Synopsis
Package s3clienttest provides a reusable MinIO test server via Docker.
Package s3clienttest provides a reusable MinIO test server via Docker.

Jump to

Keyboard shortcuts

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