cos

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sign added in v0.2.2

func Sign(req *http.Request, cred auth.Credential, now time.Time) error

Types

type APIError added in v0.2.2

type APIError struct {
	StatusCode int
	Method     string
	URL        string
	Code       string
	Message    string
	RequestID  string
	TraceID    string
}

func (*APIError) Error added in v0.2.2

func (e *APIError) Error() string

type COSBucket added in v0.2.2

type COSBucket struct {
	Name         string `xml:"Name"`
	Region       string `xml:"Location"`
	CreationDate string `xml:"CreationDate"`
}

type COSObject added in v0.2.2

type COSObject struct {
	Key  string `xml:"Key"`
	Size int64  `xml:"Size"`
}

type Client added in v0.2.2

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

func NewClient added in v0.2.2

func NewClient(cred auth.Credential, opts ...Option) *Client

func (*Client) ListBuckets added in v0.2.2

func (c *Client) ListBuckets(ctx context.Context) (*ListBucketsResponse, error)

func (*Client) ListObjects added in v0.2.2

func (c *Client) ListObjects(ctx context.Context, bucket, region, marker string, maxKeys int) (ListObjectsResponse, error)

type Driver added in v0.0.9

type Driver struct {
	Credential auth.Credential
	Client     *Client
	// contains filtered or unexported fields
}

func NewDriver added in v0.2.5

func NewDriver(cred auth.Credential, opts ...Option) *Driver

NewDriver creates a COS driver with optional client injections.

func (*Driver) GetBuckets added in v0.0.9

func (d *Driver) GetBuckets(ctx context.Context) ([]schema.Storage, error)

func (*Driver) ListObjects added in v0.2.2

func (d *Driver) ListObjects(ctx context.Context, buckets map[string]string)

func (*Driver) SetClientOptions added in v0.2.5

func (d *Driver) SetClientOptions(opts ...Option)

SetClientOptions replaces the client options used by lazy client creation.

func (*Driver) TotalObjects added in v0.2.2

func (d *Driver) TotalObjects(ctx context.Context, buckets map[string]string)

type HTTPStatusError added in v0.2.2

type HTTPStatusError struct {
	StatusCode int
	Status     string
	Body       string
}

func (*HTTPStatusError) Error added in v0.2.2

func (e *HTTPStatusError) Error() string

type ListBucketsResponse added in v0.2.2

type ListBucketsResponse struct {
	XMLName xml.Name    `xml:"ListAllMyBucketsResult"`
	Buckets []COSBucket `xml:"Buckets>Bucket"`
}

type ListObjectsResponse added in v0.2.2

type ListObjectsResponse struct {
	XMLName     xml.Name    `xml:"ListBucketResult"`
	Name        string      `xml:"Name"`
	Prefix      string      `xml:"Prefix"`
	Marker      string      `xml:"Marker"`
	NextMarker  string      `xml:"NextMarker"`
	MaxKeys     int         `xml:"MaxKeys"`
	IsTruncated bool        `xml:"IsTruncated"`
	Objects     []COSObject `xml:"Contents"`
}

type Option added in v0.2.2

type Option func(*Client)

func WithClock added in v0.2.2

func WithClock(now func() time.Time) Option

func WithHTTPClient added in v0.2.2

func WithHTTPClient(hc *http.Client) Option

func WithRetryPolicy added in v0.2.2

func WithRetryPolicy(p api.RetryPolicy) Option

func WithServiceEndpoint added in v0.2.2

func WithServiceEndpoint(rawURL string) Option

Jump to

Keyboard shortcuts

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