provider

package
v0.0.0-...-09b77f6 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSConfig

type AWSConfig struct {
	S3ForcePathStyle bool   `json:"s3_force_path_style,omitempty"`
	AssumeRoleARN    string `json:"assume_role_arn,omitempty"`
	AccessKey        string `json:"access_key,omitempty"`
	SecretAccessKey  string `json:"secret_access_key,omitempty"`
	SessionToken     string `json:"session_token,omitempty"`
	// Custom AWS Config object for aws-sdk-go-v2
	CustomConfig interface{} `json:"-"` // not serialized, used to pass aws.Config
}

AWSConfig AWS S3 specific configuration

type AssumeRoleCredentials

type AssumeRoleCredentials struct {
	AccessKeyID     string
	AccessKeySecret string
	SecurityToken   string
	Expiration      time.Time
}

AssumeRoleCredentials represents the credentials obtained from assume role

type AzureConfig

type AzureConfig struct {
	AccountName string `json:"account_name,omitempty"`
}

AzureConfig Azure Blob Storage specific configuration

type CredentialCache

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

CredentialCache manages the caching of assume role credentials

func NewCredentialCache

func NewCredentialCache(baseCred openapicred.Credential, assumeRoleARN string, region string) (*CredentialCache, error)

NewCredentialCache creates a new credential cache for assume role

func (*CredentialCache) GetCredentials

func (c *CredentialCache) GetCredentials(ctx context.Context) (credentials.Credentials, error)

GetCredentials returns cached credentials or fetches new ones if needed

func (*CredentialCache) StartBackgroundRefresh

func (c *CredentialCache) StartBackgroundRefresh(ctx context.Context)

StartBackgroundRefresh starts a background goroutine to refresh credentials

type GCSConfig

type GCSConfig struct {
	ProjectID       string `json:"project_id,omitempty"`
	CredentialsFile string `json:"credentials_file,omitempty"`
}

GCSConfig Google Cloud Storage specific configuration

type LocalFSConfig

type LocalFSConfig struct {
	BasePath    string `json:"base_path"`             // base path for local filesystem
	CreateDirs  bool   `json:"create_dirs,omitempty"` // whether to automatically create directories, default true
	Permissions string `json:"permissions,omitempty"` // file permissions, e.g. "0755"
}

LocalFSConfig local filesystem specific configuration

type LocalFSProvider

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

LocalFSProvider local filesystem storage provider implementation

func NewLocalFSProvider

func NewLocalFSProvider(config *ProviderConfig) (*LocalFSProvider, error)

NewLocalFSProvider creates a new local filesystem storage provider

func (*LocalFSProvider) Delete

func (l *LocalFSProvider) Delete(ctx context.Context, path string) error

Delete implements ObjectStorageProvider interface

func (*LocalFSProvider) Download

func (l *LocalFSProvider) Download(ctx context.Context, path string) (io.ReadCloser, error)

Download implements ObjectStorageProvider interface

func (*LocalFSProvider) Exists

func (l *LocalFSProvider) Exists(ctx context.Context, path string) (bool, error)

Exists implements ObjectStorageProvider interface

func (*LocalFSProvider) List

func (l *LocalFSProvider) List(ctx context.Context, prefix string) ([]string, error)

List implements ObjectStorageProvider interface

func (*LocalFSProvider) Upload

func (l *LocalFSProvider) Upload(ctx context.Context, path string, data io.Reader) error

Upload implements ObjectStorageProvider interface

type OSSConfig

type OSSConfig struct {
	AssumeRoleARN   string `json:"assume_role_arn,omitempty"`
	AccessKey       string `json:"access_key,omitempty"`
	SecretAccessKey string `json:"secret_access_key,omitempty"`
	SessionToken    string `json:"session_token,omitempty"`
	// Custom OSS Config object for oss-sdk-go-v2
	CustomConfig interface{} `json:"-"` // not serialized, used to pass oss config
}

OSSConfig Alibaba Cloud OSS specific configuration

type OSSProvider

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

OSSProvider Alibaba Cloud OSS storage provider implementation

func NewOSSProvider

func NewOSSProvider(providerConfig *ProviderConfig) (*OSSProvider, error)

NewOSSProvider creates a new OSS storage provider

func (*OSSProvider) Delete

func (o *OSSProvider) Delete(ctx context.Context, path string) error

Delete implements ObjectStorageProvider interface

func (*OSSProvider) Download

func (o *OSSProvider) Download(ctx context.Context, path string) (io.ReadCloser, error)

Download implements ObjectStorageProvider interface

func (*OSSProvider) Exists

func (o *OSSProvider) Exists(ctx context.Context, path string) (bool, error)

Exists implements ObjectStorageProvider interface

func (*OSSProvider) List

func (o *OSSProvider) List(ctx context.Context, prefix string) ([]string, error)

List implements ObjectStorageProvider interface

func (*OSSProvider) Upload

func (o *OSSProvider) Upload(ctx context.Context, path string, data io.Reader) error

Upload implements ObjectStorageProvider interface

type ProviderConfig

type ProviderConfig struct {
	Type     ProviderType `json:"type"`
	Prefix   string       `json:"prefix,omitempty"`   // path prefix, all write paths will add this prefix
	Region   string       `json:"region,omitempty"`   // common region configuration
	Bucket   string       `json:"bucket,omitempty"`   // common bucket/container name
	Endpoint string       `json:"endpoint,omitempty"` // common endpoint configuration

	// Specific provider configurations
	AWS     *AWSConfig     `json:"aws,omitempty"`     // AWS S3 specific configuration
	GCS     *GCSConfig     `json:"gcs,omitempty"`     // Google Cloud Storage specific configuration
	Azure   *AzureConfig   `json:"azure,omitempty"`   // Azure Blob Storage specific configuration
	OSS     *OSSConfig     `json:"oss,omitempty"`     // Alibaba Cloud OSS specific configuration
	LocalFS *LocalFSConfig `json:"localfs,omitempty"` // local filesystem specific configuration
}

ProviderConfig storage provider configuration

type ProviderType

type ProviderType string

ProviderType storage provider type

const (
	// ProviderTypeS3 AWS S3 storage provider
	ProviderTypeS3 ProviderType = "s3"
	// ProviderTypeGCS Google Cloud Storage provider
	ProviderTypeGCS ProviderType = "gcs"
	// ProviderTypeAzure Azure Blob Storage provider
	ProviderTypeAzure ProviderType = "azure"
	// ProviderTypeOSS Alibaba Cloud OSS storage provider
	ProviderTypeOSS ProviderType = "oss"
	// ProviderTypeLocalFS local filesystem storage provider
	ProviderTypeLocalFS ProviderType = "localfs"
)

type S3Provider

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

S3Provider AWS S3 storage provider implementation

func NewS3Provider

func NewS3Provider(providerConfig *ProviderConfig) (*S3Provider, error)

NewS3Provider creates a new S3 storage provider

func (*S3Provider) Delete

func (s *S3Provider) Delete(ctx context.Context, path string) error

Delete implements ObjectStorageProvider interface

func (*S3Provider) Download

func (s *S3Provider) Download(ctx context.Context, path string) (io.ReadCloser, error)

Download implements ObjectStorageProvider interface

func (*S3Provider) Exists

func (s *S3Provider) Exists(ctx context.Context, path string) (bool, error)

Exists implements ObjectStorageProvider interface

func (*S3Provider) List

func (s *S3Provider) List(ctx context.Context, prefix string) ([]string, error)

List implements ObjectStorageProvider interface

func (*S3Provider) Upload

func (s *S3Provider) Upload(ctx context.Context, path string, data io.Reader) error

Upload implements ObjectStorageProvider interface

Jump to

Keyboard shortcuts

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