Documentation
¶
Index ¶
- Constants
- func CollapseGrants(out BucketACLResponse) string
- func NormalizeCOSACL(level string) string
- func Sign(req *http.Request, cred auth.Credential, now time.Time) error
- type APIError
- type BucketACLResponse
- type COSBucket
- type COSObject
- type Client
- func (c *Client) GetBucketACL(ctx context.Context, bucket, region string) (string, error)
- func (c *Client) ListBuckets(ctx context.Context) (*ListBucketsResponse, error)
- func (c *Client) ListObjects(ctx context.Context, bucket, region, marker string, maxKeys int) (ListObjectsResponse, error)
- func (c *Client) PutBucketACL(ctx context.Context, bucket, region, acl string) error
- type Driver
- func (d *Driver) AuditBucketACL(ctx context.Context, bucket string) ([]schema.BucketACLEntry, error)
- func (d *Driver) ExposeBucket(ctx context.Context, bucket, level string) (string, error)
- func (d *Driver) GetBuckets(ctx context.Context) ([]schema.Storage, error)
- func (d *Driver) ListObjects(ctx context.Context, buckets map[string]string) ([]schema.BucketResult, error)
- func (d *Driver) SetClientOptions(opts ...Option)
- func (d *Driver) TotalObjects(ctx context.Context, buckets map[string]string) ([]schema.BucketResult, error)
- func (d *Driver) UnexposeBucket(ctx context.Context, bucket string) error
- type HTTPStatusError
- type ListBucketsResponse
- type ListObjectsResponse
- type Option
Constants ¶
const ( COSACLPrivate = "private" COSACLPublicRead = "public-read" COSACLPublicReadWrite = "public-read-write" COSACLAuthenticatedRead = "authenticated-read" )
Tencent COS canned ACL values, sent via the `x-cos-acl` header.
Variables ¶
This section is empty.
Functions ¶
func CollapseGrants ¶ added in v0.3.1
func CollapseGrants(out BucketACLResponse) string
CollapseGrants reduces the parsed ACL grant list back into a canned label.
func NormalizeCOSACL ¶ added in v0.3.1
NormalizeCOSACL maps user-friendly aliases to canned COS ACL values.
Types ¶
type APIError ¶ added in v0.2.2
type BucketACLResponse ¶ added in v0.3.1
type BucketACLResponse struct {
XMLName xml.Name `xml:"AccessControlPolicy"`
Owner struct {
ID string `xml:"ID"`
DisplayName string `xml:"DisplayName"`
} `xml:"Owner"`
AccessControlList struct {
Grant []struct {
Grantee struct {
Type string `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"`
ID string `xml:"ID"`
URI string `xml:"URI"`
} `xml:"Grantee"`
Permission string `xml:"Permission"`
} `xml:"Grant"`
} `xml:"AccessControlList"`
}
BucketACLResponse maps the body returned by `GET /?acl`. Tencent COS uses the same Owner+AccessControlList shape as S3; the canned-ACL view is reconstructed from grants because the GET path doesn't echo `x-cos-acl`.
type Client ¶ added in v0.2.2
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetBucketACL ¶ added in v0.3.1
GetBucketACL returns the canned ACL summary derived from the `?acl` grants.
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
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) AuditBucketACL ¶ added in v0.3.1
func (d *Driver) AuditBucketACL(ctx context.Context, bucket string) ([]schema.BucketACLEntry, error)
AuditBucketACL enumerates buckets and returns their canned ACL summary.
func (*Driver) ExposeBucket ¶ added in v0.3.1
ExposeBucket sets the bucket public-readable (defaults to public-read).
func (*Driver) GetBuckets ¶ added in v0.0.9
func (*Driver) ListObjects ¶ added in v0.2.2
func (*Driver) SetClientOptions ¶ added in v0.2.5
SetClientOptions replaces the client options used by lazy client creation.
func (*Driver) TotalObjects ¶ added in v0.2.2
type HTTPStatusError ¶ added in v0.2.2
func (*HTTPStatusError) Error ¶ added in v0.2.2
func (e *HTTPStatusError) Error() string
type ListBucketsResponse ¶ added in v0.2.2
type ListObjectsResponse ¶ added in v0.2.2
type Option ¶ added in v0.2.2
type Option func(*Client)
func WithHTTPClient ¶ added in v0.2.2
func WithRetryPolicy ¶ added in v0.2.2
func WithRetryPolicy(p api.RetryPolicy) Option