tos

package
v2.6.7 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 35 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MaxPartSize     = 5 * 1024 * 1024 * 1024
	MinPartSize     = 5 * 1024 * 1024
	DefaultPartSize = 20 * 1024 * 1024
)
View Source
const (
	// Deprecated: use enum.ACLPrivate instead
	ACLPrivate = "private"
	// Deprecated: use enum.ACLPublicRead instead
	ACLPublicRead = "public-read"
	// Deprecated: use enum.ACLPublicReadWrite instead
	ACLPublicReadWrite = "public-read-write"
	// Deprecated: use enum.ACLAuthRead instead
	ACLAuthRead = "authenticated-read"
	// Deprecated: use enum.ACLBucketOwnerRead instead
	ACLBucketOwnerRead = "bucket-owner-read"
	// Deprecated: use enum.ACLBucketOwnerFullControl instead
	ACLBucketOwnerFullControl = "bucket-owner-full-control"
	// Deprecated: use enum.ACLLogDeliveryWrite instead
	ACLLogDeliveryWrite = "log-delivery-write"

	// Deprecated: use enum.PermissionRead instead
	PermissionRead = "READ"
	// Deprecated: use enum.PermissionWrite instead
	PermissionTypeWrite = "WRITE"
	// Deprecated: use enum.PermissionReadAcp instead
	PermissionTypeReadAcp = "READ_ACP"
	// Deprecated: use enum.PermissionWriteAcp instead
	PermissionTypeWriteAcp = "WRITE_ACP"
	// Deprecated: use enum.PermissionFullControl instead
	PermissionFullControl = "FULL_CONTROL"
)
View Source
const (
	// MetadataDirectiveReplace replace source object metadata when calling CopyObject
	MetadataDirectiveReplace = "REPLACE"

	// MetadataDirectiveCopy copy source object metadata when calling CopyObject
	MetadataDirectiveCopy = "COPY"
)
View Source
const (
	HeaderUserAgent                    = "User-Agent"
	HeaderContentLength                = "Content-Length"
	HeaderContentType                  = "Content-Type"
	HeaderContentMD5                   = "Content-MD5"
	HeaderContentSha256                = "X-Tos-Content-Sha256"
	HeaderContentLanguage              = "Content-Language"
	HeaderContentEncoding              = "Content-Encoding"
	HeaderContentDisposition           = "Content-Disposition"
	HeaderLastModified                 = "Last-Modified"
	HeaderCacheControl                 = "Cache-Control"
	HeaderExpires                      = "Expires"
	HeaderETag                         = "ETag"
	HeaderVersionID                    = "X-Tos-Version-Id"
	HeaderDeleteMarker                 = "X-Tos-Delete-Marker"
	HeaderStorageClass                 = "X-Tos-Storage-Class"
	HeaderAzRedundancy                 = "X-Tos-Az-Redundancy"
	HeaderRestore                      = "X-Tos-Restore"
	HeaderTag                          = "X-Tos-Tag"
	HeaderSSECustomerAlgorithm         = "X-Tos-Server-Side-Encryption-Customer-Algorithm"
	HeaderSSECustomerKeyMD5            = "X-Tos-Server-Side-Encryption-Customer-Key-MD5"
	HeaderSSECustomerKey               = "X-Tos-Server-Side-Encryption-Customer-Key"
	HeaderServerSideEncryption         = "X-Tos-Server-Side-Encryption"
	HeaderServerSideEncryptionKmsKeyID = "X-Tos-Server-Side-Encryption-Kms-Key-Id"
	HeaderCopySourceSSECAlgorithm      = "X-Tos-Server-Side-Encryption-Customer-Algorithm"
	HeaderCopySourceSSECKeyMD5         = "X-Tos-Server-Side-Encryption-Customer-Key-MD5"
	HeaderCopySourceSSECKey            = "X-Tos-Server-Side-Encryption-Customer-Key"
	HeaderIfModifiedSince              = "If-Modified-Since"
	HeaderIfUnmodifiedSince            = "If-Unmodified-Since"
	HeaderIfMatch                      = "If-Match"
	HeaderIfNoneMatch                  = "If-None-Match"
	HeaderRange                        = "Range"
	HeaderContentRange                 = "Content-Range"
	HeaderRequestID                    = "X-Tos-Request-Id"
	HeaderID2                          = "X-Tos-Id-2"
	HeaderBucketRegion                 = "X-Tos-Bucket-Region"
	HeaderLocation                     = "Location"
	HeaderACL                          = "X-Tos-Acl"
	HeaderGrantFullControl             = "X-Tos-Grant-Full-Control"
	HeaderGrantRead                    = "X-Tos-Grant-Read"
	HeaderGrantReadAcp                 = "X-Tos-Grant-Read-Acp"
	HeaderGrantWrite                   = "X-Tos-Grant-Write"
	HeaderGrantWriteAcp                = "X-Tos-Grant-Write-Acp"
	HeaderNextAppendOffset             = "X-Tos-Next-Append-Offset"
	HeaderObjectType                   = "X-Tos-Object-Type"
	HeaderHashCrc64ecma                = "X-Tos-Hash-Crc64ecma"
	HeaderMetadataDirective            = "X-Tos-Metadata-Directive"
	HeaderCopySource                   = "X-Tos-Copy-Source"
	HeaderCopySourceIfMatch            = "X-Tos-Copy-Source-If-Match"
	HeaderCopySourceIfNoneMatch        = "X-Tos-Copy-Source-If-None-Match"
	HeaderCopySourceIfModifiedSince    = "X-Tos-Copy-Source-If-Modified-Since"
	HeaderCopySourceIfUnmodifiedSince  = "X-Tos-Copy-Source-If-Unmodified-Since"
	HeaderCopySourceRange              = "X-Tos-Copy-Source-Range"
	HeaderCopySourceVersionID          = "X-Tos-Copy-Source-Version-Id"
	HeaderWebsiteRedirectLocation      = "X-Tos-Website-Redirect-Location"
	HeaderCSType                       = "X-Tos-Cs-Type"
	HeaderMetaPrefix                   = "X-Tos-Meta-"
)
View Source
const (
	DefaultCacheCap = 100
	VolceHostSuffix = "volces.com"
	HostSplitSep    = "."
	HostSplitLength = 4
)
View Source
const (
	FetchTaskStateFailed  = "Failed"
	FetchTaskStateSucceed = "Succeed"
	FetchTaskStateExpired = "Expired"
	FetchTaskStateRunning = "Running"
)
View Source
const (
	NoRetry retryAction = iota
	Retry
)
View Source
const (
	DefaultRetryBackoffBase = 100 * time.Millisecond
	DefaultRetryTime        = 3
)
View Source
const (
	EventPartSucceed = 3
	EventPartFailed  = 4
	EventPartAborted = 5 // The task needs to be interrupted in case of 403, 404, 405 errors
)
View Source
const (
	BucketVersioningEnable    = "Enabled"
	BucketVersioningSuspended = "Suspended"
)
View Source
const DefaultFilePerm = os.FileMode(0644)
View Source
const DefaultHighLatencyLogThreshold = 100 // KB
View Source
const DefaultListMaxKeys = 1000
View Source
const DefaultProgressCallbackSize = 512 * 1024
View Source
const DefaultTaskBufferSize = 100
View Source
const (
	ISO8601TimeFormat = "2006-01-02T15:04:05.000Z07:00"
)
View Source
const (
	QueryPartNumber = "partNumber"
)
View Source
const TempFileSuffix = ".temp"
View Source
const (
	// Version tos-go-sdk version
	Version = "v2.6.7"
)

Variables

View Source
var (
	InputIsNilClientError             = newTosClientError("input is nil. ", nil)
	InputInvalidClientError           = newTosClientError("input data is invalid. ", nil)
	InvalidPartNumber                 = newTosClientError("input part number is invalid. ", nil)
	InvalidUploadID                   = newTosClientError("input upload id is invalid. ", nil)
	InvalidBucketNameLength           = newTosClientError("invalid bucket name, the length must be [3, 63]", nil)
	InvalidBucketNameCharacter        = newTosClientError("invalid bucket name, the character set is illegal", nil)
	InvalidBucketNameStartingOrEnding = newTosClientError("invalid bucket name, the bucket name can be neither starting with '-' nor ending with '-'", nil)
	InvalidObjectNameLength           = newTosClientError("invalid object name, the length must be [1, 696]", nil)
	InvalidObjectNameStartingOrEnding = newTosClientError("invalid object name, the object name can not start with '\\'", nil)
	InvalidObjectNameCharacterSet     = newTosClientError("invalid object name, the character set is illegal", nil)
	InvalidACL                        = newTosClientError("invalid acl type", nil)
	InvalidStorageClass               = newTosClientError("invalid storage class", nil)
	InvalidGrantee                    = newTosClientError("invalid grantee type", nil)
	InvalidCanned                     = newTosClientError("invalid canned type", nil)
	InvalidAzRedundancy               = newTosClientError("invalid az redundancy type", nil)
	InvalidMetadataDirective          = newTosClientError("invalid metadata directive type", nil)
	InvalidPermission                 = newTosClientError("invalid permission type", nil)
	InvalidSSECAlgorithm              = newTosClientError("invalid encryption-decryption algorithm", nil)
	InvalidPartSize                   = newTosClientError("invalid part size, the size must be [5242880, 5368709120]", nil)
	InvalidSrcFilePath                = newTosClientError("invalid file path, the file does not exist", nil)
	InvalidFilePartNum                = newTosClientError("unsupported part number, the maximum is 10000", nil)
	InvalidMarshal                    = newTosClientError("unable to do serialization/deserialization", nil)
	InvalidPreSignedURLExpires        = newTosClientError("invalid pre signed url expires, the time must be less 604800 seconds.", nil)
	InvalidPreSignedConditions        = newTosClientError("invalid pre signed url conditions.", nil)
	InvalidFilePath                   = newTosClientError("invalid file path", nil)
	InvalidCheckpointFilePath         = newTosClientError("invalid checkpoint file path", nil)
	CrcCheckFail                      = newTosClientError("crc check not equal", nil)
	InvalidS3Endpoint                 = newTosClientError("do not support s3 endpoint, please use tos endpoint", nil)
	NotSupportSeek                    = newTosClientError("reader not support seek", nil)
	ProxyNotSupportHttps              = newTosClientError("proxy not support https", nil)
	ProxyUrlInvalid                   = newTosClientError("proxy url invalid", nil)
	NotificationConfigurationsInvalid = newTosClientError("Notification Configurations invalid", nil)
	InvalidCompleteAllPartsLength     = newTosClientError("Should not specify both complete all and Parts", nil)
	InvalidPartsLength                = newTosClientError("You must specify at least one part", nil)
	InvlidDeleteMultiObjectsLength    = newTosClientError("You must specify at least one object", nil)
)
View Source
var DefaultCrcTable = func() *crc64.Table {
	return crc64.MakeTable(crc64.ECMA)
}
View Source
var (
	ErrETagMissMatch = errors.New("tos: ETag miss match")
)
View Source
var RefreshInterval = time.Second * 30

Functions

func CRC64Combine

func CRC64Combine(crc1 uint64, crc2 uint64, len2 uint64) uint64

CRC64Combine combines CRC64

func Code

func Code(err error) string

Code return error code saved in TosServerError

func GetUnixTimeMs added in v2.2.0

func GetUnixTimeMs() int64

func Int64

func Int64(value int64) *int64

func IsValidBucketName

func IsValidBucketName(name string) error

func LookupIP added in v2.6.5

func LookupIP(ctx context.Context, host string) ([]net.IP, error)

func MinDuration added in v2.6.5

func MinDuration(t1, t2 time.Duration) time.Duration

func NewCRC

func NewCRC(tab *crc64.Table, init uint64) hash.Hash64

NewCRC is similar with crc64.New, but you can set the initial value. Following methods are copied from package crc64 to implement Hash interface.

func OnRetryFromStart added in v2.5.0

func OnRetryFromStart(req *Request) error

func RequestID

func RequestID(err error) string

func SigningKey

func SigningKey(info *SigningKeyInfo) []byte

func StatueCode deprecated

func StatueCode(err error) int

StatueCode return status code saved in TosServerError or UnexpectedStatusCodeError

Deprecated: use StatusCode instead

func StatusCode

func StatusCode(err error) int

StatusCode return status code saved in TosServerError or UnexpectedStatusCodeError

func StringPtr added in v2.2.0

func StringPtr(input string) *string

func SupportedEndpoint added in v2.4.2

func SupportedEndpoint() map[string]string

func SupportedRegion

func SupportedRegion() map[string]string

func ToMillis added in v2.2.0

func ToMillis(t time.Time) int64

func URIEncode

func URIEncode(in string, encodeSlash bool) []byte

func UTCNow

func UTCNow() time.Time

Types

type AbortInCompleteMultipartUpload added in v2.4.0

type AbortInCompleteMultipartUpload struct {
	DaysAfterInitiation int `json:"DaysAfterInitiation,omitempty"`
}

type AbortMultipartUploadInput

type AbortMultipartUploadInput struct {
	// Bucket is needed in V2 api
	Bucket   string
	Key      string
	UploadID string `location:"query" locationName:"uploadId"`
}

type AbortMultipartUploadOutput

type AbortMultipartUploadOutput struct {
	RequestInfo `json:"-"`
}

type AccessLogConfiguration added in v2.5.0

type AccessLogConfiguration struct {
	UseServiceTopic bool   `json:"UseServiceTopic"`
	TLSProjectID    string `json:"TLSProjectID"`
	TLSTopicID      string `json:"TLSTopicID"`
}

type AppendObjectOutput

type AppendObjectOutput struct {
	RequestInfo      `json:"-"`
	ETag             string `json:"ETag,omitempty"`
	NextAppendOffset int64  `json:"NextAppendOffset,omitempty"`
}

type AppendObjectV2Input

type AppendObjectV2Input struct {
	Bucket             string
	Key                string
	Offset             int64 `location:"query" locationName:"offset" default:"0"`
	Content            io.Reader
	ContentLength      int64        `location:"header" locationName:"Content-Length"`
	ContentMD5         string       `location:"header" locationName:"Content-MD5"`
	ContentSHA256      string       `location:"header" locationName:"X-Tos-Content-Sha256"`
	CacheControl       string       `location:"header" locationName:"Cache-Control"`
	ContentDisposition string       `location:"header" locationName:"Content-Disposition" encodeChinese:"true"`
	ContentEncoding    string       `location:"header" locationName:"Content-Encoding"`
	ContentLanguage    string       `location:"header" locationName:"Content-Language"`
	ContentType        string       `location:"header" locationName:"Content-Type"`
	Expires            time.Time    `location:"header" locationName:"Expires"`
	ACL                enum.ACLType `location:"header" locationName:"X-Tos-Acl"`

	GrantFullControl string `location:"header" locationName:"X-Tos-Grant-Full-Control"` // optional
	GrantRead        string `location:"header" locationName:"X-Tos-Grant-Read"`         // optional
	GrantReadAcp     string `location:"header" locationName:"X-Tos-Grant-Read-Acp"`     // optional
	GrantWriteAcp    string `location:"header" locationName:"X-Tos-Grant-Write-Acp"`    // optional

	WebsiteRedirectLocation string                `location:"header" locationName:"X-Tos-Website-Redirect-Location"`
	StorageClass            enum.StorageClassType `location:"header" locationName:"X-Tos-Storage-Class"`
	TrafficLimit            int64                 `location:"header" locationName:"X-Tos-Traffic-Limit"`
	IfMatch                 string                `location:"header" locationName:"X-Tos-If-Match"`

	Meta                 map[string]string `location:"headers"`
	DataTransferListener DataTransferListener
	RateLimiter          RateLimiter
	PreHashCrc64ecma     uint64
}

type AppendObjectV2Output

type AppendObjectV2Output struct {
	RequestInfo      `json:"-"`
	VersionID        string `json:"VersionID,omitempty"`
	NextAppendOffset int64  `json:"NextAppendOffset,omitempty"`
	HashCrc64ecma    uint64 `json:"HashCrc64Ecma,omitempty"`
}

type Bucket

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

func (*Bucket) AbortMultipartUpload deprecated

func (bkt *Bucket) AbortMultipartUpload(ctx context.Context, input *AbortMultipartUploadInput, options ...Option) (*AbortMultipartUploadOutput, error)

AbortMultipartUpload abort a multipart upload operation

Deprecated: use AbortMultipartUpload of ClientV2 instead

func (*Bucket) AppendObject deprecated

func (bkt *Bucket) AppendObject(ctx context.Context, objectKey string, content io.Reader, offset int64, options ...Option) (*AppendObjectOutput, error)

AppendObject append content at the tail of an appendable object

objectKey: the name of object
content: the content of object
offset: append position, equals to the current object-size
options: WithContentType set Content-Type,
  WithContentDisposition set Content-Disposition,
  WithContentLanguage set Content-Language,
  WithContentEncoding set Content-Encoding,
  WithCacheControl set Cache-Control,
  WithExpires set Expires,
  WithMeta set meta header(s),
  WithACL WithACLGrantFullControl WithACLGrantRead WithACLGrantReadAcp WithACLGrantWrite WithACLGrantWriteAcp set object acl
above options only take effect when offset parameter is 0.
  WithContentSHA256 set Content-Sha256,
  WithContentMD5 set Content-MD5.

NOTICE: only content with a known length is supported now,

e.g, bytes.Buffer, bytes.Reader, strings.Reader, os.File, io.LimitedReader, net.Buffers.
if the parameter content(an io.Reader) is not one of these,
please use io.LimitReader(reader, length) to wrap this reader or use the WithContentLength option.

Deprecated: use AppendObject of ClientV2 instead

func (*Bucket) CompleteMultipartUpload deprecated

func (bkt *Bucket) CompleteMultipartUpload(ctx context.Context, input *CompleteMultipartUploadInput, options ...Option) (*CompleteMultipartUploadOutput, error)

CompleteMultipartUpload complete a multipart upload operation

input: input.Key the object name,
  input.UploadID the uploadID got from CreateMultipartUpload
  input.UploadedParts upload part output got from UploadPart or UploadPartCopy

Deprecated: use CompleteMultipartUpload of ClientV2 instead

func (*Bucket) CopyObject deprecated

func (bkt *Bucket) CopyObject(ctx context.Context, srcObjectKey, dstObjectKey string, options ...Option) (*CopyObjectOutput, error)

CopyObject copy an object

srcObjectKey: the source object name
dstObjectKey: the destination object name. srcObjectKey and dstObjectKey belongs to the same bucket.
options: WithVersionID the version id of source object,
  WithMetadataDirective copy source object metadata or replace with new object metadata,
  WithACL WithACLGrantFullControl WithACLGrantRead WithACLGrantReadAcp WithACLGrantWrite WithACLGrantWriteAcp set object acl,
  WithCopySourceIfMatch WithCopySourceIfNoneMatch WithCopySourceIfModifiedSince WithCopySourceIfUnmodifiedSince set copy conditions
if CopyObject called with WithMetadataDirective(tos.MetadataDirectiveReplace), these options can be used:
  WithContentType set Content-Type,
  WithContentDisposition set Content-Disposition,
  WithContentLanguage set Content-Language,
  WithContentEncoding set Content-Encoding,
  WithCacheControl set Cache-Control,
  WithExpires set Expires,
  WithMeta set meta header(s),

Deprecated: use CopyObject of ClientV2 instead

func (*Bucket) CopyObjectFrom deprecated

func (bkt *Bucket) CopyObjectFrom(ctx context.Context, srcBucket, srcObjectKey, dstObjectKey string, options ...Option) (*CopyObjectOutput, error)

CopyObjectFrom copy an object from target bucket

srcBucket: the srcBucket bucket
srcObjectKey: the source object name
dstObjectKey: the destination object name
options: WithVersionID the version id of source object,
  WithMetadataDirective copy source object metadata or replace with new object metadata
  WithACL WithACLGrantFullControl WithACLGrantRead WithACLGrantReadAcp WithACLGrantWrite WithACLGrantWriteAcp set object acl,
  WithCopySourceIfMatch WithCopySourceIfNoneMatch WithCopySourceIfModifiedSince WithCopySourceIfUnmodifiedSince set copy conditions
if CopyObjectFrom called with WithMetadataDirective(tos.MetadataDirectiveReplace), these options can be used:
  WithContentType set Content-Type,
  WithContentDisposition set Content-Disposition,
  WithContentLanguage set Content-Language,
  WithContentEncoding set Content-Encoding,
  WithCacheControl set Cache-Control,
  WithExpires set Expires,
  WithMeta set meta header(s),

Deprecated: use CopyObject of ClientV2 instead

func (*Bucket) CopyObjectTo deprecated

func (bkt *Bucket) CopyObjectTo(ctx context.Context, dstBucket, dstObjectKey, srcObjectKey string, options ...Option) (*CopyObjectOutput, error)

CopyObjectTo copy an object to target bucket

dstBucket: the destination bucket
dstObjectKey: the destination object name
srcObjectKey: the source object name
options: WithVersionID the version id of source object,
  WithMetadataDirective copy source object metadata or replace with new object metadata.
  WithACL WithACLGrantFullControl WithACLGrantRead WithACLGrantReadAcp WithACLGrantWrite WithACLGrantWriteAcp set object acl,
  WithCopySourceIfMatch WithCopySourceIfNoneMatch WithCopySourceIfModifiedSince WithCopySourceIfUnmodifiedSince set copy conditions
if CopyObjectTo called with WithMetadataDirective(tos.MetadataDirectiveReplace), these options can be used:
  WithContentType set Content-Type,
  WithContentDisposition set Content-Disposition,
  WithContentLanguage set Content-Language,
  WithContentEncoding set Content-Encoding,
  WithCacheControl set Cache-Control,
  WithExpires set Expires,
  WithMeta set meta header(s),

Deprecated: use CopyObject of ClientV2 instead

func (*Bucket) CreateMultipartUpload deprecated

func (bkt *Bucket) CreateMultipartUpload(ctx context.Context, objectKey string, options ...Option) (*CreateMultipartUploadOutput, error)

CreateMultipartUpload create a multipart upload operation

objectKey: the name of object
options: WithContentType set Content-Type,
  WithContentDisposition set Content-Disposition,
  WithContentLanguage set Content-Language,
  WithContentEncoding set Content-Encoding,
  WithCacheControl set Cache-Control,
  WithExpires set Expires,
  WithMeta set meta header(s),
  WithContentSHA256 set Content-Sha256,
  WithContentMD5 set Content-MD5
  WithExpires set Expires,
  WithServerSideEncryptionCustomer set server side encryption options
  WithACL WithACLGrantFullControl WithACLGrantRead WithACLGrantReadAcp WithACLGrantWrite WithACLGrantWriteAcp set object acl

Deprecated: use CreateMultipartUpload of ClientV2 instead

func (*Bucket) DeleteMultiObjects deprecated

func (bkt *Bucket) DeleteMultiObjects(ctx context.Context, input *DeleteMultiObjectsInput, options ...Option) (*DeleteMultiObjectsOutput, error)

DeleteMultiObjects delete multi-objects

input: the objects will be deleted

Deprecated: use DeleteMultiObjects of ClientV2 instead

func (*Bucket) DeleteObject deprecated

func (bkt *Bucket) DeleteObject(ctx context.Context, objectKey string, options ...Option) (*DeleteObjectOutput, error)

DeleteObject delete an object

objectKey: the name of object
options: WithVersionID which version of this object will be deleted

Deprecated: use DeleteObject of ClientV2 instead

func (*Bucket) DeleteObjectTagging added in v2.6.2

func (bkt *Bucket) DeleteObjectTagging(ctx context.Context, input *DeleteObjectTaggingInput, option ...Option) (*DeleteObjectTaggingOutput, error)

func (*Bucket) FetchObject

func (bkt *Bucket) FetchObject(ctx context.Context, input *FetchObjectInput, options ...Option) (*FetchObjectOutput, error)

FetchObject fetch an object from specified URL options:

WithMeta set meta header(s)
WithServerSideEncryptionCustomer set server side encryption options
WithACL WithACLGrantFullControl WithACLGrantRead WithACLGrantReadAcp WithACLGrantWrite WithACLGrantWriteAcp set object acl

Calling FetchObject will be blocked util fetch operation is finished

func (*Bucket) GetFetchTask added in v2.1.8

func (bkt *Bucket) GetFetchTask(ctx context.Context, input *GetFetchTaskInput, options ...Option) (*GetFetchTaskOutput, error)

GetFetchTask query the task state by the TaskID Task state:

FetchTaskStateFailed  = "Failed"
FetchTaskStateSucceed = "Succeed"
FetchTaskStateExpired = "Expired"
FetchTaskStateRunning = "Running"

func (*Bucket) GetObject deprecated

func (bkt *Bucket) GetObject(ctx context.Context, objectKey string, options ...Option) (*GetObjectOutput, error)

GetObject get data and metadata of an object

objectKey: the name of object
options: WithVersionID which version of this object
  WithRange the range of content,
  WithIfModifiedSince return if the object modified after the given date, otherwise return status code 304
  WithIfUnmodifiedSince, WithIfMatch, WithIfNoneMatch set If-Unmodified-Since, If-Match and If-None-Match

Deprecated: use GetObject of ClientV2 instead

func (*Bucket) GetObjectAcl deprecated

func (bkt *Bucket) GetObjectAcl(ctx context.Context, objectKey string, options ...Option) (*GetObjectAclOutput, error)

GetObjectAcl get object ACL

objectKey: the name of object
Options: WithVersionID the version of the object

Deprecated: use GetObjectACL of ClientV2 instead

func (*Bucket) GetObjectTagging added in v2.6.2

func (bkt *Bucket) GetObjectTagging(ctx context.Context, input *GetObjectTaggingInput, option ...Option) (*GetObjectTaggingOutput, error)

func (*Bucket) HeadObject deprecated

func (bkt *Bucket) HeadObject(ctx context.Context, objectKey string, options ...Option) (*HeadObjectOutput, error)

HeadObject get metadata of an object

objectKey: the name of object
options: WithVersionID which version of this object
  WithRange the range of content,
  WithIfModifiedSince return if the object modified after the given date, otherwise return status code 304
  WithIfUnmodifiedSince, WithIfMatch, WithIfNoneMatch set If-Unmodified-Since, If-Match and If-None-Match

Deprecated: use HeadObject of ClientV2 instead

func (*Bucket) ListMultipartUploads deprecated

func (bkt *Bucket) ListMultipartUploads(ctx context.Context, input *ListMultipartUploadsInput, options ...Option) (*ListMultipartUploadsOutput, error)

ListMultipartUploads list multipart uploads

Deprecated: use ListMultipartUploads of ClientV2 instead

func (*Bucket) ListObjectVersions deprecated

func (bkt *Bucket) ListObjectVersions(ctx context.Context, input *ListObjectVersionsInput, options ...Option) (*ListObjectVersionsOutput, error)

ListObjectVersions list multi-version objects of a bucket

Deprecated: use ListObjectV2Versions of ClientV2 instead

func (*Bucket) ListObjects deprecated

func (bkt *Bucket) ListObjects(ctx context.Context, input *ListObjectsInput, options ...Option) (*ListObjectsOutput, error)

ListObjects list objects of a bucket

Deprecated: use ListObjectsV2 of ClientV2 instead

func (*Bucket) ListUploadedParts deprecated

func (bkt *Bucket) ListUploadedParts(ctx context.Context, input *ListUploadedPartsInput, options ...Option) (*ListUploadedPartsOutput, error)

ListUploadedParts List Uploaded Parts

objectKey: the object name
input: key, uploadID and other parameters

Deprecated: use ListParts of ClientV2 instead

func (*Bucket) PutFetchTask added in v2.1.8

func (bkt *Bucket) PutFetchTask(ctx context.Context, input *PutFetchTaskInput, options ...Option) (*PutFetchTaskOutput, error)

PutFetchTask put a fetch task to a bucket options:

WithMeta set meta header(s)
WithServerSideEncryptionCustomer set server side encryption options
WithACL WithACLGrantFullControl WithACLGrantRead WithACLGrantReadAcp WithACLGrantWrite WithACLGrantWriteAcp set object acl

Calling PutFetchTask will return immediately after the task created.

func (*Bucket) PutObject deprecated

func (bkt *Bucket) PutObject(ctx context.Context, objectKey string, content io.Reader, options ...Option) (*PutObjectOutput, error)

PutObject put an object

objectKey: the name of object
content: the content of object
options: WithContentType set Content-Type,
  WithContentDisposition set Content-Disposition,
  WithContentLanguage set Content-Language,
  WithContentEncoding set Content-Encoding,
  WithCacheControl set Cache-Control,
  WithExpires set Expires,
  WithMeta set meta header(s),
  WithContentSHA256 set Content-Sha256,
  WithContentMD5 set Content-MD5
  WithExpires set Expires,
  WithServerSideEncryptionCustomer set server side encryption options
  WithACL WithACLGrantFullControl WithACLGrantRead WithACLGrantReadAcp WithACLGrantWrite WithACLGrantWriteAcp set object acl

NOTICE: only content with a known length is supported now,

e.g, bytes.Buffer, bytes.Reader, strings.Reader, os.File, io.LimitedReader, net.Buffers.
if the parameter content(an io.Reader) is not one of these,
please use io.LimitReader(reader, length) to wrap this reader or use the WithContentLength option.

Deprecated: use PutObjectV2 of ClientV2 instead

func (*Bucket) PutObjectAcl deprecated

func (bkt *Bucket) PutObjectAcl(ctx context.Context, input *PutObjectAclInput, options ...Option) (*PutObjectAclOutput, error)

PutObjectAcl AclGrant, AclRules can not set both.

Deprecated: ues PutObjectACL of ClientV2 instead

func (*Bucket) PutObjectTagging added in v2.6.2

func (bkt *Bucket) PutObjectTagging(ctx context.Context, input *PutObjectTaggingInput, option ...Option) (*PutObjectTaggingOutput, error)

func (*Bucket) RestoreObject added in v2.6.2

func (bkt *Bucket) RestoreObject(ctx context.Context, input *RestoreObjectInput, option ...Option) (*RestoreObjectOutput, error)

func (*Bucket) SetObjectMeta deprecated

func (bkt *Bucket) SetObjectMeta(ctx context.Context, objectKey string, options ...Option) (*SetObjectMetaOutput, error)

SetObjectMeta overwrites metadata of the object

objectKey: the name of object
options: WithContentType set Content-Type,
  WithContentDisposition set Content-Disposition,
  WithContentLanguage set Content-Language,
  WithContentEncoding set Content-Encoding,
  WithCacheControl set Cache-Control,
  WithExpires set Expires,
  WithMeta set meta header(s),
  WithVersionID which version of this object will be set

NOTICE: SetObjectMeta always overwrites all previous metadata

Deprecated: use SetObjectMeta of ClientV2 instead

func (*Bucket) UploadPart deprecated

func (bkt *Bucket) UploadPart(ctx context.Context, input *UploadPartInput, options ...Option) (*UploadPartOutput, error)

UploadPart upload a part for a multipart upload operation input: the parameters, some fields is required, e.g. Key, UploadID, PartNumber and PartNumber

If uploading 'Content' with known Content-Length, please add option tos.WithContentLength

Deprecated: use UploadPart of ClientV2 instead

func (*Bucket) UploadPartCopy deprecated

func (bkt *Bucket) UploadPartCopy(ctx context.Context, input *UploadPartCopyInput, options ...Option) (*UploadPartCopyOutput, error)

UploadPartCopy copy a part of object as a part of a multipart upload operation

input: uploadID, DestinationKey, SourceBucket, SourceKey and other parameters,
options: WithCopySourceIfMatch WithCopySourceIfNoneMatch WithCopySourceIfModifiedSince WithCopySourceIfUnmodifiedSince set copy conditions

Deprecated: use UploadPartCopy of ClientV2 instead

type BucketPolicy

type BucketPolicy struct {
	Policy string `json:"Policy,omitempty"`
}

type CancelHook

type CancelHook interface {
	// Cancel 取消断点上传\断点下载事, isAbort 为 true 时删除上下文信息和临时文件,为 false 时只是中断当前执行,该接口只能调用一次
	Cancel(isAbort bool)
	// contains filtered or unexported methods
}

func NewCancelHook added in v2.2.0

func NewCancelHook() CancelHook

type ChecksumError

type ChecksumError struct {
	RequestID        string `json:"RequestId,omitempty"`
	ExpectedChecksum string `json:"ExpectedChecksum,omitempty"`
	ActualChecksum   string `json:"ActualChecksum,omitempty"`
}

func (*ChecksumError) Error

func (ce *ChecksumError) Error() string

type Client deprecated

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

Client TOS Client use NewClient to create a new Client

example:

client, err := NewClient(endpoint, WithCredentials(credentials), WithRegion(region))
if err != nil {
   // ...
}
// do something

if you only access the public bucket:

client, err := NewClient(endpoint)
// do something

Deprecated: use ClientV2 instead

func NewClient

func NewClient(endpoint string, options ...ClientOption) (*Client, error)

NewClient create a new Tos Client

endpoint: access endpoint
options: WithCredentials set Credentials
  WithRegion set region, this is required if WithCredentials is used
  WithSocketTimeout set read-write timeout
  WithTransportConfig set TransportConfig
  WithTransport set self-defined Transport

func (*Client) Bucket deprecated

func (cli *Client) Bucket(bucket string) (*Bucket, error)

Bucket create a Bucket handle

Deprecated: request with bucket handle is deprecated, use ClientV2 instead

func (*Client) CreateBucket deprecated

func (cli *Client) CreateBucket(ctx context.Context, input *CreateBucketInput) (*CreateBucketOutput, error)

CreateBucket create a bucket

Deprecated: use CreateBucket of ClientV2 instead

func (*Client) DeleteBucket deprecated

func (cli *Client) DeleteBucket(ctx context.Context, bucket string) (*DeleteBucketOutput, error)

DeleteBucket delete a bucket

Deprecated: use DeleteBucket of ClientV2 instead

func (*Client) DeleteBucketPolicy

func (cli *Client) DeleteBucketPolicy(ctx context.Context, bucket string) (*DeleteBucketPolicyOutput, error)

DeleteBucketPolicy delete bucket access policy

func (*Client) GetBucketPolicy

func (cli *Client) GetBucketPolicy(ctx context.Context, bucket string) (*GetBucketPolicyOutput, error)

GetBucketPolicy get bucket access policy

func (*Client) GetBucketVersioning

func (cli *Client) GetBucketVersioning(ctx context.Context, bucket string) (*GetBucketVersioningOutput, error)

GetBucketVersioning get the multi-version status of a bucket

func (*Client) HeadBucket deprecated

func (cli *Client) HeadBucket(ctx context.Context, bucket string) (*HeadBucketOutput, error)

HeadBucket get some info of a bucket

Deprecated: use HeadBucket of ClientV2 instead

func (*Client) ListBuckets deprecated

func (cli *Client) ListBuckets(ctx context.Context, _ *ListBucketsInput) (*ListBucketsOutput, error)

ListBuckets list the buckets that the AK can access

Deprecated: use ListBuckets of ClientV2 instead

func (*Client) PreSignedURL

func (cli *Client) PreSignedURL(httpMethod string, bucket, objectKey string, ttl time.Duration, options ...Option) (string, error)

PreSignedURL return pre-signed url

 httpMethod: HTTP method, {
   PutObject: http.MethodPut
   GetObject: http.MethodGet
   HeadObject: http.MethodHead
   DeleteObject: http.MethodDelete
 },
 bucket: the bucket name
 objectKey: the object name
 ttl: the time-to-live of signed URL
 options: WithVersionID the version id of the object
Deprecated: use PreSignedURL of ClientV2 instead

func (*Client) PutBucketPolicy

func (cli *Client) PutBucketPolicy(ctx context.Context, bucket string, policy *BucketPolicy) (*PutBucketPolicyOutput, error)

PutBucketPolicy set bucket access policy

type ClientOption

type ClientOption func(*Client)

func WithAutoRecognizeContentType

func WithAutoRecognizeContentType(enable bool) ClientOption

WithAutoRecognizeContentType set to recognize Content-Type or not, the default is enabled.

func WithConnectionTimeout

func WithConnectionTimeout(timeout time.Duration) ClientOption

WithConnectionTimeout set timeout for constructing connection

func WithContentTypeRecognizer

func WithContentTypeRecognizer(recognizer ContentTypeRecognizer) ClientOption

WithContentTypeRecognizer set ContentTypeRecognizer to recognize Content-Type, the default is ExtensionBasedContentTypeRecognizer

func WithCredentials

func WithCredentials(credentials Credentials) ClientOption

WithCredentials set Credentials

see StaticCredentials, WithoutSecretKeyCredentials and FederationCredentials

func WithCustomDomain added in v2.6.0

func WithCustomDomain(isCustomDomain bool) ClientOption

func WithDNSCacheTime added in v2.3.0

func WithDNSCacheTime(dnsCacheTime int) ClientOption

WithDNSCacheTime set dnsCacheTime in Minute

func WithDisableEncodingMeta added in v2.6.3

func WithDisableEncodingMeta(disable bool) ClientOption

func WithEnableCRC added in v2.2.0

func WithEnableCRC(enableCRC bool) ClientOption

WithEnableCRC set if check crc after uploading object. Checking crc is enabled by default.

func WithEnableVerifySSL

func WithEnableVerifySSL(enable bool) ClientOption

WithEnableVerifySSL set whether a client verifies the server's certificate chain and host name.

func WithHTTPTransport added in v2.1.1

func WithHTTPTransport(transport http.RoundTripper) ClientOption

WithHTTPTransport set Transport of http.Client

func WithHighLatencyLogThreshold added in v2.6.5

func WithHighLatencyLogThreshold(highLatencyLogThreshold int) ClientOption

With the HighLatencyLogThreshold set and assuming the unit is in kilobytes (KB)

func WithIdleConnTimeout

func WithIdleConnTimeout(timeout time.Duration) ClientOption

WithIdleConnTimeout set max idle time of a http connection

func WithLogger added in v2.2.0

func WithLogger(logger Logger) ClientOption

WithLogger sets the tos sdk logger

func WithMaxConnections

func WithMaxConnections(max int) ClientOption

WithMaxConnections set maximum number of http connections

func WithMaxRetryCount added in v2.2.0

func WithMaxRetryCount(retryCount int) ClientOption

// WithMaxRetryCount set MaxRetryCount

func WithPathAccessMode deprecated

func WithPathAccessMode(pathAccessMode bool) ClientOption

WithPathAccessMode url mode is path model or default mode

Deprecated: This option is deprecated. Setting PathAccessMode will be ignored silently.

func WithProxy added in v2.3.0

func WithProxy(proxy *Proxy) ClientOption

WithProxy set http Proxy for tos client

func WithRegion

func WithRegion(region string) ClientOption

WithRegion set region

func WithRequestTimeout

func WithRequestTimeout(timeout time.Duration) ClientOption

WithRequestTimeout set timeout for single http request

func WithSigner

func WithSigner(signer Signer) ClientOption

WithSigner for self-defined Signer

func WithSocketTimeout

func WithSocketTimeout(readTimeout, writeTimeout time.Duration) ClientOption

WithSocketTimeout set read-write timeout

func WithTransport deprecated

func WithTransport(transport Transport) ClientOption

WithTransport set Transport

Deprecated: this function is Deprecated. If you want to set http.Transport use WithHTTPTransport instead

func WithTransportConfig

func WithTransportConfig(config *TransportConfig) ClientOption

WithTransportConfig set TransportConfig

func WithUserAgentSuffix

func WithUserAgentSuffix(suffix string) ClientOption

WithUserAgentSuffix set suffix of user-agent

type ClientV2

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

ClientV2 TOS ClientV2 use NewClientV2 to create a new ClientV2

example:

client, err := NewClientV2(endpoint, WithCredentials(credentials), WithRegion(region))
if err != nil {
   // ...
}
// do something

if you only access the public bucket:

client, err := NewClientV2(endpoint)
// do something

func NewClientV2

func NewClientV2(endpoint string, options ...ClientOption) (*ClientV2, error)

NewClientV2 create a new Tos ClientV2

endpoint: access endpoint
options: WithCredentials set Credentials
  WithRegion set region, this is required if WithCredentials is used.
  If Region is supported and the Endpoint parameter is not set, the Endpoint will be resolved automatically
  WithSocketTimeout set read-write timeout
  WithTransportConfig set TransportConfig
  WithTransport set self-defined Transport
  WithLogger set self-defined Logger
  WithEnableCRC set CRC switch.
  WithMaxRetryCount  set Max Retry Count

func (*ClientV2) AbortMultipartUpload

func (cli *ClientV2) AbortMultipartUpload(ctx context.Context, input *AbortMultipartUploadInput) (*AbortMultipartUploadOutput, error)

AbortMultipartUpload abort a multipart upload operation

func (*ClientV2) AppendObjectV2

func (cli *ClientV2) AppendObjectV2(ctx context.Context, input *AppendObjectV2Input) (*AppendObjectV2Output, error)

AppendObjectV2 append content at the tail of an appendable object

func (*ClientV2) Close added in v2.1.2

func (cli *ClientV2) Close()

func (*ClientV2) CompleteMultipartUploadV2

func (cli *ClientV2) CompleteMultipartUploadV2(
	ctx context.Context, input *CompleteMultipartUploadV2Input) (*CompleteMultipartUploadV2Output, error)

CompleteMultipartUploadV2 complete a multipart upload operation

func (*ClientV2) CopyObject

func (cli *ClientV2) CopyObject(ctx context.Context, input *CopyObjectInput) (*CopyObjectOutput, error)

CopyObject copy an object

func (*ClientV2) CreateBucketV2

func (cli *ClientV2) CreateBucketV2(ctx context.Context, input *CreateBucketV2Input) (*CreateBucketV2Output, error)

CreateBucketV2 create a bucket

func (*ClientV2) CreateMultipartUploadV2

func (cli *ClientV2) CreateMultipartUploadV2(
	ctx context.Context,
	input *CreateMultipartUploadV2Input) (*CreateMultipartUploadV2Output, error)

CreateMultipartUploadV2 create a multipart upload operation

func (*ClientV2) DeleteBucket

func (cli *ClientV2) DeleteBucket(ctx context.Context, input *DeleteBucketInput) (*DeleteBucketOutput, error)

DeleteBucket delete a bucket.Deleting a non-empty bucket is not allowed. A bucket is empty only if there is no exist object and uncanceled segmented tasks.

func (*ClientV2) DeleteBucketCORS added in v2.1.10

func (cli *ClientV2) DeleteBucketCORS(ctx context.Context, input *DeleteBucketCORSInput) (*DeleteBucketCORSOutput, error)

DeleteBucketCORS delete the bucket's all CORS settings.

func (*ClientV2) DeleteBucketCustomDomain added in v2.5.0

func (cli *ClientV2) DeleteBucketCustomDomain(ctx context.Context, input *DeleteBucketCustomDomainInput) (*DeleteBucketCustomDomainOutput, error)

func (*ClientV2) DeleteBucketLifecycle added in v2.4.0

func (cli *ClientV2) DeleteBucketLifecycle(ctx context.Context, input *DeleteBucketLifecycleInput) (*DeleteBucketLifecycleOutput, error)

func (*ClientV2) DeleteBucketMirrorBack added in v2.4.0

func (cli *ClientV2) DeleteBucketMirrorBack(ctx context.Context, input *DeleteBucketMirrorBackInput) (*DeleteBucketMirrorBackOutput, error)

func (*ClientV2) DeleteBucketPolicyV2 added in v2.4.0

func (cli *ClientV2) DeleteBucketPolicyV2(ctx context.Context, input *DeleteBucketPolicyV2Input) (*DeleteBucketPolicyV2Output, error)

func (*ClientV2) DeleteBucketRealTimeLog added in v2.5.0

func (cli *ClientV2) DeleteBucketRealTimeLog(ctx context.Context, input *DeleteBucketRealTimeLogInput) (*DeleteBucketRealTimeLogOutput, error)

func (*ClientV2) DeleteBucketRename added in v2.5.4

func (cli *ClientV2) DeleteBucketRename(ctx context.Context, input *DeleteBucketRenameInput) (*DeleteBucketRenameOutput, error)

func (*ClientV2) DeleteBucketReplication added in v2.5.0

func (cli *ClientV2) DeleteBucketReplication(ctx context.Context, input *DeleteBucketReplicationInput) (*DeleteBucketReplicationOutput, error)

func (*ClientV2) DeleteBucketTagging added in v2.6.6

func (cli *ClientV2) DeleteBucketTagging(ctx context.Context, input *DeleteBucketTaggingInput) (*DeleteBucketTaggingOutput, error)

func (*ClientV2) DeleteBucketWebsite added in v2.5.0

func (cli *ClientV2) DeleteBucketWebsite(ctx context.Context, input *DeleteBucketWebsiteInput) (*DeleteBucketWebsiteOutput, error)

func (*ClientV2) DeleteMultiObjects

func (cli *ClientV2) DeleteMultiObjects(ctx context.Context, input *DeleteMultiObjectsInput) (*DeleteMultiObjectsOutput, error)

DeleteMultiObjects delete multi-objects

func (*ClientV2) DeleteObjectTagging added in v2.4.0

func (cli *ClientV2) DeleteObjectTagging(ctx context.Context, input *DeleteObjectTaggingInput) (*DeleteObjectTaggingOutput, error)

func (*ClientV2) DeleteObjectV2

func (cli *ClientV2) DeleteObjectV2(ctx context.Context, input *DeleteObjectV2Input) (*DeleteObjectV2Output, error)

DeleteObjectV2 delete an object

func (*ClientV2) DownloadFile added in v2.2.0

func (cli *ClientV2) DownloadFile(ctx context.Context, input *DownloadFileInput) (*DownloadFileOutput, error)

func (*ClientV2) FetchObjectV2 added in v2.4.0

func (cli *ClientV2) FetchObjectV2(ctx context.Context, input *FetchObjectInputV2) (*FetchObjectOutputV2, error)

func (*ClientV2) GetBucketACL added in v2.4.0

func (cli *ClientV2) GetBucketACL(ctx context.Context, input *GetBucketACLInput) (*GetBucketACLOutput, error)

func (*ClientV2) GetBucketCORS added in v2.1.10

func (cli *ClientV2) GetBucketCORS(ctx context.Context, input *GetBucketCORSInput) (*GetBucketCORSOutput, error)

GetBucketCORS get the bucket's CORS settings.

func (*ClientV2) GetBucketLifecycle added in v2.4.0

func (cli *ClientV2) GetBucketLifecycle(ctx context.Context, input *GetBucketLifecycleInput) (*GetBucketLifecycleOutput, error)

func (*ClientV2) GetBucketLocation added in v2.4.0

func (cli *ClientV2) GetBucketLocation(ctx context.Context, input *GetBucketLocationInput) (*GetBucketLocationOutput, error)

func (*ClientV2) GetBucketMirrorBack added in v2.4.0

func (cli *ClientV2) GetBucketMirrorBack(ctx context.Context, input *GetBucketMirrorBackInput) (*GetBucketMirrorBackOutput, error)

func (*ClientV2) GetBucketNotification added in v2.5.0

func (cli *ClientV2) GetBucketNotification(ctx context.Context, input *GetBucketNotificationInput) (*GetBucketNotificationOutput, error)

func (*ClientV2) GetBucketNotificationType2 added in v2.6.6

func (cli *ClientV2) GetBucketNotificationType2(ctx context.Context, input *GetBucketNotificationType2Input) (*GetBucketNotificationType2Output, error)

func (*ClientV2) GetBucketPolicyV2 added in v2.4.0

func (cli *ClientV2) GetBucketPolicyV2(ctx context.Context, input *GetBucketPolicyV2Input) (*GetBucketPolicyV2Output, error)

func (*ClientV2) GetBucketRealTimeLog added in v2.5.0

func (cli *ClientV2) GetBucketRealTimeLog(ctx context.Context, input *GetBucketRealTimeLogInput) (*GetBucketRealTimeLogOutput, error)

func (*ClientV2) GetBucketRename added in v2.5.4

func (cli *ClientV2) GetBucketRename(ctx context.Context, input *GetBucketRenameInput) (*GetBucketRenameOutput, error)

func (*ClientV2) GetBucketReplication added in v2.5.0

func (cli *ClientV2) GetBucketReplication(ctx context.Context, input *GetBucketReplicationInput) (*GetBucketReplicationOutput, error)

func (*ClientV2) GetBucketTagging added in v2.6.6

func (cli *ClientV2) GetBucketTagging(ctx context.Context, input *GetBucketTaggingInput) (*GetBucketTaggingOutput, error)

func (*ClientV2) GetBucketVersioning added in v2.5.0

func (cli *ClientV2) GetBucketVersioning(ctx context.Context, input *GetBucketVersioningInput) (*GetBucketVersioningOutputV2, error)

func (*ClientV2) GetBucketWebsite added in v2.5.0

func (cli *ClientV2) GetBucketWebsite(ctx context.Context, input *GetBucketWebsiteInput) (*GetBucketWebsiteOutput, error)

func (*ClientV2) GetObjectACL

func (cli *ClientV2) GetObjectACL(ctx context.Context, input *GetObjectACLInput) (*GetObjectACLOutput, error)

GetObjectACL get object ACL

func (*ClientV2) GetObjectTagging added in v2.4.0

func (cli *ClientV2) GetObjectTagging(ctx context.Context, input *GetObjectTaggingInput) (*GetObjectTaggingOutput, error)

func (*ClientV2) GetObjectToFile

func (cli *ClientV2) GetObjectToFile(ctx context.Context, input *GetObjectToFileInput) (*GetObjectToFileOutput, error)

GetObjectToFile get object and write it to file

func (*ClientV2) GetObjectV2

func (cli *ClientV2) GetObjectV2(ctx context.Context, input *GetObjectV2Input) (*GetObjectV2Output, error)

GetObjectV2 get data and metadata of an object

func (*ClientV2) HeadBucket

func (cli *ClientV2) HeadBucket(ctx context.Context, input *HeadBucketInput) (*HeadBucketOutput, error)

HeadBucket get some info of a bucket

func (*ClientV2) HeadObjectV2

func (cli *ClientV2) HeadObjectV2(ctx context.Context, input *HeadObjectV2Input) (*HeadObjectV2Output, error)

HeadObjectV2 get metadata of an object

func (*ClientV2) ListBucketCustomDomain added in v2.5.0

func (cli *ClientV2) ListBucketCustomDomain(ctx context.Context, input *ListBucketCustomDomainInput) (*ListBucketCustomDomainOutput, error)

func (*ClientV2) ListBuckets added in v2.1.5

func (cli *ClientV2) ListBuckets(ctx context.Context, _ *ListBucketsInput) (*ListBucketsOutput, error)

ListBuckets list the buckets that the AK can access

func (*ClientV2) ListMultipartUploadsV2

func (cli *ClientV2) ListMultipartUploadsV2(
	ctx context.Context,
	input *ListMultipartUploadsV2Input) (*ListMultipartUploadsV2Output, error)

ListMultipartUploadsV2 list multipart uploads

func (*ClientV2) ListObjectVersionsV2

func (cli *ClientV2) ListObjectVersionsV2(
	ctx context.Context,
	input *ListObjectVersionsV2Input) (*ListObjectVersionsV2Output, error)

ListObjectVersionsV2 list multi-version objects of a bucket

func (*ClientV2) ListObjectsType2 added in v2.4.0

func (cli *ClientV2) ListObjectsType2(ctx context.Context, input *ListObjectsType2Input) (*ListObjectsType2Output, error)

func (*ClientV2) ListObjectsV2

func (cli *ClientV2) ListObjectsV2(ctx context.Context, input *ListObjectsV2Input) (*ListObjectsV2Output, error)

ListObjectsV2 list objects of a bucket Deprecated: use ListObjectsType2 of ClientV2 instead

func (*ClientV2) ListParts

func (cli *ClientV2) ListParts(ctx context.Context, input *ListPartsInput) (*ListPartsOutput, error)

ListParts List Uploaded Parts

func (*ClientV2) PreSignedPolicyURL added in v2.4.5

func (cli *ClientV2) PreSignedPolicyURL(ctx context.Context, input *PreSingedPolicyURLInput) (*PreSingedPolicyURLOutput, error)

func (*ClientV2) PreSignedPostSignature added in v2.4.0

func (cli *ClientV2) PreSignedPostSignature(ctx context.Context, input *PreSingedPostSignatureInput) (*PreSingedPostSignatureOutput, error)

func (*ClientV2) PreSignedURL

func (cli *ClientV2) PreSignedURL(input *PreSignedURLInput) (*PreSignedURLOutput, error)

PreSignedURL return pre-signed url

func (*ClientV2) PutBucketACL added in v2.4.0

func (cli *ClientV2) PutBucketACL(ctx context.Context, input *PutBucketACLInput) (*PutBucketACLOutput, error)

func (*ClientV2) PutBucketCORS added in v2.1.10

func (cli *ClientV2) PutBucketCORS(ctx context.Context, input *PutBucketCORSInput) (*PutBucketCORSOutput, error)

PutBucketCORS upsert the bucket's CORS settings.

func (*ClientV2) PutBucketCustomDomain added in v2.5.0

func (cli *ClientV2) PutBucketCustomDomain(ctx context.Context, input *PutBucketCustomDomainInput) (*PutBucketCustomDomainOutput, error)

func (*ClientV2) PutBucketLifecycle added in v2.4.0

func (cli *ClientV2) PutBucketLifecycle(ctx context.Context, input *PutBucketLifecycleInput) (*PutLifecycleOutput, error)

func (*ClientV2) PutBucketMirrorBack added in v2.4.0

func (cli *ClientV2) PutBucketMirrorBack(ctx context.Context, input *PutBucketMirrorBackInput) (*PutBucketMirrorBackOutput, error)

func (*ClientV2) PutBucketNotification added in v2.5.0

func (cli *ClientV2) PutBucketNotification(ctx context.Context, input *PutBucketNotificationInput) (*PutBucketNotificationOutput, error)

func (*ClientV2) PutBucketNotificationType2 added in v2.6.6

func (cli *ClientV2) PutBucketNotificationType2(ctx context.Context, input *PutBucketNotificationType2Input) (*PutBucketNotificationType2Output, error)

func (*ClientV2) PutBucketPolicyV2 added in v2.4.0

func (cli *ClientV2) PutBucketPolicyV2(ctx context.Context, input *PutBucketPolicyV2Input) (*PutBucketPolicyV2Output, error)

func (*ClientV2) PutBucketRealTimeLog added in v2.5.0

func (cli *ClientV2) PutBucketRealTimeLog(ctx context.Context, input *PutBucketRealTimeLogInput) (*PutBucketRealTimeLogOutput, error)

func (*ClientV2) PutBucketRename added in v2.5.4

func (cli *ClientV2) PutBucketRename(ctx context.Context, input *PutBucketRenameInput) (*PutBucketRenameOutput, error)

func (*ClientV2) PutBucketReplication added in v2.5.0

func (cli *ClientV2) PutBucketReplication(ctx context.Context, input *PutBucketReplicationInput) (*PutBucketReplicationOutput, error)

func (*ClientV2) PutBucketStorageClass added in v2.4.0

func (cli *ClientV2) PutBucketStorageClass(ctx context.Context, input *PutBucketStorageClassInput) (*PutBucketStorageClassOutput, error)

func (*ClientV2) PutBucketTagging added in v2.6.6

func (cli *ClientV2) PutBucketTagging(ctx context.Context, input *PutBucketTaggingInput) (*PutBucketTaggingOutput, error)

func (*ClientV2) PutBucketVersioning added in v2.5.0

func (cli *ClientV2) PutBucketVersioning(ctx context.Context, input *PutBucketVersioningInput) (*PutBucketVersioningOutput, error)

func (*ClientV2) PutBucketWebsite added in v2.5.0

func (cli *ClientV2) PutBucketWebsite(ctx context.Context, input *PutBucketWebsiteInput) (*PutBucketWebsiteOutput, error)

func (*ClientV2) PutFetchTaskV2 added in v2.4.0

func (cli *ClientV2) PutFetchTaskV2(ctx context.Context, input *PutFetchTaskInputV2) (*PutFetchTaskOutputV2, error)

func (*ClientV2) PutObjectACL

func (cli *ClientV2) PutObjectACL(ctx context.Context, input *PutObjectACLInput) (*PutObjectACLOutput, error)

PutObjectACL put object ACL

func (*ClientV2) PutObjectFromFile

func (cli *ClientV2) PutObjectFromFile(ctx context.Context, input *PutObjectFromFileInput) (*PutObjectFromFileOutput, error)

PutObjectFromFile put an object from file

func (*ClientV2) PutObjectTagging added in v2.4.0

func (cli *ClientV2) PutObjectTagging(ctx context.Context, input *PutObjectTaggingInput) (*PutObjectTaggingOutput, error)

func (*ClientV2) PutObjectV2

func (cli *ClientV2) PutObjectV2(ctx context.Context, input *PutObjectV2Input) (*PutObjectV2Output, error)

PutObjectV2 put an object

func (*ClientV2) RenameObject added in v2.5.4

func (cli *ClientV2) RenameObject(ctx context.Context, input *RenameObjectInput) (*RenameObjectOutput, error)

func (*ClientV2) RestoreObject added in v2.6.0

func (cli *ClientV2) RestoreObject(ctx context.Context, input *RestoreObjectInput) (*RestoreObjectOutput, error)

func (*ClientV2) ResumableCopyObject added in v2.5.0

func (cli *ClientV2) ResumableCopyObject(ctx context.Context, input *ResumableCopyObjectInput) (*ResumableCopyObjectOutput, error)

func (*ClientV2) SetHTTPTransport added in v2.1.2

func (cli *ClientV2) SetHTTPTransport(transport http.RoundTripper)

func (*ClientV2) SetObjectMeta

func (cli *ClientV2) SetObjectMeta(ctx context.Context, input *SetObjectMetaInput) (*SetObjectMetaOutput, error)

SetObjectMeta overwrites metadata of the object

func (*ClientV2) UploadFile

func (cli *ClientV2) UploadFile(ctx context.Context, input *UploadFileInput) (output *UploadFileOutput, err error)

func (*ClientV2) UploadPartCopyV2

func (cli *ClientV2) UploadPartCopyV2(
	ctx context.Context,
	input *UploadPartCopyV2Input) (*UploadPartCopyV2Output, error)

UploadPartCopyV2 copy a part of object as a part of a multipart upload operation

func (*ClientV2) UploadPartFromFile

func (cli *ClientV2) UploadPartFromFile(ctx context.Context, input *UploadPartFromFileInput) (*UploadPartFromFileOutput, error)

UploadPartFromFile upload a part for a multipart upload operation from file

func (*ClientV2) UploadPartV2

func (cli *ClientV2) UploadPartV2(ctx context.Context, input *UploadPartV2Input) (*UploadPartV2Output, error)

UploadPartV2 upload a part for a multipart upload operation

type CloudFunctionConfiguration added in v2.5.0

type CloudFunctionConfiguration struct {
	ID            string   `json:"RuleId"`
	Events        []string `json:"Events"`
	Filter        Filter   `json:"Filter"`
	CloudFunction string   `json:"CloudFunction"`
}

type CommonHeaders

type CommonHeaders struct {
	ContentLength      int64        `location:"header" locationName:"Content-Length"`
	ContentMD5         string       `location:"header" locationName:"Content-MD5"`
	ContentSHA256      string       `location:"header" locationName:"X-Tos-Content-Sha256"`
	CacheControl       string       `location:"header" locationName:"Cache-Control"`
	ContentDisposition string       `location:"header" locationName:"Content-Disposition" encodeChinese:"true"`
	ContentEncoding    string       `location:"header" locationName:"Content-Encoding"`
	ContentLanguage    string       `location:"header" locationName:"Content-Language"`
	ContentType        string       `location:"header" locationName:"Content-Type"`
	Expires            time.Time    `location:"header" locationName:"Expires"`
	ACL                enum.ACLType `location:"header" locationName:"X-Tos-Acl"`

	GrantFullControl string `location:"header" locationName:"X-Tos-Grant-Full-Control"` // optional
	GrantRead        string `location:"header" locationName:"X-Tos-Grant-Read"`         // optional
	GrantReadAcp     string `location:"header" locationName:"X-Tos-Grant-Read-Acp"`     // optional
	GrantWriteAcp    string `location:"header" locationName:"X-Tos-Grant-Write-Acp"`    // optional

	WebsiteRedirectLocation string                `location:"header" locationName:"X-Tos-Website-Redirect-Location"`
	StorageClass            enum.StorageClassType `location:"header" locationName:"X-Tos-Storage-Class"`
}

type CompleteMultipartUploadInput

type CompleteMultipartUploadInput struct {
	Key           string                  `json:"Key,omitempty"`
	UploadID      string                  `json:"UploadId,omitempty"`
	UploadedParts []MultipartUploadedPart `json:"UploadedParts,omitempty"`
}

type CompleteMultipartUploadOutput

type CompleteMultipartUploadOutput struct {
	RequestInfo `json:"-"`
	VersionID   string `json:"VersionId,omitempty"`
}

type CompleteMultipartUploadV2Input

type CompleteMultipartUploadV2Input struct {
	Bucket          string
	Key             string
	CompleteAll     bool
	UploadID        string `location:"query" locationName:"uploadId"`
	Callback        string `location:"header" locationName:"X-Tos-Callback"`
	CallbackVar     string `location:"header" locationName:"X-Tos-Callback-Var"`
	ForbidOverwrite bool   `location:"header" locationName:"X-Tos-Forbid-Overwrite"`
	Parts           []UploadedPartV2
}

type CompleteMultipartUploadV2Output

type CompleteMultipartUploadV2Output struct {
	RequestInfo
	Bucket                    string
	Key                       string
	ETag                      string
	Location                  string
	CompletedParts            []UploadedPartV2
	VersionID                 string
	HashCrc64ecma             uint64
	CallbackResult            string
	ServerSideEncryption      string
	ServerSideEncryptionKeyID string
}

type Condition added in v2.4.0

type Condition struct {
	HttpCode  int    `json:"HttpCode,omitempty"`
	KeyPrefix string `json:"KeyPrefix,omitempty"`
	KeySuffix string `json:"KeySuffix,omitempty"`
}

type Config

type Config struct {
	Endpoint        string
	Region          string
	TransportConfig TransportConfig
}

type ContentLengthRange added in v2.4.0

type ContentLengthRange struct {
	RangeStart int64
	RangeEnd   int64
}

type ContentTypeRecognizer

type ContentTypeRecognizer interface {
	ContentType(objectKey string) string
}

type CopyEvent added in v2.5.0

type CopyEvent struct {
	Type enum.CopyEventType
	Err  error

	Bucket         string
	Key            string
	UploadID       *string
	SrcBucket      string
	SrcKey         string
	SrcVersionID   string
	CheckpointFile *string
	CopyPartInfo   *copyPartInfo
}

type CopyEventListener added in v2.5.0

type CopyEventListener interface {
	EventChange(event *CopyEvent)
}

type CopyObjectInput

type CopyObjectInput struct {
	Bucket             string
	Key                string
	SrcBucket          string
	SrcKey             string
	SrcVersionID       string       `location:"query" locationName:"versionId"`
	CacheControl       string       `location:"header" locationName:"Cache-Control"`
	ContentDisposition string       `location:"header" locationName:"Content-Disposition" encodeChinese:"true"`
	ContentEncoding    string       `location:"header" locationName:"Content-Encoding"`
	ContentLanguage    string       `location:"header" locationName:"Content-Language"`
	ContentType        string       `location:"header" locationName:"Content-Type"`
	Expires            time.Time    `location:"header" locationName:"Expires"`
	ACL                enum.ACLType `location:"header" locationName:"X-Tos-Acl"`

	GrantFullControl string `location:"header" locationName:"X-Tos-Grant-Full-Control"` // optional
	GrantRead        string `location:"header" locationName:"X-Tos-Grant-Read"`         // optional
	GrantReadAcp     string `location:"header" locationName:"X-Tos-Grant-Read-Acp"`     // optional
	GrantWriteAcp    string `location:"header" locationName:"X-Tos-Grant-Write-Acp"`    // optional

	WebsiteRedirectLocation string                `location:"header" locationName:"X-Tos-Website-Redirect-Location"`
	StorageClass            enum.StorageClassType `location:"header" locationName:"X-Tos-Storage-Class"`

	CopySourceIfMatch           string    `location:"header" locationName:"X-Tos-Copy-Source-If-Match"`
	CopySourceIfModifiedSince   time.Time `location:"header" locationName:"X-Tos-Copy-Source-If-Modified-Since"`
	CopySourceIfNoneMatch       string    `location:"header" locationName:"X-Tos-Copy-Source-If-None-Match"`
	CopySourceIfUnmodifiedSince time.Time `location:"header" locationName:"X-Tos-Copy-Source-If-Unmodified-Since"`

	CopySourceSSECAlgorithm   string `location:"header" locationName:"X-Tos-Copy-Source-Server-Side-Encryption-Customer-Algorithm"`
	CopySourceSSECKey         string `location:"header" locationName:"X-Tos-Copy-Source-Server-Side-Encryption-Customer-Key"`
	CopySourceSSECKeyMD5      string `location:"header" locationName:"X-Tos-Copy-Source-Server-Side-Encryption-Customer-Key-MD5"`
	ServerSideEncryption      string `location:"header" locationName:"X-Tos-Server-Side-Encryption"`
	ServerSideEncryptionKeyID string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Kms-Key-Id"`

	SSECKey           string                     `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key"`
	SSECKeyMD5        string                     `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key-MD5"`
	SSECAlgorithm     string                     `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Algorithm"`
	TrafficLimit      int64                      `location:"header" locationName:"X-Tos-Traffic-Limit"`
	ForbidOverwrite   bool                       `location:"header" locationName:"X-Tos-Forbid-Overwrite"`
	IfMatch           string                     `location:"header" locationName:"X-Tos-If-Match"`
	MetadataDirective enum.MetadataDirectiveType `location:"header" locationName:"X-Tos-Metadata-Directive"`
	Meta              map[string]string          `location:"headers"`
}

type CopyObjectOutput

type CopyObjectOutput struct {
	RequestInfo               `json:"-"`
	VersionID                 string `json:"VersionId,omitempty"`
	SourceVersionID           string `json:"SourceVersionId,omitempty"`
	ETag                      string `json:"ETag,omitempty"`         // at body
	LastModified              string `json:"LastModified,omitempty"` // at body
	SSECAlgorithm             string `json:"SSECAlgorithm,omitempty"`
	SSECKeyMD5                string `json:"SSECKeyMD5,omitempty"`
	ServerSideEncryption      string `json:"ServerSideEncryption,omitempty"`
	ServerSideEncryptionKeyID string `json:"ServerSideEncryptionKmsKeyId,omitempty"`
}

type CopyPartInfo added in v2.5.0

type CopyPartInfo struct {
	PartNumber           int
	CopySourceRangeStart int64
	CopySourceRangeEnd   int64

	// upload part copy succeed 时有值
	Etag *string
}

type CopySource

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

type CorsRule added in v2.1.10

type CorsRule struct {
	AllowedOrigin []string `json:"AllowedOrigins,omitempty"`
	AllowedMethod []string `json:"AllowedMethods,omitempty"`
	AllowedHeader []string `json:"AllowedHeaders,omitempty"`
	ExposeHeader  []string `json:"ExposeHeaders,omitempty"`
	MaxAgeSeconds int      `json:"MaxAgeSeconds,omitempty"`
}

type CreateBucketInput

type CreateBucketInput struct {
	Bucket           string `json:"Bucket,omitempty"`           // required
	ACL              string `json:"ACL,omitempty"`              // optional
	GrantFullControl string `json:"GrantFullControl,omitempty"` // optional
	GrantRead        string `json:"GrantRead,omitempty"`        // optional
	GrantReadAcp     string `json:"GrantReadAcp,omitempty"`     // optional
	GrantWrite       string `json:"GrantWrite,omitempty"`       // optional
	GrantWriteAcp    string `json:"GrantWriteAcp,omitempty"`    // optional
}

type CreateBucketOutput

type CreateBucketOutput struct {
	RequestInfo `json:"-"`
	Location    string `json:"Location,omitempty"`
}

type CreateBucketV2Input

type CreateBucketV2Input struct {
	Bucket           string                // required
	ACL              enum.ACLType          `location:"header" locationName:"X-Tos-Acl"`                // optional
	GrantFullControl string                `location:"header" locationName:"X-Tos-Grant-Full-Control"` // optional
	GrantRead        string                `location:"header" locationName:"X-Tos-Grant-Read"`         // optional
	GrantReadAcp     string                `location:"header" locationName:"X-Tos-Grant-Read-Acp"`     // optional
	GrantWrite       string                `location:"header" locationName:"X-Tos-Grant-Write"`        // optional
	GrantWriteAcp    string                `location:"header" locationName:"X-Tos-Grant-Write-Acp"`    // optional
	StorageClass     enum.StorageClassType `location:"header" locationName:"X-Tos-Storage-Class"`      // setting the default storage type for buckets
	AzRedundancy     enum.AzRedundancyType `location:"header" locationName:"X-Tos-Az-Redundancy"`      // setting the AZ type for buckets
}

type CreateBucketV2Output

type CreateBucketV2Output struct {
	CreateBucketOutput
}

type CreateMultipartUploadOutput

type CreateMultipartUploadOutput struct {
	RequestInfo          `json:"-"`
	Bucket               string `json:"Bucket,omitempty"`
	Key                  string `json:"Key,omitempty"`
	UploadID             string `json:"UploadId,omitempty"`
	SSECustomerAlgorithm string `json:"SSECustomerAlgorithm,omitempty"`
	SSECustomerKeyMD5    string `json:"SSECustomerKeyMD5,omitempty"`
}

type CreateMultipartUploadV2Input

type CreateMultipartUploadV2Input struct {
	Bucket             string
	Key                string
	EncodingType       string       `location:"query" locationName:"encoding-type"` // "" or "url"
	CacheControl       string       `location:"header" locationName:"Cache-Control"`
	ContentDisposition string       `location:"header" locationName:"Content-Disposition" encodeChinese:"true"`
	ContentEncoding    string       `location:"header" locationName:"Content-Encoding"`
	ContentLanguage    string       `location:"header" locationName:"Content-Language"`
	ContentType        string       `location:"header" locationName:"Content-Type"`
	Expires            time.Time    `location:"header" locationName:"Expires"`
	ACL                enum.ACLType `location:"header" locationName:"X-Tos-Acl"`

	GrantFullControl string `location:"header" locationName:"X-Tos-Grant-Full-Control"` // optional
	GrantRead        string `location:"header" locationName:"X-Tos-Grant-Read"`         // optional
	GrantReadAcp     string `location:"header" locationName:"X-Tos-Grant-Read-Acp"`     // optional
	GrantWriteAcp    string `location:"header" locationName:"X-Tos-Grant-Write-Acp"`    // optional

	WebsiteRedirectLocation   string                `location:"header" locationName:"X-Tos-Website-Redirect-Location"`
	StorageClass              enum.StorageClassType `location:"header" locationName:"X-Tos-Storage-Class"`
	SSECAlgorithm             string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Algorithm"`
	SSECKey                   string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key"`
	SSECKeyMD5                string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key-MD5"`
	ServerSideEncryption      string                `location:"header" locationName:"X-Tos-Server-Side-Encryption"`
	ServerSideEncryptionKeyID string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Kms-Key-Id"`
	ForbidOverwrite           bool                  `location:"header" locationName:"X-Tos-Forbid-Overwrite"`
	Meta                      map[string]string     `location:"headers"`
}

type CreateMultipartUploadV2Output

type CreateMultipartUploadV2Output struct {
	RequestInfo               `json:"-"`
	Bucket                    string `json:"Bucket,omitempty"`
	Key                       string `json:"Key,omitempty"`
	UploadID                  string `json:"UploadID,omitempty"`
	SSECAlgorithm             string `json:"SSECAlgorithm,omitempty"`
	SSECKeyMD5                string `json:"SSECKeyMD5,omitempty"`
	EncodingType              string `json:"EncodingType,omitempty"`
	ServerSideEncryption      string `json:"ServerSideEncryption,omitempty"`
	ServerSideEncryptionKeyID string `json:"ServerSideEncryptionKeyID,omitempty"`
}

type Credential

type Credential struct {
	AccessKeyID     string
	AccessKeySecret string
	SecurityToken   string
}

type Credentials

type Credentials interface {
	Credential() Credential
}

Credentials provides Credential

type CustomDomainRule added in v2.5.0

type CustomDomainRule struct {
	CertID          string              `json:"CertId"`
	CertStatus      enum.CertStatusType `json:"CertStatus"`
	Domain          string              `json:"Domain"`
	Forbidden       bool                `json:"Forbidden"`
	ForbiddenReason string              `json:"ForbiddenReason"`
	Cname           string              `json:"Cname"`
}

type CustomMeta added in v2.1.3

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

func (*CustomMeta) AllKeys added in v2.1.3

func (c *CustomMeta) AllKeys() []string

func (*CustomMeta) Get added in v2.1.3

func (c *CustomMeta) Get(key string) (val string, ok bool)

func (*CustomMeta) Range added in v2.1.3

func (c *CustomMeta) Range(f func(key, val string) bool)

type DataTransferListener

type DataTransferListener interface {
	DataTransferStatusChange(status *DataTransferStatus)
}

type DataTransferStatus

type DataTransferStatus struct {
	TotalBytes    int64
	ConsumedBytes int64 // bytes read/written
	RWOnceBytes   int64 // bytes read/written this time
	Type          enum.DataTransferType
}

type DefaultTransport

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

func NewDefaultTransport

func NewDefaultTransport(config *TransportConfig) *DefaultTransport

NewDefaultTransport create a DefaultTransport with config

func NewDefaultTransportWithClient

func NewDefaultTransportWithClient(client http.Client) *DefaultTransport

NewDefaultTransportWithClient crate a DefaultTransport with a http.Client

func (*DefaultTransport) RoundTrip

func (dt *DefaultTransport) RoundTrip(ctx context.Context, req *Request) (*Response, error)

func (*DefaultTransport) WithDefaultTransportLogger added in v2.2.0

func (d *DefaultTransport) WithDefaultTransportLogger(logger Logger)

type DeleteBucketCORSInput added in v2.1.10

type DeleteBucketCORSInput struct {
	Bucket string
}

type DeleteBucketCORSOutput added in v2.1.10

type DeleteBucketCORSOutput struct {
	RequestInfo `json:"-"`
}

type DeleteBucketCustomDomainInput added in v2.5.0

type DeleteBucketCustomDomainInput struct {
	Bucket string
	Domain string
}

type DeleteBucketCustomDomainOutput added in v2.5.0

type DeleteBucketCustomDomainOutput struct {
	RequestInfo
}

type DeleteBucketInput

type DeleteBucketInput struct {
	Bucket string
}

type DeleteBucketLifecycleInput added in v2.4.0

type DeleteBucketLifecycleInput struct {
	Bucket string
}

type DeleteBucketLifecycleOutput added in v2.4.0

type DeleteBucketLifecycleOutput struct {
	RequestInfo
}

type DeleteBucketMirrorBackInput added in v2.4.0

type DeleteBucketMirrorBackInput struct {
	Bucket string
}

type DeleteBucketMirrorBackOutput added in v2.4.0

type DeleteBucketMirrorBackOutput struct {
	RequestInfo
}

type DeleteBucketOutput

type DeleteBucketOutput struct {
	RequestInfo `json:"-"`
}

type DeleteBucketPolicyOutput

type DeleteBucketPolicyOutput struct {
	RequestInfo `json:"-"`
}

type DeleteBucketPolicyV2Input added in v2.4.0

type DeleteBucketPolicyV2Input struct {
	Bucket string `json:"-"`
}

type DeleteBucketPolicyV2Output added in v2.4.0

type DeleteBucketPolicyV2Output struct {
	RequestInfo
}

type DeleteBucketRealTimeLogInput added in v2.5.0

type DeleteBucketRealTimeLogInput struct {
	Bucket string
}

type DeleteBucketRealTimeLogOutput added in v2.5.0

type DeleteBucketRealTimeLogOutput struct {
	RequestInfo
}

type DeleteBucketRenameInput added in v2.5.4

type DeleteBucketRenameInput struct {
	Bucket string
}

type DeleteBucketRenameOutput added in v2.5.4

type DeleteBucketRenameOutput struct {
	RequestInfo
}

type DeleteBucketReplicationInput added in v2.5.0

type DeleteBucketReplicationInput struct {
	Bucket string
}

type DeleteBucketReplicationOutput added in v2.5.0

type DeleteBucketReplicationOutput struct {
	RequestInfo
}

type DeleteBucketTaggingInput added in v2.6.6

type DeleteBucketTaggingInput struct {
	Bucket string // required
}

type DeleteBucketTaggingOutput added in v2.6.6

type DeleteBucketTaggingOutput struct {
	RequestInfo
}

type DeleteBucketWebsiteInput added in v2.5.0

type DeleteBucketWebsiteInput struct {
	Bucket string
}

type DeleteBucketWebsiteOutput added in v2.5.0

type DeleteBucketWebsiteOutput struct {
	RequestInfo
}

type DeleteError

type DeleteError struct {
	Code      string `json:"Code,omitempty"`
	Message   string `json:"Message,omitempty"`
	Key       string `json:"Key,omitempty"`
	VersionID string `json:"VersionId,omitempty"`
}

type DeleteMultiObjectsInput

type DeleteMultiObjectsInput struct {
	Bucket  string
	Objects []ObjectTobeDeleted `json:"Objects,omitempty"`
	Quiet   bool                `json:"Quiet,omitempty"`
}

type DeleteMultiObjectsOutput

type DeleteMultiObjectsOutput struct {
	RequestInfo `json:"-"`
	Deleted     []DeletedV2   `json:"Deleted,omitempty"` // 删除成功的Object列表
	Error       []DeleteError `json:"Error,omitempty"`   // 删除失败的Object列表
}

type DeleteObjectOutput

type DeleteObjectOutput struct {
	RequestInfo  `json:"-"`
	DeleteMarker bool   `json:"DeleteMarker,omitempty"`
	VersionID    string `json:"VersionId,omitempty"`
}

type DeleteObjectTaggingInput added in v2.4.0

type DeleteObjectTaggingInput struct {
	Bucket    string
	Key       string
	VersionID string `location:"query" locationName:"versionId"`
}

type DeleteObjectTaggingOutput added in v2.4.0

type DeleteObjectTaggingOutput struct {
	RequestInfo
	VersionID string
}

type DeleteObjectV2Input

type DeleteObjectV2Input struct {
	Bucket    string
	Key       string
	VersionID string `location:"query" locationName:"versionId"`
}

type DeleteObjectV2Output

type DeleteObjectV2Output struct {
	DeleteObjectOutput
}

type Deleted

type Deleted struct {
	Key                   string `json:"Key,omitempty"`
	VersionID             string `json:"VersionId,omitempty"`
	DeleteMarker          *bool  `json:"DeleteMarker,omitempty"`
	DeleteMarkerVersionID string `json:"DeleteMarkerVersionId,omitempty"`
}

type DeletedV2 added in v2.1.3

type DeletedV2 struct {
	Key                   string `json:"Key,omitempty"`
	VersionID             string `json:"VersionId,omitempty"`
	DeleteMarker          bool   `json:"DeleteMarker,omitempty"`
	DeleteMarkerVersionID string `json:"DeleteMarkerVersionId,omitempty"`
}

type Destination added in v2.5.0

type Destination struct {
	Bucket                       string                                `json:"Bucket"`
	Location                     string                                `json:"Location"`
	StorageClass                 enum.StorageClassType                 `json:"StorageClass,omitempty"`
	StorageClassInheritDirective enum.StorageClassInheritDirectiveType `json:"StorageClassInheritDirective,omitempty"`
}

type DestinationRocketMQ added in v2.6.6

type DestinationRocketMQ struct {
	Role        string `json:"Role"`
	InstanceID  string `json:"InstanceId"`
	Topic       string `json:"Topic"`
	AccessKeyID string `json:"AccessKeyId"`
}

type DestinationVeFaaS added in v2.6.6

type DestinationVeFaaS struct {
	FunctionID string `json:"FunctionId"`
}

type DownloadEvent

type DownloadEvent struct {
	Type           enum.DownloadEventType
	Err            error // not empty when it occurs when failed, aborted event occurs
	Bucket         string
	Key            string
	VersionID      string
	FilePath       string  // path of the file to download to
	CheckpointFile *string // path to checkpoint file
	TempFilePath   *string // path fo the temp file
	// not empty when download part event occurs
	DowloadPartInfo *DownloadPartInfo
}

type DownloadEventListener

type DownloadEventListener interface {
	EventChange(event *DownloadEvent)
}

type DownloadFileInput

type DownloadFileInput struct {
	HeadObjectV2Input
	FilePath string

	PartSize         int64
	TaskNum          int
	EnableCheckpoint bool
	CheckpointFile   string

	TrafficLimit          int64
	DownloadEventListener DownloadEventListener
	DataTransferListener  DataTransferListener
	RateLimiter           RateLimiter
	CancelHook            CancelHook // user can not set this filed
	// contains filtered or unexported fields
}

type DownloadFileOutput

type DownloadFileOutput struct {
	HeadObjectV2Output
}

type DownloadPartInfo

type DownloadPartInfo struct {
	PartNumber int
	RangeStart int64
	RangeEnd   int64
}

DownloadPartInfo is returned when DownloadEvent occur

type ETagCheckReadCloser

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

ETagCheckReadCloser checks ETag on read EOF

func NewETagCheckReadCloser

func NewETagCheckReadCloser(reader io.ReadCloser, eTag, requestID string) *ETagCheckReadCloser

func (*ETagCheckReadCloser) Close

func (ec *ETagCheckReadCloser) Close() error

func (*ETagCheckReadCloser) Read

func (ec *ETagCheckReadCloser) Read(p []byte) (n int, err error)

type EmptyContentTypeRecognizer

type EmptyContentTypeRecognizer struct{}

func (EmptyContentTypeRecognizer) ContentType

func (er EmptyContentTypeRecognizer) ContentType(objectKey string) string

type Error

type Error struct {
	StatusCode int    `json:"-"`
	Code       string `json:"Code,omitempty"`
	Message    string `json:"Message,omitempty"`
	RequestID  string `json:"RequestId,omitempty"`
	HostID     string `json:"HostId,omitempty"`
	Resource   string `json:"Resource,omitempty"`
	EC         string `json:"EC,omitempty"`
}

func (*Error) Error

func (e *Error) Error() string

type ErrorDocument added in v2.5.0

type ErrorDocument struct {
	Key string `json:"Key"`
}

type Expiration added in v2.4.0

type Expiration struct {
	Days int       `json:"Days,omitempty"`
	Date time.Time `json:"Date,omitempty"`
}

type ExtensionBasedContentTypeRecognizer

type ExtensionBasedContentTypeRecognizer struct{}

func (ExtensionBasedContentTypeRecognizer) ContentType

func (er ExtensionBasedContentTypeRecognizer) ContentType(objectKey string) string

type FederationCredentials

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

FederationCredentials implements Credentials interfaces with flushing Credential periodically

func NewFederationCredentials

func NewFederationCredentials(tokenProvider FederationTokenProvider) (*FederationCredentials, error)

NewFederationCredentials FederationCredentials implements Credentials interfaces with flushing Credential periodically

use WithPreFetch set prefetch time

func (*FederationCredentials) Credential

func (fc *FederationCredentials) Credential() Credential

Credential for Credentials interface

func (*FederationCredentials) WithPreFetch

func (fc *FederationCredentials) WithPreFetch(preFetch time.Duration)

WithPreFetch set prefetch time

type FederationToken

type FederationToken struct {
	Credential Credential
	Expiration time.Time
}

FederationToken contains Credential and Credential's expiration time

type FederationTokenProvider

type FederationTokenProvider interface {
	FederationToken() (*FederationToken, error)
}

FederationTokenProvider provides FederationToken

type FetchObjectInput

type FetchObjectInput struct {
	URL           string `json:"URL,omitempty"`           // required
	Key           string `json:"Key,omitempty"`           // required
	IgnoreSameKey bool   `json:"IgnoreSameKey,omitempty"` // optional, default value is false
	ContentMD5    string `json:"ContentMD5,omitempty"`    // hex-encoded md5, optional
}

type FetchObjectInputV2 added in v2.4.0

type FetchObjectInputV2 struct {
	Bucket           string
	Key              string
	ACL              enum.ACLType          `location:"header" locationName:"X-Tos-Acl"`
	GrantFullControl string                `location:"header" locationName:"X-Tos-Grant-Full-Control"`
	GrantRead        string                `location:"header" locationName:"X-Tos-Grant-Read"`
	GrantReadACP     string                `location:"header" locationName:"X-Tos-Grant-Read-Acp"`
	GrantWriteACP    string                `location:"header" locationName:"X-Tos-Grant-Write-Acp"`
	StorageClass     enum.StorageClassType `location:"header" locationName:"X-Tos-Storage-Class"`
	SSECAlgorithm    string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Algorithm"`
	SSECKey          string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key"`
	SSECKeyMD5       string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key-MD5"`
	Meta             map[string]string     `location:"headers"`

	URL           string `json:"URL,omitempty"`
	IgnoreSameKey bool   `json:"IgnoreSameKey,omitempty"`
	HexMD5        string `json:"ContentMD5,omitempty"`
}

type FetchObjectOutput

type FetchObjectOutput struct {
	RequestInfo `json:"-"`
	VersionID   string `json:"VersionId,omitempty"` // may be empty
	ETag        string `json:"ETag,omitempty"`
}

type FetchObjectOutputV2 added in v2.4.0

type FetchObjectOutputV2 struct {
	RequestInfo
	VersionID     string `json:"VersionId,omitempty"`
	Etag          string `json:"Etag,omitempty"`
	SSECAlgorithm string `json:"SSECAlgorithm,omitempty"`
	SSECKeyMD5    string `json:"SSECKeyMD5,omitempty"`
}

type Filter added in v2.5.0

type Filter struct {
	Key FilterKey `json:"TOSKey"`
}

type FilterKey added in v2.5.0

type FilterKey struct {
	Rules []FilterRule `json:"FilterRules"`
}

type FilterRule added in v2.5.0

type FilterRule struct {
	Name  string `json:"Name"`
	Value string `json:"Value"`
}

type GetBucketACLInput added in v2.4.0

type GetBucketACLInput struct {
	Bucket string
}

type GetBucketACLOutput added in v2.4.0

type GetBucketACLOutput struct {
	RequestInfo
	Owner  Owner     `json:"Owner,omitempty"`
	Grants []GrantV2 `json:"Grants,omitempty"`
}

type GetBucketCORSInput added in v2.1.10

type GetBucketCORSInput struct {
	Bucket string
}

type GetBucketCORSOutput added in v2.1.10

type GetBucketCORSOutput struct {
	RequestInfo `json:"-"`
	CORSRules   []CorsRule `json:"CORSRules,omitempty"`
}

type GetBucketLifecycleInput added in v2.4.0

type GetBucketLifecycleInput struct {
	Bucket string
}

type GetBucketLifecycleOutput added in v2.4.0

type GetBucketLifecycleOutput struct {
	RequestInfo
	Rules []LifecycleRule `json:"Rules"`
}

type GetBucketLocationInput added in v2.4.0

type GetBucketLocationInput struct {
	Bucket string
}

type GetBucketLocationOutput added in v2.4.0

type GetBucketLocationOutput struct {
	RequestInfo      `json:"-"`
	Region           string `json:"Region,omitempty"`
	ExtranetEndpoint string `json:"ExtranetEndpoint,omitempty"`
	IntranetEndpoint string `json:"IntranetEndpoint,omitempty"`
}

type GetBucketMirrorBackInput added in v2.4.0

type GetBucketMirrorBackInput struct {
	Bucket string
}

type GetBucketMirrorBackOutput added in v2.4.0

type GetBucketMirrorBackOutput struct {
	RequestInfo
	Rules []MirrorBackRule
}

type GetBucketNotificationInput added in v2.5.0

type GetBucketNotificationInput struct {
	Bucket string
}

type GetBucketNotificationOutput added in v2.5.0

type GetBucketNotificationOutput struct {
	RequestInfo
	CloudFunctionConfigurations []CloudFunctionConfiguration `json:"CloudFunctionConfigurations"`
	RocketMQConfigurations      []RocketMQConfiguration      `json:"RocketMQConfigurations"`
}

type GetBucketNotificationType2Input added in v2.6.6

type GetBucketNotificationType2Input struct {
	Bucket string
}

type GetBucketNotificationType2Output added in v2.6.6

type GetBucketNotificationType2Output struct {
	RequestInfo
	Rules   []NotificationRule `json:"Rules"`
	Version string             `json:"Version"`
}

type GetBucketPolicyOutput

type GetBucketPolicyOutput struct {
	RequestInfo `json:"-"`
	Policy      string `json:"Policy,omitempty"`
}

type GetBucketPolicyV2Input added in v2.4.0

type GetBucketPolicyV2Input struct {
	Bucket string `json:"-"`
}

type GetBucketPolicyV2Output added in v2.4.0

type GetBucketPolicyV2Output struct {
	RequestInfo `json:"-"`
	Policy      string `json:"Policy,omitempty"`
}

type GetBucketRealTimeLogInput added in v2.5.0

type GetBucketRealTimeLogInput struct {
	Bucket string
}

type GetBucketRealTimeLogOutput added in v2.5.0

type GetBucketRealTimeLogOutput struct {
	RequestInfo
	Configuration RealTimeLogConfiguration `json:"RealTimeLogConfiguration"`
}

type GetBucketRenameInput added in v2.5.4

type GetBucketRenameInput struct {
	Bucket string
}

type GetBucketRenameOutput added in v2.5.4

type GetBucketRenameOutput struct {
	RequestInfo
	RenameEnable bool
}

type GetBucketReplicationInput added in v2.5.0

type GetBucketReplicationInput struct {
	Bucket string
	RuleID string
}

type GetBucketReplicationOutput added in v2.5.0

type GetBucketReplicationOutput struct {
	RequestInfo
	Role  string                        `json:"Role"`
	Rules []ReplicationRuleWithProgress `json:"Rules"`
}

type GetBucketTaggingInput added in v2.6.6

type GetBucketTaggingInput struct {
	Bucket string // required
}

type GetBucketTaggingOutput added in v2.6.6

type GetBucketTaggingOutput struct {
	RequestInfo
	TagSet TagSet
}

type GetBucketVersioningInput added in v2.5.0

type GetBucketVersioningInput struct {
	Bucket string
}

type GetBucketVersioningOutput

type GetBucketVersioningOutput struct {
	RequestInfo `json:"-"`
	Status      string `json:"Status"`
}

type GetBucketVersioningOutputV2 added in v2.5.0

type GetBucketVersioningOutputV2 struct {
	RequestInfo
	Status enum.VersioningStatusType `json:"Status"`
}

type GetBucketWebsiteInput added in v2.5.0

type GetBucketWebsiteInput struct {
	Bucket string
}

type GetBucketWebsiteOutput added in v2.5.0

type GetBucketWebsiteOutput struct {
	RequestInfo
	RedirectAllRequestsTo *RedirectAllRequestsTo `json:"RedirectAllRequestsTo,omitempty"`
	IndexDocument         *IndexDocument         `json:"IndexDocument,omitempty"`
	ErrorDocument         *ErrorDocument         `json:"ErrorDocument,omitempty"`
	RoutingRules          []RoutingRule          `json:"RoutingRules,omitempty"`
}

type GetFetchTaskInput added in v2.1.8

type GetFetchTaskInput struct {
	TaskID string `json:"taskID,omitempty"`
}

type GetFetchTaskOutput added in v2.1.8

type GetFetchTaskOutput struct {
	RequestInfo `json:"-"`
	State       string `json:"State,omitempty"`
}

type GetObjectACLInput

type GetObjectACLInput struct {
	Bucket    string
	Key       string
	VersionID string `location:"query" locationName:"versionId"`
}

type GetObjectACLOutput

type GetObjectACLOutput struct {
	RequestInfo          `json:"-"`
	VersionID            string    `json:"VersionID,omitempty"`
	Owner                Owner     `json:"Owner,omitempty"`
	Grants               []GrantV2 `json:"Grants,omitempty"`
	BucketOwnerEntrusted bool      `json:"BucketOwnerEntrusted"`
}

type GetObjectAclOutput

type GetObjectAclOutput struct {
	RequestInfo `json:"-"`
	VersionID   string  `json:"VersionId,omitempty"`
	Owner       Owner   `json:"Owner,omitempty"`
	Grants      []Grant `json:"Grants,omitempty"`
}

type GetObjectBasicOutput

type GetObjectBasicOutput struct {
	RequestInfo
	ContentRange string // don't move into ObjectMetaV2
	ObjectMetaV2
}

type GetObjectOutput

type GetObjectOutput struct {
	RequestInfo  `json:"-"`
	ContentRange string        `json:"ContentRange,omitempty"`
	Content      io.ReadCloser `json:"-"`
	ObjectMeta
}

type GetObjectTaggingInput added in v2.4.0

type GetObjectTaggingInput struct {
	Bucket    string
	Key       string
	VersionID string `location:"query" locationName:"versionId"`
}

type GetObjectTaggingOutput added in v2.4.0

type GetObjectTaggingOutput struct {
	RequestInfo
	VersionID string
	TagSet    TagSet
}

type GetObjectToFileInput

type GetObjectToFileInput struct {
	GetObjectV2Input
	FilePath string
}

type GetObjectToFileOutput

type GetObjectToFileOutput struct {
	GetObjectBasicOutput
}

type GetObjectV2Input

type GetObjectV2Input struct {
	Bucket    string
	Key       string
	VersionID string `location:"query" locationName:"versionId"`

	IfMatch           string    `location:"header" locationName:"If-Match"`
	IfModifiedSince   time.Time `location:"header" locationName:"If-Modified-Since"`
	IfNoneMatch       string    `location:"header" locationName:"If-None-Match"`
	IfUnmodifiedSince time.Time `location:"header" locationName:"If-Unmodified-Since"`

	SSECAlgorithm string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Algorithm"`
	SSECKey       string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key"`
	SSECKeyMD5    string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key-MD5"`
	TrafficLimit  int64  `location:"header" locationName:"X-Tos-Traffic-Limit"`

	ResponseCacheControl       string    `location:"query" locationName:"response-cache-control"`
	ResponseContentDisposition string    `location:"query" locationName:"response-content-disposition"`
	ResponseContentEncoding    string    `location:"query" locationName:"response-content-encoding"`
	ResponseContentLanguage    string    `location:"query" locationName:"response-content-language"`
	ResponseContentType        string    `location:"query" locationName:"response-content-type"`
	ResponseExpires            time.Time `location:"query" locationName:"response-expires"`
	Process                    string    `location:"query" locationName:"x-tos-process"`
	SaveBucket                 string    `location:"query" locationName:"x-tos-save-bucket"`
	SaveObject                 string    `location:"query" locationName:"x-tos-save-object"`

	RangeStart int64
	RangeEnd   int64
	Range      string

	DataTransferListener DataTransferListener
	RateLimiter          RateLimiter
	// Deprecated Not Use
	PartNumber int
}

type GetObjectV2Output

type GetObjectV2Output struct {
	GetObjectBasicOutput
	Content io.ReadCloser
}

func ParseGetObjectV2Output added in v2.4.7

func ParseGetObjectV2Output(httpRes *http.Response, expectedCode int) (*GetObjectV2Output, error)

ParseGetObjectV2Output Parse the incoming parameters of *http.Response type, and respond to the return value of *GetObjectV2Output type.

type Grant

type Grant struct {
	Grantee    Grantee             `json:"Grantee,omitempty"`
	Permission enum.PermissionType `json:"Permission,omitempty"`
}

type GrantV2 added in v2.1.3

type GrantV2 struct {
	GranteeV2  GranteeV2           `json:"Grantee,omitempty"`
	Permission enum.PermissionType `json:"Permission,omitempty"`
}

type Grantee

type Grantee struct {
	ID          string `json:"ID,omitempty"`
	DisplayName string `json:"DisplayName,omitempty"`
	Type        string `json:"Type,omitempty"`
	URI         string `json:"Canned,omitempty"`
}

type GranteeV2 added in v2.1.3

type GranteeV2 struct {
	ID          string           `json:"ID,omitempty"`
	DisplayName string           `json:"DisplayName,omitempty"`
	Type        enum.GranteeType `json:"Type,omitempty"`
	Canned      enum.CannedType  `json:"Canned,omitempty"`
}

type HeadBucketInput

type HeadBucketInput struct {
	Bucket string
}

type HeadBucketOutput

type HeadBucketOutput struct {
	RequestInfo  `json:"-"`
	Region       string                `json:"Region,omitempty"`
	StorageClass enum.StorageClassType `json:"StorageClass,omitempty"`
	AzRedundancy enum.AzRedundancyType `json:"AzRedundancy"`
}

type HeadObjectOutput

type HeadObjectOutput struct {
	RequestInfo  `json:"-"`
	ContentRange string `json:"ContentRange,omitempty"`
	ObjectMeta
}

type HeadObjectV2Input

type HeadObjectV2Input struct {
	Bucket    string
	Key       string
	VersionID string `location:"query" locationName:"versionId"`

	IfMatch           string    `location:"header" locationName:"If-Match"`
	IfModifiedSince   time.Time `location:"header" locationName:"If-Modified-Since"`
	IfNoneMatch       string    `location:"header" locationName:"If-None-Match"`
	IfUnmodifiedSince time.Time `location:"header" locationName:"If-Unmodified-Since"`

	SSECAlgorithm string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Algorithm"`
	SSECKey       string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key"`
	SSECKeyMD5    string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key-MD5"`
}

type HeadObjectV2Output

type HeadObjectV2Output struct {
	RequestInfo `json:"-"`
	ObjectMetaV2
}

func ParseHeadObjectV2Output added in v2.4.7

func ParseHeadObjectV2Output(httpRes *http.Response) (*HeadObjectV2Output, error)

ParseHeadObjectV2Output Parse the incoming parameters of *http.Response type, and respond to the return value of *HeadObjectV2Output type.

type IndexDocument added in v2.5.0

type IndexDocument struct {
	Suffix          string `json:"Suffix"`
	ForbiddenSubDir bool   `json:"ForbiddenSubDir,omitempty"`
}

type KV

type KV struct {
	Key    string
	Values []string
}

type KVs

type KVs []KV

func (KVs) Len

func (kvs KVs) Len() int

func (KVs) Less

func (kvs KVs) Less(i, j int) bool

func (KVs) Swap

func (kvs KVs) Swap(i, j int)

type LifecycleRule added in v2.4.0

type LifecycleRule struct {
	ID                             string                          `json:"ID,omitempty"`
	Prefix                         string                          `json:"Prefix,omitempty"`
	Status                         enum.StatusType                 `json:"Status,omitempty"`
	Transitions                    []Transition                    `json:"Transitions,omitempty"`
	Expiration                     *Expiration                     `json:"Expiration,omitempty"`
	NonCurrentVersionTransition    []NonCurrentVersionTransition   `json:"NoncurrentVersionTransitions,omitempty"`
	NoCurrentVersionExpiration     *NoCurrentVersionExpiration     `json:"NoncurrentVersionExpiration,omitempty"`
	Tag                            []Tag                           `json:"Tags,omitempty"`
	AbortInCompleteMultipartUpload *AbortInCompleteMultipartUpload `json:"AbortIncompleteMultipartUpload,omitempty"`
}

type ListBucketCustomDomainInput added in v2.5.0

type ListBucketCustomDomainInput struct {
	Bucket string
}

type ListBucketCustomDomainOutput added in v2.5.0

type ListBucketCustomDomainOutput struct {
	RequestInfo
	Rules []CustomDomainRule `json:"CustomDomainRules"`
}

type ListBucketsInput

type ListBucketsInput struct{}

type ListBucketsOutput

type ListBucketsOutput struct {
	RequestInfo `json:"-"`
	Buckets     []ListedBucket `json:"Buckets,omitempty"`
	Owner       ListedOwner    `json:"Owner,omitempty"`
}

type ListMultipartUploadsInput

type ListMultipartUploadsInput struct {
	Prefix         string `json:"Prefix,omitempty"`
	Delimiter      string `json:"Delimiter,omitempty"`
	KeyMarker      string `json:"KeyMarker,omitempty"`
	UploadIDMarker string `json:"UploadIdMarker,omitempty"`
	MaxUploads     int    `json:"MaxUploads,omitempty"`
}

type ListMultipartUploadsOutput

type ListMultipartUploadsOutput struct {
	RequestInfo        `json:"-"`
	Bucket             string               `json:"Bucket,omitempty"`
	KeyMarker          string               `json:"KeyMarker,omitempty"`
	UploadIdMarker     string               `json:"UploadIdMarker,omitempty"`
	NextKeyMarker      string               `json:"NextKeyMarker,omitempty"`
	NextUploadIdMarker string               `json:"NextUploadIdMarker,omitempty"`
	Delimiter          string               `json:"Delimiter,omitempty"`
	Prefix             string               `json:"Prefix,omitempty"`
	MaxUploads         int32                `json:"MaxUploads,omitempty"`
	IsTruncated        bool                 `json:"IsTruncated,omitempty"`
	Upload             []UploadInfo         `json:"Uploads,omitempty"`
	CommonPrefixes     []UploadCommonPrefix `json:"CommonPrefixes,omitempty"`
}

type ListMultipartUploadsV2Input

type ListMultipartUploadsV2Input struct {
	Bucket         string
	Prefix         string `location:"query" locationName:"prefix"`
	Delimiter      string `location:"query" locationName:"delimiter"`
	KeyMarker      string `location:"query" locationName:"key-marker"`
	UploadIDMarker string `location:"query" locationName:"upload-id-marker"`
	MaxUploads     int    `location:"query" locationName:"max-uploads"`
	EncodingType   string `location:"query" locationName:"encoding-type"` // "" or "url"
}

type ListMultipartUploadsV2Output

type ListMultipartUploadsV2Output struct {
	RequestInfo
	Bucket             string
	Prefix             string
	KeyMarker          string
	UploadIDMarker     string
	MaxUploads         int
	Delimiter          string
	IsTruncated        bool
	EncodingType       string
	NextKeyMarker      string
	NextUploadIDMarker string
	CommonPrefixes     []ListedCommonPrefix
	Uploads            []ListedUpload
}

type ListObjectVersionsInput

type ListObjectVersionsInput struct {
	Prefix          string `location:"query" locationName:"prefix"`
	Delimiter       string `location:"query" locationName:"delimiter"`
	KeyMarker       string `location:"query" locationName:"key-marker"`
	VersionIDMarker string `location:"query" locationName:"version-id-marker"`
	MaxKeys         int    `location:"query" locationName:"max-keys"`
	EncodingType    string `location:"query" locationName:"encoding-type"` // "" or "url"
	FetchMeta       bool   `location:"query" locationName:"fetch-meta"`
}

type ListObjectVersionsOutput

type ListObjectVersionsOutput struct {
	RequestInfo         `json:"-"`
	Name                string                    `json:"Name,omitempty"` // bucket name
	Prefix              string                    `json:"Prefix,omitempty"`
	KeyMarker           string                    `json:"KeyMarker,omitempty"`
	VersionIDMarker     string                    `json:"VersionIdMarker,omitempty"`
	Delimiter           string                    `json:"Delimiter,omitempty"`
	EncodingType        string                    `json:"EncodingType,omitempty"`
	MaxKeys             int64                     `json:"MaxKeys,omitempty"`
	NextKeyMarker       string                    `json:"NextKeyMarker,omitempty"`
	NextVersionIDMarker string                    `json:"NextVersionIdMarker,omitempty"`
	IsTruncated         bool                      `json:"IsTruncated,omitempty"`
	CommonPrefixes      []ListedCommonPrefix      `json:"CommonPrefixes,omitempty"`
	Versions            []ListedObjectVersion     `json:"Versions,omitempty"`
	DeleteMarkers       []ListedDeleteMarkerEntry `json:"DeleteMarkers,omitempty"`
}

type ListObjectVersionsV2Input

type ListObjectVersionsV2Input struct {
	Bucket string `json:"Prefix,omitempty"`
	ListObjectVersionsInput
}

type ListObjectVersionsV2Output

type ListObjectVersionsV2Output struct {
	RequestInfo         `json:"-"`
	Name                string                  `json:"Name,omitempty"` // bucket name
	Prefix              string                  `json:"Prefix,omitempty"`
	KeyMarker           string                  `json:"KeyMarker,omitempty"`
	VersionIDMarker     string                  `json:"VersionIdMarker,omitempty"`
	Delimiter           string                  `json:"Delimiter,omitempty"`
	EncodingType        string                  `json:"EncodingType,omitempty"`
	MaxKeys             int                     `json:"MaxKeys,omitempty"`
	NextKeyMarker       string                  `json:"NextKeyMarker,omitempty"`
	NextVersionIDMarker string                  `json:"NextVersionIdMarker,omitempty"`
	IsTruncated         bool                    `json:"IsTruncated,omitempty"`
	CommonPrefixes      []ListedCommonPrefix    `json:"CommonPrefixes,omitempty"`
	Versions            []ListedObjectVersionV2 `json:"Versions,omitempty"`
	DeleteMarkers       []ListedDeleteMarker    `json:"DeleteMarkers,omitempty"`
}

func ParseListObjectVersionsV2Output added in v2.4.7

func ParseListObjectVersionsV2Output(httpRes *http.Response) (*ListObjectVersionsV2Output, error)

ParseListObjectVersionsV2Output Parse the incoming parameters of *http.Response type, and respond to the return value of *ListObjectVersionsV2Output type.

type ListObjectsInput

type ListObjectsInput struct {
	Prefix       string `location:"query" locationName:"prefix"`
	Delimiter    string `location:"query" locationName:"delimiter"`
	Marker       string `location:"query" locationName:"marker"`
	MaxKeys      int    `location:"query" locationName:"max-keys"`
	EncodingType string `location:"query" locationName:"encoding-type"` // "" or "url"
	FetchMeta    bool   `location:"query" locationName:"fetch-meta"`
	// Deprecated
	Reverse bool
}

type ListObjectsOutput

type ListObjectsOutput struct {
	RequestInfo    `json:"-"`
	Name           string               `json:"Name,omitempty"` // bucket name
	Prefix         string               `json:"Prefix,omitempty"`
	Marker         string               `json:"Marker,omitempty"`
	MaxKeys        int64                `json:"MaxKeys,omitempty"`
	NextMarker     string               `json:"NextMarker,omitempty"`
	Delimiter      string               `json:"Delimiter,omitempty"`
	IsTruncated    bool                 `json:"IsTruncated,omitempty"`
	EncodingType   string               `json:"EncodingType,omitempty"`
	CommonPrefixes []ListedCommonPrefix `json:"CommonPrefixes,omitempty"`
	Contents       []ListedObject       `json:"Contents,omitempty"`
}

type ListObjectsType2Input added in v2.4.0

type ListObjectsType2Input struct {
	Bucket            string
	Prefix            string `location:"query" locationName:"prefix"`
	Delimiter         string `location:"query" locationName:"delimiter"`
	StartAfter        string `location:"query" locationName:"start-after"`
	ContinuationToken string `location:"query" locationName:"continuation-token"`
	MaxKeys           int    `location:"query" locationName:"max-keys"`
	EncodingType      string `location:"query" locationName:"encoding-type"`
	FetchMeta         bool   `location:"query" locationName:"fetch-meta"`
	ListOnlyOnce      bool
}

type ListObjectsType2Output added in v2.4.0

type ListObjectsType2Output struct {
	RequestInfo
	Name                  string               `json:"Name,omitempty"`
	Prefix                string               `json:"Prefix,omitempty"`
	ContinuationToken     string               `json:"ContinuationToken,omitempty"`
	KeyCount              int                  `json:"KeyCount,omitempty"`
	MaxKeys               int                  `json:"MaxKeys,omitempty"`
	Delimiter             string               `json:"Delimiter,omitempty"`
	IsTruncated           bool                 `json:"IsTruncated,omitempty"`
	EncodingType          string               `json:"EncodingType,omitempty"`
	NextContinuationToken string               `json:"NextContinuationToken,omitempty"`
	CommonPrefixes        []ListedCommonPrefix `json:"CommonPrefixes,omitempty"`
	Contents              []ListedObjectV2     `json:"Contents,omitempty"`
}

func ParseListObjectsType2Output added in v2.4.7

func ParseListObjectsType2Output(httpRes *http.Response) (*ListObjectsType2Output, error)

ParseListObjectsType2Output Parse the incoming parameters of *http.Response type, and respond to the return value of *ListObjectsType2Output type.

type ListObjectsV2Input

type ListObjectsV2Input struct {
	Bucket string
	ListObjectsInput
}

type ListObjectsV2Output

type ListObjectsV2Output struct {
	RequestInfo    `json:"-"`
	Name           string               `json:"Name,omitempty"`
	Prefix         string               `json:"Prefix,omitempty"`
	Marker         string               `json:"Marker,omitempty"`
	MaxKeys        int64                `json:"MaxKeys,omitempty"`
	NextMarker     string               `json:"NextMarker,omitempty"`
	Delimiter      string               `json:"Delimiter,omitempty"`
	IsTruncated    bool                 `json:"IsTruncated,omitempty"`
	EncodingType   string               `json:"EncodingType,omitempty"`
	CommonPrefixes []ListedCommonPrefix `json:"CommonPrefixes,omitempty"`
	Contents       []ListedObjectV2     `json:"Contents,omitempty"`
}

func ParseListObjectsV2Output added in v2.4.8

func ParseListObjectsV2Output(httpRes *http.Response) (*ListObjectsV2Output, error)

ParseListObjectsV2Output Parse the incoming parameters of *http.Response type, and respond to the return value of *ListObjectsV2Output type.

type ListPartsInput

type ListPartsInput struct {
	Bucket           string
	Key              string
	UploadID         string `location:"query" locationName:"uploadId"`
	PartNumberMarker int    `location:"query" locationName:"part-number-marker"`
	MaxParts         int    `location:"query" locationName:"max-parts"`
	EncodingType     string `location:"query" locationName:"encoding-type"` // "" or "url"
}

type ListPartsOutput

type ListPartsOutput struct {
	RequestInfo
	Bucket           string
	Key              string
	UploadID         string
	PartNumberMarker int
	MaxParts         int
	IsTruncated      bool
	EncodingType     string

	NextPartNumberMarker int
	StorageClass         enum.StorageClassType
	Owner                Owner
	Parts                []UploadedPartV2
}

type ListUploadedPartsInput

type ListUploadedPartsInput struct {
	Key              string `json:"Key,omitempty"`
	UploadID         string `json:"UploadId,omitempty"`
	MaxParts         int    `json:"MaxParts,omitempty"`             // 最大Part个数
	PartNumberMarker int    `json:"NextPartNumberMarker,omitempty"` // 起始Part的位置
}

type ListUploadedPartsOutput

type ListUploadedPartsOutput struct {
	RequestInfo          `json:"-"`
	Bucket               string         `json:"Bucket,omitempty"`               // Bucket名称
	Key                  string         `json:"Key,omitempty"`                  // Object名称
	UploadID             string         `json:"UploadId,omitempty"`             // 上传ID
	PartNumberMarker     int            `json:"PartNumberMarker,omitempty"`     // 当前页起始位置
	NextPartNumberMarker int            `json:"NextPartNumberMarker,omitempty"` // 下一个Part的位置
	MaxParts             int            `json:"MaxParts,omitempty"`             // 最大Part个数
	IsTruncated          bool           `json:"IsTruncated,omitempty"`          // 是否完全上传完成
	StorageClass         string         `json:"StorageClass,omitempty"`         // 存储类型
	Owner                Owner          `json:"Owner,omitempty"`                // 属主
	UploadedParts        []UploadedPart `json:"Parts,omitempty"`                // 已完成的Part
}

type ListedBucket

type ListedBucket struct {
	CreationDate     string `json:"CreationDate,omitempty"`
	Name             string `json:"Name,omitempty"`
	Location         string `json:"Location,omitempty"`
	ExtranetEndpoint string `json:"ExtranetEndpoint,omitempty"`
	IntranetEndpoint string `json:"IntranetEndpoint,omitempty"`
}

type ListedCommonPrefix

type ListedCommonPrefix struct {
	Prefix string `json:"Prefix,omitempty"`
}

type ListedDeleteMarker

type ListedDeleteMarker struct {
	Key          string
	LastModified time.Time
	IsLatest     bool
	Owner        Owner
	VersionID    string
}

type ListedDeleteMarkerEntry

type ListedDeleteMarkerEntry struct {
	IsLatest     bool   `json:"IsLatest,omitempty"`
	Key          string `json:"Key,omitempty"`
	LastModified string `json:"LastModified,omitempty"`
	Owner        Owner  `json:"Owner,omitempty"`
	VersionID    string `json:"VersionId,omitempty"`
}

type ListedObject

type ListedObject struct {
	Key          string   `json:"Key,omitempty"`
	LastModified string   `json:"LastModified,omitempty"`
	ETag         string   `json:"ETag,omitempty"`
	Size         int64    `json:"Size,omitempty"`
	Owner        Owner    `json:"Owner,omitempty"`
	StorageClass string   `json:"StorageClass,omitempty"`
	Type         string   `json:"Type,omitempty"`
	Meta         Metadata `json:"UserMeta,omitempty"`
}

type ListedObjectV2 added in v2.1.3

type ListedObjectV2 struct {
	Key           string
	LastModified  time.Time
	ETag          string
	Size          int64
	Owner         Owner
	StorageClass  enum.StorageClassType
	HashCrc64ecma uint64
	Meta          Metadata
}

type ListedObjectVersion

type ListedObjectVersion struct {
	ETag         string   `json:"ETag,omitempty"`
	IsLatest     bool     `json:"IsLatest,omitempty"`
	Key          string   `json:"Key,omitempty"`
	LastModified string   `json:"LastModified,omitempty"`
	Owner        Owner    `json:"Owner,omitempty"`
	Size         int64    `json:"Size,omitempty"`
	StorageClass string   `json:"StorageClass,omitempty"`
	Type         string   `json:"Type,omitempty"`
	VersionID    string   `json:"VersionId,omitempty"`
	Meta         Metadata `json:"UserMeta,omitempty"`
}

type ListedObjectVersionV2 added in v2.1.3

type ListedObjectVersionV2 struct {
	Key           string
	LastModified  time.Time
	ETag          string
	IsLatest      bool
	Size          int64
	Owner         Owner
	StorageClass  enum.StorageClassType
	VersionID     string
	HashCrc64ecma uint64
	Meta          Metadata `json:"UserMeta,omitempty"`
}

type ListedOwner

type ListedOwner struct {
	ID string `json:"ID,omitempty"`
}

type ListedUpload

type ListedUpload struct {
	Key          string
	UploadID     string
	Owner        Owner
	StorageClass enum.StorageClassType
	Initiated    time.Time
}

type Logger added in v2.3.0

type Logger interface {
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
}

type Metadata added in v2.1.1

type Metadata interface {
	AllKeys() []string
	Get(key string) (string, bool)
	Range(f func(key, value string) bool)
}

type MirrorBackRule added in v2.4.0

type MirrorBackRule struct {
	ID        string    `json:"ID,omitempty"`
	Condition Condition `json:"Condition,omitempty"`
	Redirect  Redirect  `json:"Redirect,omitempty"`
}

type MirrorHeader added in v2.4.0

type MirrorHeader struct {
	PassAll bool     `json:"PassAll,omitempty"`
	Pass    []string `json:"Pass,omitempty"`
	Remove  []string `json:"Remove,omitempty"`
}

type MultipartUploadedPart

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

type NoCurrentVersionExpiration added in v2.4.0

type NoCurrentVersionExpiration struct {
	NoCurrentDays int `json:"NoncurrentDays,omitempty"`
}

type NoRetryClassifier

type NoRetryClassifier struct{}

func (NoRetryClassifier) Classify

func (classifier NoRetryClassifier) Classify(_ error) retryAction

Classify implements the classifier interface.

type NonCurrentVersionTransition added in v2.4.0

type NonCurrentVersionTransition struct {
	NonCurrentDays int                   `json:"NoncurrentDays,omitempty"`
	StorageClass   enum.StorageClassType `json:"StorageClass,omitempty"`
}

type NotificationDestination added in v2.6.6

type NotificationDestination struct {
	RocketMQ []DestinationRocketMQ `json:"RocketMQ"`
	VeFaaS   []DestinationVeFaaS   `json:"VeFaaS"`
}

type NotificationFilter added in v2.6.6

type NotificationFilter struct {
	TOSKey NotificationFilterKey `json:"TOSKey"`
}

type NotificationFilterKey added in v2.6.6

type NotificationFilterKey struct {
	FilterRules []NotificationFilterRule `json:"FilterRules"`
}

type NotificationFilterRule added in v2.6.6

type NotificationFilterRule struct {
	Name  string `json:"Name"`
	Value string `json:"Value"`
}

type NotificationRule added in v2.6.6

type NotificationRule struct {
	RuleID      string                  `json:"RuleId"`
	Events      []string                `json:"Events"` // 支持的值在不断增加,不定义成枚举
	Filter      NotificationFilter      `json:"Filter"`
	Destination NotificationDestination `json:"Destination"`
}

type ObjectAclGrant

type ObjectAclGrant struct {
	ACL              string `json:"ACL,omitempty"`
	GrantFullControl string `json:"GrantFullControl,omitempty"`
	GrantRead        string `json:"GrantRead,omitempty"`
	GrantReadAcp     string `json:"GrantReadAcp,omitempty"`
	// Deprecated: GrantWrite will be ignored
	GrantWrite    string `json:"GrantWrite,omitempty"`
	GrantWriteAcp string `json:"GrantWriteAcp,omitempty"`
}

type ObjectAclRules

type ObjectAclRules struct {
	Owner  Owner   `json:"Owner,omitempty"`
	Grants []Grant `json:"Grants,omitempty"`
}

type ObjectMeta

type ObjectMeta struct {
	ContentLength        int64             `json:"ContentLength,omitempty"`
	ContentType          string            `json:"ContentType,omitempty"`
	ContentMD5           string            `json:"ContentMD5,omitempty"`
	ContentLanguage      string            `json:"ContentLanguage,omitempty"`
	ContentEncoding      string            `json:"ContentEncoding,omitempty"`
	ContentDisposition   string            `json:"ContentDisposition,omitempty"`
	LastModified         string            `json:"LastModified,omitempty"`
	CacheControl         string            `json:"CacheControl,omitempty"`
	Expires              string            `json:"Expires,omitempty"`
	ETag                 string            `json:"ETag,omitempty"`
	VersionID            string            `json:"VersionId,omitempty"`
	DeleteMarker         bool              `json:"DeleteMarker,omitempty"`
	ObjectType           string            `json:"ObjectType,omitempty"` // "" or "Appendable"
	StorageClass         string            `json:"StorageClass,omitempty"`
	Restore              string            `json:"Restore,omitempty"`
	Metadata             map[string]string `json:"Metadata,omitempty"`
	Tag                  string            `json:"Tag,omitempty"`
	SSECustomerAlgorithm string            `json:"SSECustomerAlgorithm,omitempty"`
	SSECustomerKeyMD5    string            `json:"SSECustomerKeyMD5,omitempty"`
	CSType               string            `json:"CSType,omitempty"`
}

ObjectMeta object metadata

type ObjectMetaV2

type ObjectMetaV2 struct {
	ETag                      string
	LastModified              time.Time
	DeleteMarker              bool
	SSECAlgorithm             string
	SSECKeyMD5                string
	VersionID                 string
	WebsiteRedirectLocation   string
	ObjectType                string
	HashCrc64ecma             uint64
	StorageClass              enum.StorageClassType
	Meta                      Metadata
	ContentLength             int64
	ContentType               string
	CacheControl              string
	ContentDisposition        string
	ContentEncoding           string
	ContentLanguage           string
	Expires                   time.Time
	ServerSideEncryption      string
	ServerSideEncryptionKeyID string
}

type ObjectTobeDeleted

type ObjectTobeDeleted struct {
	Key       string `json:"Key,omitempty"`
	VersionID string `json:"VersionId,omitempty"`
}

type Option

type Option func(*requestBuilder)

func WithACL

func WithACL(acl string) Option

WithACL set X-Tos-Acl header

used in Bucket.PutObject Bucket.CreateMultipartUpload Bucket.AppendObject

func WithACLGrantFullControl

func WithACLGrantFullControl(grantFullControl string) Option

WithACLGrantFullControl X-Tos-Grant-Full-Control header

used in Bucket.PutObject Bucket.CreateMultipartUpload Bucket.AppendObject

func WithACLGrantRead

func WithACLGrantRead(grantRead string) Option

WithACLGrantRead set X-Tos-Grant-Read header

used in Bucket.PutObject Bucket.CreateMultipartUpload Bucket.AppendObject

func WithACLGrantReadAcp

func WithACLGrantReadAcp(grantReadAcp string) Option

WithACLGrantReadAcp set X-Tos-Grant-Read-Acp header

used in Bucket.PutObject Bucket.CreateMultipartUpload Bucket.AppendObject

func WithACLGrantWrite

func WithACLGrantWrite(grantWrite string) Option

WithACLGrantWrite set X-Tos-Grant-Write header

used in Bucket.PutObject Bucket.CreateMultipartUpload Bucket.AppendObject

func WithACLGrantWriteAcp

func WithACLGrantWriteAcp(grantWriteAcp string) Option

WithACLGrantWriteAcp set X-Tos-Grant-Write-Acp header

used in Bucket.PutObject Bucket.CreateMultipartUpload Bucket.AppendObject

func WithCacheControl

func WithCacheControl(cacheControl string) Option

WithCacheControl set Cache-Control header

used in Bucket.PutObject Bucket.AppendObject
  Bucket.CreateMultipartUpload Bucket.SetObjectMeta

func WithContentDisposition

func WithContentDisposition(contentDisposition string) Option

WithContentDisposition set Content-Disposition header

used in Bucket.PutObject Bucket.AppendObject Bucket.CreateMultipartUpload Bucket.SetObjectMeta

func WithContentEncoding

func WithContentEncoding(contentEncoding string) Option

WithContentEncoding set Content-Encoding header

used in Bucket.PutObject Bucket.AppendObject Bucket.CreateMultipartUpload Bucket.SetObjectMeta

func WithContentLanguage

func WithContentLanguage(contentLanguage string) Option

WithContentLanguage set Content-Language header

used in Bucket.PutObject Bucket.AppendObject Bucket.CreateMultipartUpload Bucket.SetObjectMeta

func WithContentLength

func WithContentLength(length int64) Option

WithContentLength set Content-Length header

used in Bucket.PutObject Bucket.AppendObject Bucket.UploadPart

If the length of the content is known, it is better to add this option when Put, Append or Upload.

func WithContentMD5

func WithContentMD5(contentMD5 string) Option

WithContentMD5 set Content-MD5 header

func WithContentSHA256

func WithContentSHA256(contentSHA256 string) Option

WithContentSHA256 set X-Tos-Content-Sha256 header

func WithContentType

func WithContentType(contentType string) Option

WithContentType set Content-Type header

used in Bucket.PutObject Bucket.AppendObject Bucket.CreateMultipartUpload Bucket.SetObjectMeta

func WithCopySourceIfMatch

func WithCopySourceIfMatch(ifMatch string) Option

WithCopySourceIfMatch set X-Tos-Copy-Source-If-Match header

used in Bucket.CopyObject Bucket.CopyObjectTo Bucket.CopyObjectFrom Bucket.UploadPartCopy

func WithCopySourceIfModifiedSince

func WithCopySourceIfModifiedSince(ifModifiedSince string) Option

WithCopySourceIfModifiedSince set X-Tos-Copy-Source-If-Modified-Since header

used in Bucket.CopyObject Bucket.CopyObjectTo Bucket.CopyObjectFrom Bucket.UploadPartCopy

func WithCopySourceIfNoneMatch

func WithCopySourceIfNoneMatch(ifNoneMatch string) Option

WithCopySourceIfNoneMatch set X-Tos-Copy-Source-If-None-Match

used in Bucket.CopyObject Bucket.CopyObjectTo Bucket.CopyObjectFrom Bucket.UploadPartCopy

func WithCopySourceIfUnmodifiedSince

func WithCopySourceIfUnmodifiedSince(ifUnmodifiedSince string) Option

WithCopySourceIfUnmodifiedSince set X-Tos-Copy-Source-If-Unmodified-Since header

used in Bucket.CopyObject Bucket.CopyObjectTo Bucket.CopyObjectFrom Bucket.UploadPartCopy

func WithExpires

func WithExpires(expires time.Time) Option

WithExpires set Expires header

used in Bucket.PutObject Bucket.AppendObject Bucket.CreateMultipartUpload Bucket.SetObjectMeta

func WithHeader

func WithHeader(key, value string) Option

WithHeader add request http header.

NOTICE: use it carefully.

func WithIfMatch

func WithIfMatch(ifMatch string) Option

WithIfMatch set If-Match header

func WithIfModifiedSince

func WithIfModifiedSince(since time.Time) Option

WithIfModifiedSince set If-Modified-Since header

used in Bucket.GetObject Bucket.HeadObject

func WithIfNoneMatch

func WithIfNoneMatch(ifNoneMatch string) Option

WithIfNoneMatch set If-None-Match header

func WithIfUnmodifiedSince

func WithIfUnmodifiedSince(since time.Time) Option

WithIfUnmodifiedSince set If-Unmodified-Since header

used in Bucket.GetObject Bucket.HeadObject

func WithMeta

func WithMeta(key, value string) Option

WithMeta set meta header

used in Bucket.PutObject Bucket.CreateMultipartUpload Bucket.AppendObject Bucket.SetObjectMeta

func WithMetadataDirective

func WithMetadataDirective(directive string) Option

WithMetadataDirective set X-Tos-Metadata-Directive header

used in Bucket.CopyObject Bucket.CopyObjectTo Bucket.CopyObjectFrom

func WithPerRequestSigner

func WithPerRequestSigner(signer Signer) Option

WithPerRequestSigner set Signer for a request

use this option when you need set request-level signature parameter(s). for example, use different ak and sk for each request.

if 'signer' set to nil, the request will not be signed.

func WithQuery

func WithQuery(key, value string) Option

WithQuery add request query parameter

NOTICE: use it carefully.

func WithRange

func WithRange(start, end int64) Option

WithRange set Range header

used in Bucket.GetObject Bucket.HeadObject

func WithServerSideEncryptionCustomer

func WithServerSideEncryptionCustomer(ssecAlgorithm, ssecKey, ssecKeyMD5 string) Option

WithServerSideEncryptionCustomer set server-side-encryption parameters

used in Bucket.PutObject Bucket.CreateMultipartUpload

func WithVersionID

func WithVersionID(versionID string) Option

WithVersionID set version parameter

used in Bucket.GetObject Bucket.HeadObject Bucket.DeleteObject
  Bucket.GetObjectAcl Bucket.SetObjectMeta
  Bucket.CopyObject Bucket.CopyObjectTo Bucket.CopyObjectFrom
  Client.PreSignedURL

func WithWebsiteRedirectLocation

func WithWebsiteRedirectLocation(redirectLocation string) Option

WithWebsiteRedirectLocation set X-Tos-Website-Redirect-Location header

type Owner

type Owner struct {
	ID          string `json:"ID,omitempty"`
	DisplayName string `json:"DisplayName,omitempty"`
}

type PolicySignatureCondition added in v2.4.5

type PolicySignatureCondition struct {
	Key      string
	Value    string
	Operator *string
}

type PostSignatureCondition added in v2.4.0

type PostSignatureCondition struct {
	Key      string
	Value    string
	Operator *string
}

type PreSignedPolicyURLGenerator added in v2.4.5

type PreSignedPolicyURLGenerator interface {
	GetSignedURLForList(bucket string, additionalQuery map[string]string) string
	GetSignedURLForGetOrHead(bucket, key string, additionalQuery map[string]string) string
}

type PreSignedURLInput

type PreSignedURLInput struct {
	HTTPMethod          enum.HttpMethodType
	Bucket              string
	Key                 string
	Expires             int64 // Expiration time in seconds, default 3600 seconds, max 7 days, range [1, 604800]
	Header              map[string]string
	Query               map[string]string
	AlternativeEndpoint string
	IsCustomDomain      *bool
}

type PreSignedURLOutput

type PreSignedURLOutput struct {
	SignedUrl    string            //  Pre-signed URL
	SignedHeader map[string]string // The actual header fields contained in the pre-signature
}

type PreSingedPolicyURLInput added in v2.4.5

type PreSingedPolicyURLInput struct {
	Bucket              string
	Expires             int64
	Conditions          []PolicySignatureCondition
	AlternativeEndpoint string
	IsCustomDomain      bool
}

type PreSingedPolicyURLOutput added in v2.4.5

type PreSingedPolicyURLOutput struct {
	PreSignedPolicyURLGenerator
	SignatureQuery string
	// contains filtered or unexported fields
}

func (*PreSingedPolicyURLOutput) GetSignedURLForGetOrHead added in v2.4.5

func (output *PreSingedPolicyURLOutput) GetSignedURLForGetOrHead(key string, additionalQuery map[string]string) string

func (*PreSingedPolicyURLOutput) GetSignedURLForList added in v2.4.5

func (output *PreSingedPolicyURLOutput) GetSignedURLForList(additionalQuery map[string]string) string

type PreSingedPostSignatureInput added in v2.4.0

type PreSingedPostSignatureInput struct {
	Bucket             string
	Key                string
	Expires            int64
	Conditions         []PostSignatureCondition
	ContentLengthRange *ContentLengthRange
}

type PreSingedPostSignatureOutput added in v2.4.0

type PreSingedPostSignatureOutput struct {
	OriginPolicy string
	Policy       string
	Algorithm    string
	Credential   string
	Date         string
	Signature    string
}

type Progress added in v2.5.0

type Progress struct {
	HistoricalObject float64 `json:"HistoricalObject"`
	NewObject        string  `json:"NewObject"`
}

type Proxy

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

func NewProxy

func NewProxy(proxyHost string, proxyPort int) (*Proxy, error)

func (*Proxy) Url added in v2.3.0

func (p *Proxy) Url() *url.URL

func (*Proxy) WithAuth

func (p *Proxy) WithAuth(username string, password string)

type PublicSource added in v2.4.0

type PublicSource struct {
	SourceEndpoint SourceEndpoint `json:"SourceEndpoint,omitempty"`
	FixedEndpoint  bool           `json:"FixedEndpoint,omitempty"`
}

type PutBucketACLInput added in v2.4.0

type PutBucketACLInput struct {
	Bucket           string
	ACLType          enum.ACLType `location:"header" locationName:"X-Tos-Acl"`                // optional
	GrantFullControl string       `location:"header" locationName:"X-Tos-Grant-Full-Control"` // optional
	GrantRead        string       `location:"header" locationName:"X-Tos-Grant-Read"`         // optional
	GrantReadAcp     string       `location:"header" locationName:"X-Tos-Grant-Read-Acp"`     // optional
	GrantWrite       string       `location:"header" locationName:"X-Tos-Grant-Write"`        // optional
	GrantWriteAcp    string       `location:"header" locationName:"X-Tos-Grant-Write-Acp"`    // optional

	Owner  Owner     `json:"Owner,omitempty"`
	Grants []GrantV2 `json:"Grants,omitempty"`
}

type PutBucketACLOutput added in v2.4.0

type PutBucketACLOutput struct {
	RequestInfo
}

type PutBucketCORSInput added in v2.1.10

type PutBucketCORSInput struct {
	Bucket    string     `json:"-"`
	CORSRules []CorsRule `json:"CORSRules,omitempty"`
}

type PutBucketCORSOutput added in v2.1.10

type PutBucketCORSOutput struct {
	RequestInfo `json:"-"`
}

type PutBucketCustomDomainInput added in v2.5.0

type PutBucketCustomDomainInput struct {
	Bucket string
	Rule   CustomDomainRule
}

type PutBucketCustomDomainOutput added in v2.5.0

type PutBucketCustomDomainOutput struct {
	RequestInfo
}

type PutBucketLifecycleInput added in v2.4.0

type PutBucketLifecycleInput struct {
	Bucket string
	Rules  []LifecycleRule `json:"Rules,omitempty"`
}

type PutBucketMirrorBackInput added in v2.4.0

type PutBucketMirrorBackInput struct {
	Bucket string
	Rules  []MirrorBackRule
}

type PutBucketMirrorBackOutput added in v2.4.0

type PutBucketMirrorBackOutput struct {
	RequestInfo
}

type PutBucketNotificationInput added in v2.5.0

type PutBucketNotificationInput struct {
	Bucket                      string                       `json:"-"`
	CloudFunctionConfigurations []CloudFunctionConfiguration `json:"CloudFunctionConfigurations"`
	RocketMQConfigurations      []RocketMQConfiguration      `json:"RocketMQConfigurations"`
}

type PutBucketNotificationOutput added in v2.5.0

type PutBucketNotificationOutput struct {
	RequestInfo
}

type PutBucketNotificationType2Input added in v2.6.6

type PutBucketNotificationType2Input struct {
	Bucket  string
	Rules   []NotificationRule `json:"Rules"`
	Version string             `json:"Version"`
}

type PutBucketNotificationType2Output added in v2.6.6

type PutBucketNotificationType2Output struct {
	RequestInfo
}

type PutBucketPolicyOutput

type PutBucketPolicyOutput struct {
	RequestInfo `json:"-"`
}

type PutBucketPolicyV2Input added in v2.4.0

type PutBucketPolicyV2Input struct {
	Bucket string `json:"-"`
	Policy string `json:"Policy,omitempty"`
}

type PutBucketPolicyV2Output added in v2.4.0

type PutBucketPolicyV2Output struct {
	RequestInfo `json:"-"`
}

type PutBucketRealTimeLogInput added in v2.5.0

type PutBucketRealTimeLogInput struct {
	Bucket        string
	Configuration RealTimeLogConfiguration
}

type PutBucketRealTimeLogOutput added in v2.5.0

type PutBucketRealTimeLogOutput struct {
	RequestInfo
}

type PutBucketRenameInput added in v2.5.4

type PutBucketRenameInput struct {
	Bucket       string `json:"-"`
	RenameEnable bool   `json:"RenameEnable"`
}

type PutBucketRenameOutput added in v2.5.4

type PutBucketRenameOutput struct {
	RequestInfo
}

type PutBucketReplicationInput added in v2.5.0

type PutBucketReplicationInput struct {
	Bucket string
	Role   string
	Rules  []ReplicationRule
}

type PutBucketReplicationOutput added in v2.5.0

type PutBucketReplicationOutput struct {
	RequestInfo
}

type PutBucketStorageClassInput added in v2.4.0

type PutBucketStorageClassInput struct {
	Bucket       string
	StorageClass enum.StorageClassType `location:"header" locationName:"X-Tos-Storage-Class"`
}

type PutBucketStorageClassOutput added in v2.4.0

type PutBucketStorageClassOutput struct {
	RequestInfo
}

type PutBucketTaggingInput added in v2.6.6

type PutBucketTaggingInput struct {
	Bucket string
	TagSet TagSet
}

type PutBucketTaggingOutput added in v2.6.6

type PutBucketTaggingOutput struct {
	RequestInfo
}

type PutBucketVersioningInput added in v2.5.0

type PutBucketVersioningInput struct {
	Bucket string
	Status enum.VersioningStatusType
}

type PutBucketVersioningOutput added in v2.5.0

type PutBucketVersioningOutput struct {
	RequestInfo
}

type PutBucketWebsiteInput added in v2.5.0

type PutBucketWebsiteInput struct {
	Bucket                string
	RedirectAllRequestsTo *RedirectAllRequestsTo `json:"RedirectAllRequestsTo,omitempty"`
	IndexDocument         *IndexDocument         `json:"IndexDocument,omitempty"`
	ErrorDocument         *ErrorDocument         `json:"ErrorDocument,omitempty"`
	RoutingRules          *RoutingRules          `json:"RoutingRules,omitempty"`
}

type PutBucketWebsiteOutput added in v2.5.0

type PutBucketWebsiteOutput struct {
	RequestInfo
}

type PutFetchTaskInput added in v2.1.8

type PutFetchTaskInput struct {
	URL           string `json:"URL,omitempty"`           // required
	Object        string `json:"Object,omitempty"`        // object key, required
	IgnoreSameKey bool   `json:"IgnoreSameKey,omitempty"` // optional, default value is false
	ContentMD5    string `json:"ContentMD5,omitempty"`    // hex-encoded md5, optional
}

type PutFetchTaskInputV2 added in v2.4.0

type PutFetchTaskInputV2 struct {
	Bucket string
	Key    string

	ACL              enum.ACLType          `location:"header" locationName:"X-Tos-Acl"`
	GrantFullControl string                `location:"header" locationName:"X-Tos-Grant-Full-Control"`
	GrantRead        string                `location:"header" locationName:"X-Tos-Grant-Read"`
	GrantReadACP     string                `location:"header" locationName:"X-Tos-Grant-Read-Acp"`
	GrantWriteACP    string                `location:"header" locationName:"X-Tos-Grant-Write-Acp"`
	StorageClass     enum.StorageClassType `location:"header" locationName:"X-Tos-Storage-Class"`
	SSECAlgorithm    string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Algorithm"`
	SSECKey          string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key"`
	SSECKeyMD5       string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key-MD5"`
	Meta             map[string]string     `location:"headers"`

	URL           string `json:"URL,omitempty"`
	IgnoreSameKey bool   `json:"IgnoreSameKey,omitempty"`
	HexMD5        string `json:"ContentMD5,omitempty"`
}

type PutFetchTaskOutput added in v2.1.8

type PutFetchTaskOutput struct {
	RequestInfo `json:"-"`
	TaskID      string `json:"TaskId,omitempty"`
}

type PutFetchTaskOutputV2 added in v2.4.0

type PutFetchTaskOutputV2 struct {
	RequestInfo
	TaskID string
}

type PutLifecycleOutput added in v2.4.0

type PutLifecycleOutput struct {
	RequestInfo
}

type PutObjectACLInput

type PutObjectACLInput struct {
	Bucket           string
	Key              string       // the object, required
	VersionID        string       `location:"query" locationName:"versionId"`                 // optional
	ACL              enum.ACLType `location:"header" locationName:"X-Tos-Acl"`                // optional
	GrantFullControl string       `location:"header" locationName:"X-Tos-Grant-Full-Control"` // optional
	GrantRead        string       `location:"header" locationName:"X-Tos-Grant-Read"`         // optional
	GrantReadAcp     string       `location:"header" locationName:"X-Tos-Grant-Read-Acp"`     // optional

	// Deprecated
	GrantWrite           string `location:"header" locationName:"X-Tos-Grant-Write"`     // optional
	GrantWriteAcp        string `location:"header" locationName:"X-Tos-Grant-Write-Acp"` // optional
	Owner                Owner
	Grants               []GrantV2
	BucketOwnerEntrusted bool
}

type PutObjectACLOutput

type PutObjectACLOutput struct {
	PutObjectAclOutput
}

type PutObjectAclInput

type PutObjectAclInput struct {
	Key       string          `json:"Key,omitempty"`       // the object, required
	VersionID string          `json:"VersionId,omitempty"` // the version id of the object, optional
	AclGrant  *ObjectAclGrant `json:"AclGrant,omitempty"`  // set acl by header
	AclRules  *ObjectAclRules `json:"AclRules,omitempty"`  // set acl by rules
}

PutObjectAclInput AclGrant, AclRules can not set both.

type PutObjectAclOutput

type PutObjectAclOutput struct {
	RequestInfo `json:"-"`
}

type PutObjectBasicInput

type PutObjectBasicInput struct {
	Bucket             string
	Key                string
	ContentLength      int64        `location:"header" locationName:"Content-Length"`
	ContentMD5         string       `location:"header" locationName:"Content-MD5"`
	ContentSHA256      string       `location:"header" locationName:"X-Tos-Content-Sha256"`
	CacheControl       string       `location:"header" locationName:"Cache-Control"`
	ContentDisposition string       `location:"header" locationName:"Content-Disposition" encodeChinese:"true"`
	ContentEncoding    string       `location:"header" locationName:"Content-Encoding"`
	ContentLanguage    string       `location:"header" locationName:"Content-Language"`
	ContentType        string       `location:"header" locationName:"Content-Type"`
	Expires            time.Time    `location:"header" locationName:"Expires"`
	ACL                enum.ACLType `location:"header" locationName:"X-Tos-Acl"`

	GrantFullControl string `location:"header" locationName:"X-Tos-Grant-Full-Control"` // optional
	GrantRead        string `location:"header" locationName:"X-Tos-Grant-Read"`         // optional
	GrantReadAcp     string `location:"header" locationName:"X-Tos-Grant-Read-Acp"`     // optional
	GrantWriteAcp    string `location:"header" locationName:"X-Tos-Grant-Write-Acp"`    // optional

	Callback                  string                `location:"header" locationName:"X-Tos-Callback"`
	CallbackVar               string                `location:"header" locationName:"X-Tos-Callback-Var"`
	WebsiteRedirectLocation   string                `location:"header" locationName:"X-Tos-Website-Redirect-Location"`
	StorageClass              enum.StorageClassType `location:"header" locationName:"X-Tos-Storage-Class"`
	SSECAlgorithm             string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Algorithm"`
	SSECKey                   string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key"`
	SSECKeyMD5                string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key-MD5"`
	ServerSideEncryption      string                `location:"header" locationName:"X-Tos-Server-Side-Encryption"`
	ServerSideEncryptionKeyID string                `location:"header" locationName:"X-Tos-Server-Side-Encryption-Kms-Key-Id"`
	TrafficLimit              int64                 `location:"header" locationName:"X-Tos-Traffic-Limit"`
	ForbidOverwrite           bool                  `location:"header" locationName:"X-Tos-Forbid-Overwrite"`
	IfMatch                   string                `location:"header" locationName:"X-Tos-If-Match"`
	Meta                      map[string]string     `location:"headers"`
	DataTransferListener      DataTransferListener
	RateLimiter               RateLimiter
}

type PutObjectFromFileInput

type PutObjectFromFileInput struct {
	PutObjectBasicInput
	FilePath string
}

type PutObjectFromFileOutput

type PutObjectFromFileOutput struct {
	PutObjectV2Output
}

type PutObjectOutput

type PutObjectOutput struct {
	RequestInfo          `json:"-"`
	ETag                 string `json:"ETag,omitempty"`
	VersionID            string `json:"VersionId,omitempty"`
	SSECustomerAlgorithm string `json:"SSECustomerAlgorithm,omitempty"`
	SSECustomerKeyMD5    string `json:"SSECustomerKeyMD5,omitempty"`
}

type PutObjectTaggingInput added in v2.4.0

type PutObjectTaggingInput struct {
	Bucket    string
	Key       string
	VersionID string `location:"query" locationName:"versionId"`
	TagSet    TagSet `json:"TagSet"`
}

type PutObjectTaggingOutput added in v2.4.0

type PutObjectTaggingOutput struct {
	RequestInfo
	VersionID string
}

type PutObjectV2Input

type PutObjectV2Input struct {
	PutObjectBasicInput
	Content io.Reader
}

type PutObjectV2Output

type PutObjectV2Output struct {
	RequestInfo
	ETag                      string
	SSECAlgorithm             string
	SSECKeyMD5                string
	VersionID                 string
	CallbackResult            string
	HashCrc64ecma             uint64
	ServerSideEncryption      string
	ServerSideEncryptionKeyID string
}

type Range

type Range struct {
	Start int64
	End   int64
}

Range represents a range of an object

func (*Range) String

func (hr *Range) String() string

HTTP Range header

type RateLimiter

type RateLimiter interface {
	// Acquire try to get a token.
	// If ok, caller can read want bytes, else wait timeToWait and try again.
	Acquire(want int64) (ok bool, timeToWait time.Duration)
}

func NewDefaultRateLimit added in v2.5.0

func NewDefaultRateLimit(rate int64, capacity int64) RateLimiter

type ReadCloserWithLimiter

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

ReadCloserWithLimiter warp io.ReadCloser with DataTransferListener

func (*ReadCloserWithLimiter) Close

func (r *ReadCloserWithLimiter) Close() error

func (*ReadCloserWithLimiter) Read

func (r *ReadCloserWithLimiter) Read(p []byte) (n int, err error)

func (*ReadCloserWithLimiter) Seek added in v2.5.0

func (r *ReadCloserWithLimiter) Seek(offset int64, whence int) (int64, error)

type RealTimeLogConfiguration added in v2.5.0

type RealTimeLogConfiguration struct {
	Role          string                 `json:"Role"`
	Configuration AccessLogConfiguration `json:"AccessLogConfiguration"`
}

type Redirect added in v2.4.0

type Redirect struct {
	RedirectType          enum.RedirectType `json:"RedirectType,omitempty"`
	FetchSourceOnRedirect bool              `json:"FetchSourceOnRedirect,omitempty"`
	PassQuery             bool              `json:"PassQuery,omitempty"`
	FollowRedirect        bool              `json:"FollowRedirect,omitempty"`
	MirrorHeader          MirrorHeader      `json:"MirrorHeader,omitempty"`
	PublicSource          PublicSource      `json:"PublicSource,omitempty"`
	Transform             Transform         `json:"Transform,omitempty"`
}

type RedirectAllRequestsTo added in v2.5.0

type RedirectAllRequestsTo struct {
	HostName string `json:"HostName"`
	Protocol string `json:"Protocol,omitempty"`
}

type RenameObjectInput added in v2.5.4

type RenameObjectInput struct {
	Bucket string
	Key    string
	NewKey string `location:"query" locationName:"name"`
}

type RenameObjectOutput added in v2.5.4

type RenameObjectOutput struct {
	RequestInfo
}

type ReplaceKeyPrefix added in v2.6.0

type ReplaceKeyPrefix struct {
	KeyPrefix   string `json:"KeyPrefix,omitempty"`
	ReplaceWith string `json:"ReplaceWith,omitempty"`
}

type ReplicationRule added in v2.5.0

type ReplicationRule struct {
	ID                          string          `json:"ID"`
	Status                      enum.StatusType `json:"Status"`
	PrefixSet                   []string        `json:"PrefixSet,omitempty"`
	Destination                 Destination     `json:"Destination"`
	HistoricalObjectReplication enum.StatusType `json:"HistoricalObjectReplication"`
}

type ReplicationRuleWithProgress added in v2.5.0

type ReplicationRuleWithProgress struct {
	ReplicationRule
	Progress *Progress `json:"Progress,omitempty"`
}

type Request

type Request struct {
	Scheme        string
	Method        string
	Host          string
	Path          string
	ContentLength *int64
	Content       io.Reader
	Query         url.Values
	Header        http.Header
	// contains filtered or unexported fields
}

func (*Request) URL

func (req *Request) URL() string

type RequestInfo

type RequestInfo struct {
	RequestID  string
	ID2        string
	StatusCode int
	Header     http.Header
}

type Response

type Response struct {
	StatusCode    int
	ContentLength int64
	Header        http.Header
	Body          io.ReadCloser
	RequestUrl    string
}

func (*Response) Close

func (r *Response) Close() error

func (*Response) RequestInfo

func (r *Response) RequestInfo() RequestInfo

type RestoreJobParameters added in v2.6.0

type RestoreJobParameters struct {
	Tier enum.TierType `json:"Tier"`
}

type RestoreObjectInput added in v2.6.0

type RestoreObjectInput struct {
	Bucket               string
	Key                  string
	VersionID            string `location:"query" locationName:"versionId"`
	Days                 int
	RestoreJobParameters *RestoreJobParameters
}

type RestoreObjectOutput added in v2.6.0

type RestoreObjectOutput struct {
	RequestInfo
}

type ResumableCopyObjectInput added in v2.5.0

type ResumableCopyObjectInput struct {
	CreateMultipartUploadV2Input

	SrcBucket    string
	SrcKey       string
	SrcVersionID string

	CopySourceIfMatch           string
	CopySourceIfModifiedSince   time.Time
	CopySourceIfNoneMatch       string
	CopySourceIfUnmodifiedSince time.Time

	CopySourceSSECAlgorithm string
	CopySourceSSECKey       string
	CopySourceSSECKeyMD5    string

	PartSize         int64
	TaskNum          int
	EnableCheckpoint bool
	CheckpointFile   string
	TrafficLimit     int64

	CopyEventListener CopyEventListener
	CancelHook        CancelHook
}

type ResumableCopyObjectOutput added in v2.5.0

type ResumableCopyObjectOutput struct {
	RequestInfo
	Bucket        string
	Key           string
	UploadID      string
	Etag          string
	Location      string
	VersionID     string
	HashCrc64ecma uint64
	SSECAlgorithm string
	SSECKeyMD5    string
	EncodingType  string
}

type RocketMQConf added in v2.5.5

type RocketMQConf struct {
	InstanceID  string `json:"InstanceId"`
	Topic       string `json:"Topic"`
	AccessKeyID string `json:"AccessKeyId"`
}

type RocketMQConfiguration added in v2.5.5

type RocketMQConfiguration struct {
	ID       string       `json:"RuleId"`
	Role     string       `json:"Role"`
	Events   []string     `json:"Events"`
	Filter   Filter       `json:"Filter"`
	RocketMQ RocketMQConf `json:"RocketMQ"`
}

type RoutingRule added in v2.5.0

type RoutingRule struct {
	Condition RoutingRuleCondition `json:"Condition"`
	Redirect  RoutingRuleRedirect  `json:"Redirect"`
}

type RoutingRuleCondition added in v2.5.0

type RoutingRuleCondition struct {
	KeyPrefixEquals             string `json:"KeyPrefixEquals,omitempty"`
	HttpErrorCodeReturnedEquals int    `json:"HttpErrorCodeReturnedEquals,omitempty"`
}

type RoutingRuleRedirect added in v2.5.0

type RoutingRuleRedirect struct {
	Protocol             enum.ProtocolType `json:"Protocol,omitempty"`
	HostName             string            `json:"HostName,omitempty"`
	ReplaceKeyPrefixWith string            `json:"ReplaceKeyPrefixWith,omitempty"`
	ReplaceKeyWith       string            `json:"ReplaceKeyWith,omitempty"`
	HttpRedirectCode     int               `json:"HttpRedirectCode,omitempty"`
}

type RoutingRules added in v2.5.0

type RoutingRules struct {
	Rules []RoutingRule `json:"RoutingRules,omitempty"`
}

type SSEHeaders

type SSEHeaders struct {
	SSECAlgorithm        string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Algorithm"`
	SSECKey              string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key"`
	SSECKeyMD5           string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key-MD5"`
	ServerSideEncryption string `location:"header" locationName:"X-Tos-Server-Side-Encryption"`
}

type SerializeError

type SerializeError struct {
	RequestID string `json:"RequestId,omitempty"`
	Message   string `json:"Message,omitempty"`
}

func (*SerializeError) Error

func (se *SerializeError) Error() string

type ServerErrorClassifier

type ServerErrorClassifier struct{}

ServerErrorClassifier classify errors returned by POST method. If the error is nil, it returns NoRetry; if the error can be interpreted as TosServerError and its StatusCode is 5xx or 429, it returns Retry; otherwise, it returns NoRetry.

func (ServerErrorClassifier) Classify

func (classifier ServerErrorClassifier) Classify(err error) retryAction

Classify implements the classifier interface.

type SetObjectMetaInput

type SetObjectMetaInput struct {
	Bucket    string
	Key       string
	VersionID string `location:"query" locationName:"versionId"`

	CacheControl       string    `location:"header" locationName:"Cache-Control"`
	ContentDisposition string    `location:"header" locationName:"Content-Disposition"`
	ContentEncoding    string    `location:"header" locationName:"Content-Encoding"`
	ContentLanguage    string    `location:"header" locationName:"Content-Language"`
	ContentType        string    `location:"header" locationName:"Content-Type"`
	Expires            time.Time `location:"header" locationName:"Expires"`

	Meta map[string]string `location:"headers"`
}

type SetObjectMetaOutput

type SetObjectMetaOutput struct {
	RequestInfo `json:"-"`
}

type SignV4

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

func NewSignV4

func NewSignV4(credentials Credentials, region string) *SignV4

NewSignV4 create SignV4 use WithSignKey to set self-defined sign-key generator use WithSignLogger to set logger

func (*SignV4) SignHeader

func (sv *SignV4) SignHeader(req *Request) http.Header

func (*SignV4) SignQuery

func (sv *SignV4) SignQuery(req *Request, ttl time.Duration) url.Values

func (*SignV4) WithSignLogger added in v2.2.0

func (sv *SignV4) WithSignLogger(logger Logger)

func (*SignV4) WithSigningKey

func (sv *SignV4) WithSigningKey(signingKey func(*SigningKeyInfo) []byte)

WithSigningKey for self-defined sign-key generator

type SignV4Option added in v2.2.0

type SignV4Option func(*SignV4)

type Signer

type Signer interface {
	SignHeader(req *Request) http.Header

	SignQuery(req *Request, ttl time.Duration) url.Values
}

type SigningKeyInfo

type SigningKeyInfo struct {
	Date       string
	Region     string
	Credential *Credential
}

type SourceEndpoint added in v2.4.0

type SourceEndpoint struct {
	Primary  []string `json:"Primary,omitempty"`
	Follower []string `json:"Follower,omitempty"`
}

type StaticCredentials

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

StaticCredentials Credentials with static access-key and secret-key

func NewStaticCredentials

func NewStaticCredentials(accessKeyID, accessKeySecret string) *StaticCredentials

NewStaticCredentials Credentials with static access-key and secret-key

use StaticCredentials.WithSecurityToken to set security-token

you can use it as:

client, err := tos.NewClient(endpoint, tos.WithCredentials(tos.NewStaticCredentials(accessKey, secretKey)))
// do something more

And you can use tos.WithPerRequestSigner set the 'Signer' for each request.

func (*StaticCredentials) Credential

func (sc *StaticCredentials) Credential() Credential

func (*StaticCredentials) WithSecurityToken

func (sc *StaticCredentials) WithSecurityToken(securityToken string)

WithSecurityToken set security-token

type StatusCodeClassifier

type StatusCodeClassifier struct{}

StatusCodeClassifier classifies Errors. If the error is nil, it returns NoRetry; if the error is TimeoutException or can be interpreted as TosServerError, and the StatusCode is 5xx or 429, it returns Retry; otherwise, it returns NoRetry.

func (StatusCodeClassifier) Classify

func (classifier StatusCodeClassifier) Classify(err error) retryAction

Classify implements the classifier interface.

type Tag added in v2.4.0

type Tag struct {
	Key   string `json:"Key"`
	Value string `json:"Value"`
}

type TagSet added in v2.4.0

type TagSet struct {
	Tags []Tag
}

type TimeoutConn

type TimeoutConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewTimeoutConn

func NewTimeoutConn(conn net.Conn, readTimeout, writeTimeout time.Duration) *TimeoutConn

func (*TimeoutConn) Read

func (tc *TimeoutConn) Read(b []byte) (n int, err error)

func (*TimeoutConn) Write

func (tc *TimeoutConn) Write(b []byte) (n int, err error)

type TimeoutDialer

type TimeoutDialer struct {
	net.Dialer

	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	// contains filtered or unexported fields
}

func (*TimeoutDialer) DialContext

func (d *TimeoutDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

type TosClientError

type TosClientError struct {
	TosError
	Cause error
}

type TosError

type TosError struct {
	Message    string
	RequestUrl string
}

func (*TosError) Error

func (e *TosError) Error() string

type TosServerError

type TosServerError struct {
	TosError    `json:"TosError"`
	RequestInfo `json:"RequestInfo"`
	Code        string `json:"Code,omitempty"`
	HostID      string `json:"HostID,omitempty"`
	Resource    string `json:"Resource,omitempty"`
	EC          string `json:"EC,omitempty"`
}

服务端错误定义参考:https://www.volcengine.com/docs/6349/74874

type Transform added in v2.6.0

type Transform struct {
	WithKeyPrefix    string           `json:"WithKeyPrefix,omitempty"`
	WithKeySuffix    string           `json:"WithKeySuffix,omitempty"`
	ReplaceKeyPrefix ReplaceKeyPrefix `json:"ReplaceKeyPrefix,omitempty"`
}

type Transition added in v2.4.0

type Transition struct {
	Days         int                   `json:"Days,omitempty"`
	Date         time.Time             `json:"Date,omitempty"`
	StorageClass enum.StorageClassType `json:"StorageClass,omitempty"`
}

type Transport

type Transport interface {
	RoundTrip(context.Context, *Request) (*Response, error)
}

type TransportConfig

type TransportConfig struct {

	// MaxIdleConns same as http.Transport MaxIdleConns. Default is 1024.
	MaxIdleConns int

	// MaxIdleConnsPerHost same as http.Transport MaxIdleConnsPerHost. Default is 1024.
	MaxIdleConnsPerHost int

	// MaxConnsPerHost same as http.Transport MaxConnsPerHost. Default is no limit.
	MaxConnsPerHost int

	// RequestTimeout same as http.Client Timeout
	// Deprecated: use ReadTimeout or WriteTimeout instead
	RequestTimeout time.Duration

	// DialTimeout same as net.Dialer Timeout
	DialTimeout time.Duration

	// KeepAlive same as net.Dialer KeepAlive
	KeepAlive time.Duration

	// IdleConnTimeout same as http.Transport IdleConnTimeout
	IdleConnTimeout time.Duration

	// TLSHandshakeTimeout same as http.Transport TLSHandshakeTimeout
	TLSHandshakeTimeout time.Duration

	// ResponseHeaderTimeout same as http.Transport ResponseHeaderTimeout
	ResponseHeaderTimeout time.Duration

	// ExpectContinueTimeout same as http.Transport ExpectContinueTimeout
	ExpectContinueTimeout time.Duration

	// ReadTimeout see net.Conn SetReadDeadline
	ReadTimeout time.Duration

	// WriteTimeout set net.Conn SetWriteDeadline
	WriteTimeout time.Duration

	// InsecureSkipVerify set tls.Config InsecureSkipVerify
	InsecureSkipVerify bool

	// DNSCacheTime Set Dns Cache Time.
	DNSCacheTime time.Duration

	// Proxy Set http proxy for http client.
	Proxy *Proxy

	//  When HighLatencyLogThreshold is greater than 0, it indicates the activation of high-latency logging, unit: KB.
	HighLatencyLogThreshold *int
}

func DefaultTransportConfig

func DefaultTransportConfig() TransportConfig

type UnexpectedStatusCodeError

type UnexpectedStatusCodeError struct {
	StatusCode    int    `json:"StatusCode,omitempty"`
	ExpectedCodes []int  `json:"ExpectedCodes,omitempty"`
	RequestID     string `json:"RequestId,omitempty"`
	// contains filtered or unexported fields
}

func NewUnexpectedStatusCodeError

func NewUnexpectedStatusCodeError(statusCode int, expectedCode int, expectedCodes ...int) *UnexpectedStatusCodeError

func (*UnexpectedStatusCodeError) Error

func (us *UnexpectedStatusCodeError) Error() string

func (*UnexpectedStatusCodeError) GoString

func (us *UnexpectedStatusCodeError) GoString() string

func (*UnexpectedStatusCodeError) WithRequestBody added in v2.6.0

func (*UnexpectedStatusCodeError) WithRequestID

func (us *UnexpectedStatusCodeError) WithRequestID(requestID string) *UnexpectedStatusCodeError

type UploadCommonPrefix

type UploadCommonPrefix struct {
	Prefix string `json:"Prefix"`
}

type UploadEvent

type UploadEvent struct {
	Type           enum.UploadEventType
	Err            error // failed, aborted 事件发生时不为空
	Bucket         string
	Key            string
	UploadID       *string
	CheckpointFile *string // 断点续传文件全路径
	// upload part 相关事件发生时有值
	UploadPartInfo *UploadPartInfo
}

type UploadEventListener

type UploadEventListener interface {
	EventChange(event *UploadEvent)
}

type UploadFileInput

type UploadFileInput struct {
	CreateMultipartUploadV2Input

	FilePath         string
	PartSize         int64
	TaskNum          int
	EnableCheckpoint bool
	CheckpointFile   string
	TrafficLimit     int64 `location:"header" locationName:"X-Tos-Traffic-Limit"`

	DataTransferListener DataTransferListener
	UploadEventListener  UploadEventListener
	RateLimiter          RateLimiter
	// cancelHook 支持取消断点续传任务
	CancelHook CancelHook
}

type UploadFileOutput

type UploadFileOutput struct {
	RequestInfo
	Bucket        string
	Key           string
	UploadID      string
	ETag          string
	Location      string
	VersionID     string
	HashCrc64ecma uint64
	SSECAlgorithm string
	SSECKeyMD5    string
	EncodingType  string
}

type UploadInfo

type UploadInfo struct {
	Key          string `json:"Key,omitempty"`
	UploadId     string `json:"UploadId,omitempty"`
	Owner        Owner  `json:"Owner,omitempty"`
	StorageClass string `json:"StorageClass,omitempty"`
	Initiated    string `json:"Initiated,omitempty"`
}

type UploadPartBasicInput

type UploadPartBasicInput struct {
	Bucket     string
	Key        string
	UploadID   string `location:"query" locationName:"uploadId"`
	PartNumber int    `location:"query" locationName:"partNumber"`

	ContentMD5 string `location:"header" locationName:"Content-MD5"`

	SSECAlgorithm             string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Algorithm"`
	SSECKey                   string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key"`
	SSECKeyMD5                string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key-MD5"`
	ServerSideEncryption      string `location:"header" locationName:"X-Tos-Server-Side-Encryption"`
	ServerSideEncryptionKeyID string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Kms-Key-Id"`

	TrafficLimit int64 `location:"header" locationName:"X-Tos-Traffic-Limit"`

	DataTransferListener DataTransferListener
	RateLimiter          RateLimiter
}

type UploadPartCopyInput

type UploadPartCopyInput struct {
	UploadID        string `json:"UploadId,omitempty"`
	DestinationKey  string `json:"DestinationKey,omitempty"`
	SourceBucket    string `json:"SourceBucket,omitempty"`
	SourceKey       string `json:"SourceKey,omitempty"`
	SourceVersionID string `json:"SourceVersionId,omitempty"` // optional
	StartOffset     *int64 `json:"StartOffset,omitempty"`     // optional
	PartSize        *int64 `json:"PartSize,omitempty"`        // optional
	PartNumber      int    `json:"PartNumber,omitempty"`
}

type UploadPartCopyOutput

type UploadPartCopyOutput struct {
	RequestInfo     `json:"-"`
	VersionID       string `json:"VersionId,omitempty"`
	SourceVersionID string `json:"SourceVersionId,omitempty"`
	PartNumber      int    `json:"PartNumber,omitempty"`
	ETag            string `json:"ETag,omitempty"`
	LastModified    string `json:"LastModified,omitempty"`
}

type UploadPartCopyV2Input

type UploadPartCopyV2Input struct {
	Bucket     string
	Key        string
	UploadID   string `location:"query" locationName:"uploadId"`
	PartNumber int    `location:"query" locationName:"partNumber"`

	SrcBucket            string
	SrcKey               string
	SrcVersionID         string `location:"query" locationName:"versionId"`
	CopySourceRangeStart int64
	CopySourceRangeEnd   int64
	CopySourceRange      string

	CopySourceIfMatch           string    `location:"header" locationName:"X-Tos-Copy-Source-If-Match"`
	CopySourceIfModifiedSince   time.Time `location:"header" locationName:"X-Tos-Copy-Source-If-Modified-Since"`
	CopySourceIfNoneMatch       string    `location:"header" locationName:"X-Tos-Copy-Source-If-None-Match"`
	CopySourceIfUnmodifiedSince time.Time `location:"header" locationName:"X-Tos-Copy-Source-If-Unmodified-Since"`

	CopySourceSSECAlgorithm string `location:"header" locationName:"X-Tos-Copy-Source-Server-Side-Encryption-Customer-Algorithm"`
	CopySourceSSECKey       string `location:"header" locationName:"X-Tos-Copy-Source-Server-Side-Encryption-Customer-Key"`
	CopySourceSSECKeyMD5    string `location:"header" locationName:"X-Tos-Copy-Source-Server-Side-Encryption-Customer-Key-MD5"`

	SSECKey       string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key"`
	SSECKeyMD5    string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Key-MD5"`
	SSECAlgorithm string `location:"header" locationName:"X-Tos-Server-Side-Encryption-Customer-Algorithm"`
	TrafficLimit  int64  `location:"header" locationName:"X-Tos-Traffic-Limit"`
}

type UploadPartCopyV2Output

type UploadPartCopyV2Output struct {
	RequestInfo
	PartNumber                int
	ETag                      string
	LastModified              time.Time
	CopySourceVersionID       string
	ServerSideEncryption      string
	ServerSideEncryptionKeyID string
	SSECAlgorithm             string
	SSECKeyMD5                string
}

type UploadPartFromFileInput

type UploadPartFromFileInput struct {
	UploadPartBasicInput
	FilePath string
	Offset   uint64 // 当前分段在文件中的起始位置
	PartSize int64  // 当前分段长度,该字段等同于 Content-Length 头域
}

type UploadPartFromFileOutput

type UploadPartFromFileOutput struct {
	UploadPartV2Output
}

type UploadPartInfo

type UploadPartInfo struct {
	PartNumber int
	PartSize   int64
	Offset     int64
	// upload part succeed 事件发生时有值
	ETag          *string
	HashCrc64ecma *uint64
}

UploadPartInfo is returned when UploadEvent occur

type UploadPartInput

type UploadPartInput struct {
	Key        string    `json:"Key,omitempty"`
	UploadID   string    `json:"UploadId,omitempty"`
	PartNumber int       `json:"PartNumber,omitempty"`
	Content    io.Reader `json:"-"`
}

type UploadPartOutput

type UploadPartOutput struct {
	RequestInfo          `json:"-"`
	PartNumber           int    `json:"PartNumber,omitempty"`
	ETag                 string `json:"ETag,omitempty"`
	SSECustomerAlgorithm string `json:"SSECustomerAlgorithm,omitempty"`
	SSECustomerKeyMD5    string `json:"SSECustomerKeyMD5,omitempty"`
}

type UploadPartV2Input

type UploadPartV2Input struct {
	UploadPartBasicInput
	Content       io.Reader
	ContentLength int64 `location:"header" locationName:"Content-Length"`
}

type UploadPartV2Output

type UploadPartV2Output struct {
	RequestInfo
	PartNumber                int
	ETag                      string
	SSECAlgorithm             string
	SSECKeyMD5                string
	HashCrc64ecma             uint64
	ServerSideEncryption      string
	ServerSideEncryptionKeyID string
}

type UploadedPart

type UploadedPart struct {
	PartNumber   int32  `json:"PartNumber,omitempty"`   // Part编号
	ETag         string `json:"ETag,omitempty"`         // ETag
	LastModified string `json:"LastModified,omitempty"` // 最后一次修改时间
	Size         int64  `json:"Size,omitempty"`         // Part大小
}

type UploadedPartV2

type UploadedPartV2 struct {
	PartNumber   int       `json:"PartNumber,omitempty"`   // Part编号
	ETag         string    `json:"ETag,omitempty"`         // ETag
	LastModified time.Time `json:"LastModified,omitempty"` // 最后一次修改时间
	Size         int64     `json:"Size,omitempty"`         // Part大小
}

type WithoutSecretKeyCredentials

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

WithoutSecretKeyCredentials Credentials with static access-key and no secret-key

If you don't want to use secret-key directly, but use signed-key, you can use it as:

signer := tos.NewSignV4(tos.NewWithoutSecretKeyCredentials(accessKey), region)
signer.WithSigningKey(func(*SigningKeyInfo) []byte { return signingKey})
client, err := tos.NewClient(endpoint, tos.WithSigner(signer))
// do something more

And you can use tos.WithPerRequestSigner set the 'Signer' for each request.

func NewWithoutSecretKeyCredentials

func NewWithoutSecretKeyCredentials(accessKeyID string) *WithoutSecretKeyCredentials

func (*WithoutSecretKeyCredentials) Credential

func (sc *WithoutSecretKeyCredentials) Credential() Credential

func (*WithoutSecretKeyCredentials) WithSecurityToken

func (sc *WithoutSecretKeyCredentials) WithSecurityToken(securityToken string)

WithSecurityToken set security-token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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