s3

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Overview

Package s3 provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type Credentials

type Credentials struct {
	// AccessKeyId AWS access key ID. Supports keystore syntax for secret lookup. Falls back to AWS_ACCESS_KEY_ID environment variable if not set.
	AccessKeyId string `json:"access_key_id,omitempty,omitzero"`

	// Endpoint S3-compatible endpoint (e.g., 's3.amazonaws.com' or 'localhost:9000' for MinIO)
	Endpoint string `json:"endpoint,omitempty,omitzero"`

	// SecretAccessKey AWS secret access key. Supports keystore syntax for secret lookup. Falls back to AWS_SECRET_ACCESS_KEY environment variable if not set.
	SecretAccessKey string `json:"secret_access_key,omitempty,omitzero"`

	// SessionToken Optional AWS session token for temporary credentials. Supports keystore syntax for secret lookup.
	SessionToken string `json:"session_token,omitempty,omitzero"`

	// UseSsl Enable SSL/TLS for S3 connections (default: true for AWS, false for local MinIO)
	UseSsl bool `json:"use_ssl,omitempty,omitzero"`
}

Credentials defines model for Credentials.

func (*Credentials) DownloadObject

func (creds *Credentials) DownloadObject(
	ctx context.Context,
	bucketName, objectKey, destPath string,
	opts *DownloadObjectOptions,
) error

DownloadObject downloads an object from S3 to a local file. For multipart objects, it downloads parts individually for progress tracking. The download is atomic - a temp file is used and renamed on success.

func (*Credentials) NewMinioClient

func (creds *Credentials) NewMinioClient() (*minio.Client, error)

NewMinioClient creates a Minio client from a Credentials struct. This is the preferred method when using the full Credentials configuration. The endpoint can be either a hostname (e.g., "s3.amazonaws.com") or a full URL (e.g., "https://storage.googleapis.com"). If a URL with scheme is provided, the scheme is stripped and used to infer the SSL setting.

type DownloadObjectOptions

type DownloadObjectOptions struct {
	// ProgressFn is called for each part downloaded (partNumber, partSize, totalParts).
	// If nil, no progress tracking is performed.
	ProgressFn func(partNumber, partSize, totalParts int)
}

DownloadObjectOptions configures how an S3 object is downloaded.

Jump to

Keyboard shortcuts

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