cos

package
v0.0.0-...-0c08822 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePathStyle

func ParsePathStyle(url string) (bucketName string, appId string, key string, err error)

func ParseVirtualHostedStyle

func ParseVirtualHostedStyle(url string) (bucketName string, appId string, key string, err error)

func QCloudEndpoint

func QCloudEndpoint(host, region string) string

func RawEndpoint

func RawEndpoint(host, region string) string

Types

type Bucket

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

func NewBucket

func NewBucket(c *Configuration, endpoint Endpoint, opts ...Option) (*Bucket, error)

func NewBucketFromEnv

func NewBucketFromEnv(endpoint Endpoint, opts ...Option) (*Bucket, error)

func (Bucket) Client

func (x Bucket) Client() *s3.S3

func (Bucket) Copy

func (x Bucket) Copy(ctx context.Context, sourceUrl, targetKey string) (string, error)

func (Bucket) Delete

func (x Bucket) Delete(ctx context.Context, url string) error

func (Bucket) Download

func (x Bucket) Download(ctx context.Context, url string) ([]byte, error)

func (Bucket) Get

func (x Bucket) Get(ctx context.Context, url string) ([]byte, error)

func (Bucket) List

func (x Bucket) List(ctx context.Context, url string, latestKey *string, maxKeys int64) ([]string, *string, error)

func (Bucket) Presign

func (x Bucket) Presign(keyOrUrl string, expire time.Duration) (putUrl string, getUrl string, err error)

func (Bucket) Put

func (x Bucket) Put(ctx context.Context, key string, buffer []byte) (string, error)

type Configuration

type Configuration struct {
	Host       string `yaml:"host"`
	BucketName string `yaml:"bucket_name"`
	AppId      string `yaml:"app_id"`
	Region     string `yaml:"region"`
	SecretId   string `yaml:"secret_id"`
	SecretKey  string `yaml:"secret_key"`
	Token      string `yaml:"token"`
}

func (*Configuration) Init

func (c *Configuration) Init() error

type Endpoint

type Endpoint func(hostPort, region string) string

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithDisableSSL

func WithDisableSSL() Option

func WithMaxIdleConns

func WithMaxIdleConns(maxIdleConns int) Option

func WithPathStyle

func WithPathStyle() Option

Jump to

Keyboard shortcuts

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