oss

package
v0.0.0-...-3ea99cd Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package oss implements functions for access oss service. It has two main struct Client and Bucket.

Index

Constants

View Source
const (
	LogOff = iota
	Error
	Warn
	Info
	Debug
)

Define the level of the output log

View Source
const (
	HTTPHeaderAcceptEncoding     string = "Accept-Encoding"
	HTTPHeaderAuthorization             = "Authorization"
	HTTPHeaderCacheControl              = "Cache-Control"
	HTTPHeaderContentDisposition        = "Content-Disposition"
	HTTPHeaderContentEncoding           = "Content-Encoding"
	HTTPHeaderContentLength             = "Content-Length"
	HTTPHeaderContentMD5                = "Content-MD5"
	HTTPHeaderContentType               = "Content-Type"
	HTTPHeaderContentLanguage           = "Content-Language"
	HTTPHeaderDate                      = "Date"
	HTTPHeaderEtag                      = "ETag"
	HTTPHeaderExpires                   = "Expires"
	HTTPHeaderHost                      = "Host"
	HTTPHeaderLastModified              = "Last-Modified"
	HTTPHeaderRange                     = "Range"
	HTTPHeaderLocation                  = "Location"
	HTTPHeaderOrigin                    = "Origin"
	HTTPHeaderServer                    = "Server"
	HTTPHeaderUserAgent                 = "User-Agent"
	HTTPHeaderIfModifiedSince           = "If-Modified-Since"
	HTTPHeaderIfUnmodifiedSince         = "If-Unmodified-Since"
	HTTPHeaderIfMatch                   = "If-Match"
	HTTPHeaderIfNoneMatch               = "If-None-Match"
	HTTPHeaderACReqMethod               = "Access-Control-Request-Method"
	HTTPHeaderACReqHeaders              = "Access-Control-Request-Headers"

	HTTPHeaderOssACL                         = "X-Oss-Acl"
	HTTPHeaderOssMetaPrefix                  = "X-Oss-Meta-"
	HTTPHeaderOssObjectACL                   = "X-Oss-Object-Acl"
	HTTPHeaderOssSecurityToken               = "X-Oss-Security-Token"
	HTTPHeaderOssServerSideEncryption        = "X-Oss-Server-Side-Encryption"
	HTTPHeaderOssServerSideEncryptionKeyID   = "X-Oss-Server-Side-Encryption-Key-Id"
	HTTPHeaderOssServerSideDataEncryption    = "X-Oss-Server-Side-Data-Encryption"
	HTTPHeaderSSECAlgorithm                  = "X-Oss-Server-Side-Encryption-Customer-Algorithm"
	HTTPHeaderSSECKey                        = "X-Oss-Server-Side-Encryption-Customer-Key"
	HTTPHeaderSSECKeyMd5                     = "X-Oss-Server-Side-Encryption-Customer-Key-MD5"
	HTTPHeaderOssCopySource                  = "X-Oss-Copy-Source"
	HTTPHeaderOssCopySourceRange             = "X-Oss-Copy-Source-Range"
	HTTPHeaderOssCopySourceIfMatch           = "X-Oss-Copy-Source-If-Match"
	HTTPHeaderOssCopySourceIfNoneMatch       = "X-Oss-Copy-Source-If-None-Match"
	HTTPHeaderOssCopySourceIfModifiedSince   = "X-Oss-Copy-Source-If-Modified-Since"
	HTTPHeaderOssCopySourceIfUnmodifiedSince = "X-Oss-Copy-Source-If-Unmodified-Since"
	HTTPHeaderOssMetadataDirective           = "X-Oss-Metadata-Directive"
	HTTPHeaderOssNextAppendPosition          = "X-Oss-Next-Append-Position"
	HTTPHeaderOssRequestID                   = "X-Oss-Request-Id"
	HTTPHeaderOssCRC64                       = "X-Oss-Hash-Crc64ecma"
	HTTPHeaderOssSymlinkTarget               = "X-Oss-Symlink-Target"
	HTTPHeaderOssStorageClass                = "X-Oss-Storage-Class"
	HTTPHeaderOssCallback                    = "X-Oss-Callback"
	HTTPHeaderOssCallbackVar                 = "X-Oss-Callback-Var"
	HTTPHeaderOssRequester                   = "X-Oss-Request-Payer"
	HTTPHeaderOssTagging                     = "X-Oss-Tagging"
	HTTPHeaderOssTaggingDirective            = "X-Oss-Tagging-Directive"
	HTTPHeaderOssTrafficLimit                = "X-Oss-Traffic-Limit"
	HTTPHeaderOssForbidOverWrite             = "X-Oss-Forbid-Overwrite"
	HTTPHeaderOssRangeBehavior               = "X-Oss-Range-Behavior"
	HTTPHeaderOssTaskID                      = "X-Oss-Task-Id"
)

HTTP headers

View Source
const (
	HTTPParamExpires       = "Expires"
	HTTPParamAccessKeyID   = "OSSAccessKeyId"
	HTTPParamSignature     = "Signature"
	HTTPParamSecurityToken = "security-token"
	HTTPParamPlaylistName  = "playlistName"

	HTTPParamSignatureVersion    = "x-oss-signature-version"
	HTTPParamExpiresV2           = "x-oss-expires"
	HTTPParamAccessKeyIDV2       = "x-oss-access-key-id"
	HTTPParamSignatureV2         = "x-oss-signature"
	HTTPParamAdditionalHeadersV2 = "x-oss-additional-headers"
)

HTTP Param

View Source
const (
	MaxPartSize = 5 * 1024 * 1024 * 1024 // Max part size, 5GB
	MinPartSize = 100 * 1024             // Min part size, 100KB

	FilePermMode = os.FileMode(0664) // Default file permission

	TempFilePrefix = "oss-go-temp-" // Temp file prefix
	TempFileSuffix = ".temp"        // Temp file suffix

	CheckpointFileSuffix = ".cp" // Checkpoint file suffix

	NullVersion = "null"

	Version = "v2.1.2" // Go SDK version
)

Other constants

View Source
const (
	DataFrameType        = 8388609
	ContinuousFrameType  = 8388612
	EndFrameType         = 8388613
	MetaEndFrameCSVType  = 8388614
	MetaEndFrameJSONType = 8388615
)

FrameType

Variables

View Source
var CrcTable = func() *crc64.Table {
	return crc64.MakeTable(crc64.ECMA)
}

CrcTable returns the table constructed from the specified polynomial

View Source
var LogTag = []string{"[error]", "[warn]", "[info]", "[debug]"}

LogTag Tag for each level of log

Functions

func AdjustRange

func AdjustRange(ur *UnpackedRange, size int64) (start, end int64)

AdjustRange returns adjusted range, adjust the range according to the length of the file

func CRC64Combine

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

CRC64Combine combines CRC64

func CheckBucketName

func CheckBucketName(bucketName string) error

func CheckCRC

func CheckCRC(resp *Response, operation string) error

func CheckDownloadCRC

func CheckDownloadCRC(clientCRC, serverCRC uint64) error

func CheckRespCode

func CheckRespCode(respCode int, allowed []int) error

CheckRespCode returns UnexpectedStatusError if the given response code is not one of the allowed status codes; otherwise nil.

func FindOption

func FindOption(options []Option, param string, defaultVal interface{}) (interface{}, error)

func GetCopySrcVersionId

func GetCopySrcVersionId(header http.Header) string

func GetDeleteMark

func GetDeleteMark(header http.Header) bool

func GetNowGMT

func GetNowGMT() string

GetNowGMT gets the current time in GMT format.

func GetNowNanoSec

func GetNowNanoSec() int64

GetNowNanoSec returns t as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC. The result is undefined if the Unix time in nanoseconds cannot be represented by an int64. Note that this means the result of calling UnixNano on the zero Time is undefined. gets the current time in Unix time, in nanoseconds.

func GetNowSec

func GetNowSec() int64

GetNowSec returns Unix time, the number of seconds elapsed since January 1, 1970 UTC. gets the current time in Unix time, in seconds.

func GetPartEnd

func GetPartEnd(begin int64, total int64, per int64) int64

GetPartEnd calculates the end position

func GetQosDelayTime

func GetQosDelayTime(header http.Header) string

func GetRangeString

func GetRangeString(unpackRange UnpackedRange) string

func GetRawParams

func GetRawParams(options []Option) (map[string]interface{}, error)

func GetReaderLen

func GetReaderLen(reader io.Reader) (int64, error)

func GetRequestId

func GetRequestId(header http.Header) string

func GetVersionId

func GetVersionId(header http.Header) string

func InvalidRangeError

func InvalidRangeError(r string) error

InvalidRangeError returns invalid range error

func IsOptionSet

func IsOptionSet(options []Option, option string) (bool, interface{}, error)

func LimitReadCloser

func LimitReadCloser(r io.Reader, n int64) io.Reader

func NewCRC

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

NewCRC creates a new hash.Hash64 computing the CRC64 checksum using the polynomial represented by the Table.

func TeeReader

func TeeReader(reader io.Reader, writer io.Writer, totalBytes int64, listener ProgressListener, tracker *readerTracker) io.ReadCloser

TeeReader returns a Reader that writes to w what it reads from r. All reads from r performed through it are matched with corresponding writes to w. There is no internal buffering - the write must complete before the read completes. Any error encountered while writing is reported as a read error.

func TypeByExtension

func TypeByExtension(filePath string) string

TypeByExtension returns the MIME type associated with the file extension ext. gets the file's MIME type for HTTP header Content-Type

Types

type ACLType

type ACLType string

ACLType bucket/object ACL

const (
	// ACLPrivate definition : private read and write
	ACLPrivate ACLType = "private"

	// ACLPublicRead definition : public read and private write
	ACLPublicRead ACLType = "public-read"

	// ACLPublicReadWrite definition : public read and public write
	ACLPublicReadWrite ACLType = "public-read-write"

	// ACLDefault Object. It's only applicable for object.
	ACLDefault ACLType = "default"
)

type AlgorithmType

type AlgorithmType string

AlgorithmType specifying the server side encryption algorithm name

const (
	KMSAlgorithm AlgorithmType = "KMS"
	AESAlgorithm AlgorithmType = "AES256"
	SM4Algorithm AlgorithmType = "SM4"
)

type AppendObjectRequest

type AppendObjectRequest struct {
	ObjectKey string
	Reader    io.Reader
	Position  int64
}

AppendObjectRequest is the requtest of DoAppendObject

type AppendObjectResult

type AppendObjectResult struct {
	NextPosition int64
	CRC          uint64
}

AppendObjectResult is the result of DoAppendObject

type AsynFetchTaskInfo

type AsynFetchTaskInfo struct {
	XMLName  xml.Name      `xml:"AsyncFetchTaskInfo"`
	TaskId   string        `xml:"TaskId,omitempty"`
	State    string        `xml:"State,omitempty"`
	ErrorMsg string        `xml:"ErrorMsg,omitempty"`
	TaskInfo AsyncTaskInfo `xml:"TaskInfo,omitempty"`
}

AsynFetchTaskInfo for GetBucketAsyncFetchTask result

type AsyncFetchTaskConfiguration

type AsyncFetchTaskConfiguration struct {
	XMLName       xml.Name `xml:"AsyncFetchTaskConfiguration"`
	Url           string   `xml:"Url,omitempty"`
	Object        string   `xml:"Object,omitempty"`
	Host          string   `xml:"Host,omitempty"`
	ContentMD5    string   `xml:"ContentMD5,omitempty"`
	Callback      string   `xml:"Callback,omitempty"`
	StorageClass  string   `xml:"StorageClass,omitempty"`
	IgnoreSameKey bool     `xml:"IgnoreSameKey"`
}

AsyncFetchTaskConfiguration for SetBucketAsyncFetchTask

type AsyncFetchTaskResult

type AsyncFetchTaskResult struct {
	XMLName xml.Name `xml:"AsyncFetchTaskResult"`
	TaskId  string   `xml:"TaskId,omitempty"`
}

AsyncFetchTaskResult for SetBucketAsyncFetchTask result

type AsyncTaskInfo

type AsyncTaskInfo struct {
	XMLName       xml.Name `xml:"TaskInfo"`
	Url           string   `xml:"Url,omitempty"`
	Object        string   `xml:"Object,omitempty"`
	Host          string   `xml:"Host,omitempty"`
	ContentMD5    string   `xml:"ContentMD5,omitempty"`
	Callback      string   `xml:"Callback,omitempty"`
	StorageClass  string   `xml:"StorageClass,omitempty"`
	IgnoreSameKey bool     `xml:"IgnoreSameKey"`
}

AsyncTaskInfo for async task information

type AuthVersionType

type AuthVersionType string

AuthVersion the version of auth

const (
	// AuthV1 v1
	AuthV1 AuthVersionType = "v1"
	// AuthV2 v2
	AuthV2 AuthVersionType = "v2"
)

type Bucket

type Bucket struct {
	Client     Client
	BucketName string
}

Bucket implements the operations of object.

func (Bucket) AbortMultipartUpload

func (bucket Bucket) AbortMultipartUpload(imur InitiateMultipartUploadResult, options ...Option) error

AbortMultipartUpload aborts the multipart upload.

imur the return value of InitiateMultipartUpload.

error it's nil if the operation succeeds, otherwise it's an error object.

func (Bucket) AppendObject

func (bucket Bucket) AppendObject(objectKey string, reader io.Reader, appendPosition int64, options ...Option) (int64, error)

AppendObject uploads the data in the way of appending an existing or new object.

AppendObject the parameter appendPosition specifies which postion (in the target object) to append. For the first append (to a non-existing file), the appendPosition should be 0. The appendPosition in the subsequent calls will be the current object length. For example, the first appendObject's appendPosition is 0 and it uploaded 65536 bytes data, then the second call's position is 65536. The response header x-oss-next-append-position after each successful request also specifies the next call's append position (so the caller need not to maintain this information).

objectKey the target object to append to. reader io.Reader. The read instance for reading the data to append. appendPosition the start position to append. destObjectProperties the options for the first appending, such as CacheControl, ContentDisposition, ContentEncoding,

Expires, ServerSideEncryption, ObjectACL.

int64 the next append position, it's valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (Bucket) CompleteMultipartUpload

func (bucket Bucket) CompleteMultipartUpload(imur InitiateMultipartUploadResult,
	parts []UploadPart, options ...Option) (CompleteMultipartUploadResult, error)

CompleteMultipartUpload completes the multipart upload.

imur the return value of InitiateMultipartUpload. parts the array of return value of UploadPart/UploadPartFromFile/UploadPartCopy.

CompleteMultipartUploadResponse the return value when the call succeeds. Only valid when the error is nil. error it's nil if the operation succeeds, otherwise it's an error object.

func (Bucket) CopyFile

func (bucket Bucket) CopyFile(srcBucketName, srcObjectKey, destObjectKey string, partSize int64, options ...Option) error

CopyFile is multipart copy object

srcBucketName source bucket name srcObjectKey source object name destObjectKey target object name in the form of bucketname.objectkey partSize the part size in byte. options object's contraints. Check out function InitiateMultipartUpload.

error it's nil if the operation succeeds, otherwise it's an error object.

func (Bucket) CopyObject

func (bucket Bucket) CopyObject(srcObjectKey, destObjectKey string, options ...Option) (CopyObjectResult, error)

CopyObject copies the object inside the bucket.

srcObjectKey the source object to copy. destObjectKey the target object to copy. options options for copying an object. You can specify the conditions of copy. The valid conditions are CopySourceIfMatch,

CopySourceIfNoneMatch, CopySourceIfModifiedSince, CopySourceIfUnmodifiedSince, MetadataDirective.
Also you can specify the target object's attributes, such as CacheControl, ContentDisposition, ContentEncoding, Expires,
ServerSideEncryption, ObjectACL, Meta. Refer to the link below for more details :
https://help.aliyun.com/document_detail/oss/api-reference/object/CopyObject.html

error it's nil if no error, otherwise it's an error object.

func (Bucket) CopyObjectFrom

func (bucket Bucket) CopyObjectFrom(srcBucketName, srcObjectKey, destObjectKey string, options ...Option) (CopyObjectResult, error)

CopyObjectFrom copies the object to another bucket.

srcBucketName source bucket name. srcObjectKey source object name. destObjectKey target object name. The target bucket name is Bucket.BucketName. options copy options. Check out parameter options in function CopyObject.

error it's nil if no error, otherwise it's an error object.

func (Bucket) CopyObjectTo

func (bucket Bucket) CopyObjectTo(destBucketName, destObjectKey, srcObjectKey string, options ...Option) (CopyObjectResult, error)

CopyObjectTo copies the object to another bucket.

srcObjectKey source object key. The source bucket is Bucket.BucketName . destBucketName target bucket name. destObjectKey target object name. options copy options, check out parameter options in function CopyObject for more details.

error it's nil if no error, otherwise it's an error object.

func (Bucket) CreateLiveChannel

func (bucket Bucket) CreateLiveChannel(channelName string, config LiveChannelConfiguration) (CreateLiveChannelResult, error)

CreateLiveChannel create a live-channel

channelName the name of the channel config configuration of the channel

CreateLiveChannelResult the result of create live-channel error nil if success, otherwise error

func (Bucket) CreateSelectCsvObjectMeta

func (bucket Bucket) CreateSelectCsvObjectMeta(key string, csvMeta CsvMetaRequest, options ...Option) (MetaEndFrameCSV, error)

CreateSelectCsvObjectMeta is Creating csv object meta

key the object key. csvMeta the csv file meta options the options for create csv Meta of the object.

MetaEndFrameCSV the csv file meta info error it's nil if no error, otherwise it's an error object.

func (Bucket) CreateSelectJsonObjectMeta

func (bucket Bucket) CreateSelectJsonObjectMeta(key string, jsonMeta JsonMetaRequest, options ...Option) (MetaEndFrameJSON, error)

CreateSelectJsonObjectMeta is Creating json object meta

key the object key. csvMeta the json file meta options the options for create json Meta of the object.

MetaEndFrameJSON the json file meta info error it's nil if no error, otherwise it's an error object.

func (Bucket) DeleteLiveChannel

func (bucket Bucket) DeleteLiveChannel(channelName string) error

DeleteLiveChannel Delete the live-channel. When a client trying to stream the live-channel, the operation will fail. it will only delete the live-channel itself and the object generated by the live-channel will not be deleted.

channelName the name of the channel

error nil if success, otherwise error

func (Bucket) DeleteObject

func (bucket Bucket) DeleteObject(objectKey string, options ...Option) error

DeleteObject deletes the object.

objectKey the object key to delete.

error it's nil if no error, otherwise it's an error object.

func (Bucket) DeleteObjectTagging

func (bucket Bucket) DeleteObjectTagging(objectKey string, options ...Option) error

DeleteObjectTagging delete object taggging

objectKey object key to delete tagging

error nil if success, otherwise error

func (Bucket) DeleteObjectVersions

func (bucket Bucket) DeleteObjectVersions(objectVersions []DeleteObject, options ...Option) (DeleteObjectVersionsResult, error)

DeleteObjectVersions deletes multiple object versions.

objectVersions the object keys and versions to delete. options the options for deleting objects.

Supported option is DeleteObjectsQuiet which means it will not return error even deletion failed (not recommended). By default it's not used.

DeleteObjectVersionsResult the result object. error it's nil if no error, otherwise it's an error object.

func (Bucket) DeleteObjects

func (bucket Bucket) DeleteObjects(objectKeys []string, options ...Option) (DeleteObjectsResult, error)

DeleteObjects deletes multiple objects.

objectKeys the object keys to delete. options the options for deleting objects.

Supported option is DeleteObjectsQuiet which means it will not return error even deletion failed (not recommended). By default it's not used.

DeleteObjectsResult the result object. error it's nil if no error, otherwise it's an error object.

func (Bucket) Do

func (bucket Bucket) Do(method, objectName string, params map[string]interface{}, options []Option,
	data io.Reader, listener ProgressListener) (*Response, error)

public

func (Bucket) DoAppendObject

func (bucket Bucket) DoAppendObject(request *AppendObjectRequest, options []Option) (*AppendObjectResult, error)

DoAppendObject is the actual API that does the object append.

request the request object for appending object. options the options for appending object.

AppendObjectResult the result object for appending object. error it's nil if no error, otherwise it's an error object.

func (Bucket) DoGetObject

func (bucket Bucket) DoGetObject(request *GetObjectRequest, options []Option) (*GetObjectResult, error)

DoGetObject is the actual API that gets the object. It's the internal function called by other public APIs.

request the request to download the object. options the options for downloading the file. Checks out the parameter options in method GetObject.

GetObjectResult the result instance of getting the object. error it's nil if no error, otherwise it's an error object.

func (Bucket) DoGetObjectWithURL

func (bucket Bucket) DoGetObjectWithURL(signedURL string, options []Option) (*GetObjectResult, error)

DoGetObjectWithURL is the actual API that downloads the file with the signed URL.

signedURL the signed URL. options the options for getting object. Check out parameter options in GetObject for the reference.

GetObjectResult the result object when the error is nil. error it's nil if no error, otherwise it's an error object.

func (Bucket) DoPostSelectObject

func (bucket Bucket) DoPostSelectObject(key string, params map[string]interface{}, buf *bytes.Buffer, options ...Option) (*SelectObjectResponse, error)

DoPostSelectObject is the SelectObject/CreateMeta api, approve csv and json file.

key the object key. params the resource of oss approve csv/meta, json/meta, csv/select, json/select. buf the request data trans to buffer. options the options for select file of the object.

SelectObjectResponse the response of select object. error it's nil if no error, otherwise it's an error object.

func (Bucket) DoPutObject

func (bucket Bucket) DoPutObject(request *PutObjectRequest, options []Option) (*Response, error)

DoPutObject does the actual upload work.

request the request instance for uploading an object. options the options for uploading an object.

Response the response from OSS. error it's nil if no error, otherwise it's an error object.

func (Bucket) DoPutObjectWithURL

func (bucket Bucket) DoPutObjectWithURL(signedURL string, reader io.Reader, options []Option) (*Response, error)

DoPutObjectWithURL is the actual API that does the upload with URL work(internal for SDK)

signedURL the signed URL. reader io.Reader the read instance for getting the data to upload. options options for uploading.

Response the response object which contains the HTTP response. error it's nil if no error, otherwise it's an error object.

func (Bucket) DoUploadPart

func (bucket Bucket) DoUploadPart(request *UploadPartRequest, options []Option) (*UploadPartResult, error)

DoUploadPart does the actual part upload.

request part upload request

UploadPartResult the result of uploading part. error it's nil if the operation succeeds, otherwise it's an error object.

func (Bucket) DownloadFile

func (bucket Bucket) DownloadFile(objectKey, filePath string, partSize int64, options ...Option) error

DownloadFile downloads files with multipart download.

objectKey the object key. filePath the local file to download from objectKey in OSS. partSize the part size in bytes. options object's constraints, check out GetObject for the reference.

error it's nil when the call succeeds, otherwise it's an error object.

func (Bucket) GetConfig

func (bucket Bucket) GetConfig() *Config

func (Bucket) GetLiveChannelHistory

func (bucket Bucket) GetLiveChannelHistory(channelName string) (LiveChannelHistory, error)

GetLiveChannelHistory Get push records of live-channel

channelName the name of the channel

LiveChannelHistory push records error nil if success, otherwise error

func (Bucket) GetLiveChannelInfo

func (bucket Bucket) GetLiveChannelInfo(channelName string) (LiveChannelConfiguration, error)

GetLiveChannelInfo Get the configuration info of the live-channel

channelName the name of the channel

LiveChannelConfiguration the configuration info of the live-channel error nil if success, otherwise error

func (Bucket) GetLiveChannelStat

func (bucket Bucket) GetLiveChannelStat(channelName string) (LiveChannelStat, error)

GetLiveChannelStat Get the state of the live-channel

channelName the name of the channel

LiveChannelStat the state of the live-channel error nil if success, otherwise error

func (Bucket) GetObject

func (bucket Bucket) GetObject(objectKey string, options ...Option) (io.ReadCloser, error)

GetObject downloads the object.

objectKey the object key. options the options for downloading the object. The valid values are: Range, IfModifiedSince, IfUnmodifiedSince, IfMatch,

IfNoneMatch, AcceptEncoding. For more details, please check out:
https://help.aliyun.com/document_detail/oss/api-reference/object/GetObject.html

io.ReadCloser reader instance for reading data from response. It must be called close() after the usage and only valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (Bucket) GetObjectACL

func (bucket Bucket) GetObjectACL(objectKey string, options ...Option) (GetObjectACLResult, error)

GetObjectACL gets object's ACL

objectKey the object to get ACL from.

GetObjectACLResult the result object when error is nil. GetObjectACLResult.Acl is the object ACL. error it's nil if no error, otherwise it's an error object.

func (Bucket) GetObjectDetailedMeta

func (bucket Bucket) GetObjectDetailedMeta(objectKey string, options ...Option) (http.Header, error)

GetObjectDetailedMeta gets the object's detailed metadata

objectKey object key. options the constraints of the object. Only when the object meets the requirements this method will return the metadata. Otherwise returns error. Valid options are IfModifiedSince, IfUnmodifiedSince,

IfMatch, IfNoneMatch. For more details check out https://help.aliyun.com/document_detail/oss/api-reference/object/HeadObject.html

http.Header object meta when error is nil. error it's nil if no error, otherwise it's an error object.

func (Bucket) GetObjectMeta

func (bucket Bucket) GetObjectMeta(objectKey string, options ...Option) (http.Header, error)

GetObjectMeta gets object metadata.

GetObjectMeta is more lightweight than GetObjectDetailedMeta as it only returns basic metadata including ETag size, LastModified. The size information is in the HTTP header Content-Length.

objectKey object key

http.Header the object's metadata, valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (Bucket) GetObjectTagging

func (bucket Bucket) GetObjectTagging(objectKey string, options ...Option) (GetObjectTaggingResult, error)

func (Bucket) GetObjectToFile

func (bucket Bucket) GetObjectToFile(objectKey, filePath string, options ...Option) error

GetObjectToFile downloads the data to a local file.

objectKey the object key to download. filePath the local file to store the object data. options the options for downloading the object. Refer to the parameter options in method GetObject for more details.

error it's nil if no error, otherwise it's an error object.

func (Bucket) GetObjectToFileWithURL

func (bucket Bucket) GetObjectToFileWithURL(signedURL, filePath string, options ...Option) error

GetObjectToFileWithURL downloads the object into a local file with the signed URL.

signedURL the signed URL filePath the local file path to download to. options the options for downloading object. Check out the parameter options in function GetObject for the reference.

error it's nil if no error, otherwise it's an error object.

func (Bucket) GetObjectWithURL

func (bucket Bucket) GetObjectWithURL(signedURL string, options ...Option) (io.ReadCloser, error)

GetObjectWithURL downloads the object and returns the reader instance, with the signed URL.

signedURL the signed URL. options options for downloading the object. Valid options are IfModifiedSince, IfUnmodifiedSince, IfMatch,

IfNoneMatch, AcceptEncoding. For more information, check out the following link:
https://help.aliyun.com/document_detail/oss/api-reference/object/GetObject.html

io.ReadCloser the reader object for getting the data from response. It needs be closed after the usage. It's only valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (bucket Bucket) GetSymlink(objectKey string, options ...Option) (http.Header, error)

GetSymlink gets the symlink object with the specified key. If the symlink object does not exist, returns 404.

objectKey the symlink object's key.

error it's nil if no error, otherwise it's an error object.

When error is nil, the target file key is in the X-Oss-Symlink-Target header of the returned object.

func (Bucket) GetVodPlaylist

func (bucket Bucket) GetVodPlaylist(channelName string, startTime, endTime time.Time) (io.ReadCloser, error)

GetVodPlaylist get the playlist based on the specified channelName, startTime and endTime

channelName the name of the channel startTime the start time of the playlist endTime the endtime of the playlist

io.ReadCloser reader instance for reading data from response. It must be called close() after the usage and only valid when error is nil. error nil if success, otherwise error

func (Bucket) InitiateMultipartUpload

func (bucket Bucket) InitiateMultipartUpload(objectKey string, options ...Option) (InitiateMultipartUploadResult, error)

InitiateMultipartUpload initializes multipart upload

objectKey object name options the object constricts for upload. The valid options are CacheControl, ContentDisposition, ContentEncoding, Expires,

ServerSideEncryption, Meta, check out the following link:
https://help.aliyun.com/document_detail/oss/api-reference/multipart-upload/InitiateMultipartUpload.html

InitiateMultipartUploadResult the return value of the InitiateMultipartUpload, which is used for calls later on such as UploadPartFromFile,UploadPartCopy. error it's nil if the operation succeeds, otherwise it's an error object.

func (Bucket) IsObjectExist

func (bucket Bucket) IsObjectExist(objectKey string, options ...Option) (bool, error)

IsObjectExist checks if the object exists.

bool flag of object's existence (true:exists; false:non-exist) when error is nil.

error it's nil if no error, otherwise it's an error object.

func (Bucket) ListLiveChannel

func (bucket Bucket) ListLiveChannel(options ...Option) (ListLiveChannelResult, error)

ListLiveChannel list the live-channels

options Prefix: filter by the name start with the value of "Prefix"

MaxKeys: the maximum count returned
Marker: cursor from which starting list

ListLiveChannelResult live-channel list error nil if success, otherwise error

func (Bucket) ListMultipartUploads

func (bucket Bucket) ListMultipartUploads(options ...Option) (ListMultipartUploadResult, error)

ListMultipartUploads lists all ongoing multipart upload tasks

options listObject's filter. Prefix specifies the returned object's prefix; KeyMarker specifies the returned object's start point in lexicographic order;

MaxKeys specifies the max entries to return; Delimiter is the character for grouping object keys.

ListMultipartUploadResponse the return value if it succeeds, only valid when error is nil. error it's nil if the operation succeeds, otherwise it's an error object.

func (Bucket) ListObjectVersions

func (bucket Bucket) ListObjectVersions(options ...Option) (ListObjectVersionsResult, error)

ListObjectVersions lists objects of all versions under the current bucket.

func (Bucket) ListObjects

func (bucket Bucket) ListObjects(options ...Option) (ListObjectsResult, error)

ListObjects lists the objects under the current bucket.

options it contains all the filters for listing objects.

It could specify a prefix filter on object keys,  the max keys count to return and the object key marker and the delimiter for grouping object names.
The key marker means the returned objects' key must be greater than it in lexicographic order.

For example, if the bucket has 8 objects, my-object-1, my-object-11, my-object-2, my-object-21,
my-object-22, my-object-3, my-object-31, my-object-32. If the prefix is my-object-2 (no other filters), then it returns
my-object-2, my-object-21, my-object-22 three objects. If the marker is my-object-22 (no other filters), then it returns
my-object-3, my-object-31, my-object-32 three objects. If the max keys is 5, then it returns 5 objects.
The three filters could be used together to achieve filter and paging functionality.
If the prefix is the folder name, then it could list all files under this folder (including the files under its subfolders).
But if the delimiter is specified with '/', then it only returns that folder's files (no subfolder's files). The direct subfolders are in the commonPrefixes properties.
For example, if the bucket has three objects fun/test.jpg, fun/movie/001.avi, fun/movie/007.avi. And if the prefix is "fun/", then it returns all three objects.
But if the delimiter is '/', then only "fun/test.jpg" is returned as files and fun/movie/ is returned as common prefix.

For common usage scenario, check out sample/list_object.go.

ListObjectsResponse the return value after operation succeeds (only valid when error is nil).

func (Bucket) ListUploadedParts

func (bucket Bucket) ListUploadedParts(imur InitiateMultipartUploadResult, options ...Option) (ListUploadedPartsResult, error)

ListUploadedParts lists the uploaded parts.

imur the return value of InitiateMultipartUpload.

ListUploadedPartsResponse the return value if it succeeds, only valid when error is nil. error it's nil if the operation succeeds, otherwise it's an error object.

func (Bucket) OptionsMethod

func (bucket Bucket) OptionsMethod(objectKey string, options ...Option) (http.Header, error)

func (Bucket) PostVodPlaylist

func (bucket Bucket) PostVodPlaylist(channelName, playlistName string, startTime, endTime time.Time) error

PostVodPlaylist create an playlist based on the specified playlist name, startTime and endTime

channelName the name of the channel playlistName the name of the playlist, must end with ".m3u8" startTime the start time of the playlist endTime the endtime of the playlist

error nil if success, otherwise error

func (Bucket) ProcessObject

func (bucket Bucket) ProcessObject(objectKey string, process string, options ...Option) (ProcessObjectResult, error)

ProcessObject apply process on the specified image file.

The supported process includes resize, rotate, crop, watermark, format, udf, customized style, etc.

objectKey object key to process. process process string, such as "image/resize,w_100|sys/saveas,o_dGVzdC5qcGc,b_dGVzdA"

error it's nil if no error, otherwise it's an error object.

func (Bucket) PutLiveChannelStatus

func (bucket Bucket) PutLiveChannelStatus(channelName, status string) error

PutLiveChannelStatus Set the status of the live-channel: enabled/disabled

channelName the name of the channel status enabled/disabled

error nil if success, otherwise error

func (Bucket) PutObject

func (bucket Bucket) PutObject(objectKey string, reader io.Reader, options ...Option) error

PutObject creates a new object and it will overwrite the original one if it exists already.

objectKey the object key in UTF-8 encoding. The length must be between 1 and 1023, and cannot start with "/" or "\". reader io.Reader instance for reading the data for uploading options the options for uploading the object. The valid options here are CacheControl, ContentDisposition, ContentEncoding

Expires, ServerSideEncryption, ObjectACL and Meta. Refer to the link below for more details.
https://help.aliyun.com/document_detail/oss/api-reference/object/PutObject.html

error it's nil if no error, otherwise it's an error object.

func (Bucket) PutObjectFromFile

func (bucket Bucket) PutObjectFromFile(objectKey, filePath string, options ...Option) error

PutObjectFromFile creates a new object from the local file.

objectKey object key. filePath the local file path to upload. options the options for uploading the object. Refer to the parameter options in PutObject for more details.

error it's nil if no error, otherwise it's an error object.

func (Bucket) PutObjectFromFileWithURL

func (bucket Bucket) PutObjectFromFileWithURL(signedURL, filePath string, options ...Option) error

PutObjectFromFileWithURL uploads an object from a local file with the signed URL. PutObjectFromFileWithURL It does not generate mimetype according to object key's name or the local file name.

signedURL the signed URL. filePath local file path, such as dirfile.txt, for uploading. options options for uploading, same as the options in PutObject function.

error it's nil if no error, otherwise it's an error object.

func (Bucket) PutObjectTagging

func (bucket Bucket) PutObjectTagging(objectKey string, tagging Tagging, options ...Option) error

PutObjectTagging add tagging to object

objectKey object key to add tagging tagging tagging to be added

error nil if success, otherwise error

func (Bucket) PutObjectWithURL

func (bucket Bucket) PutObjectWithURL(signedURL string, reader io.Reader, options ...Option) error

PutObjectWithURL uploads an object with the URL. If the object exists, it will be overwritten. PutObjectWithURL It will not generate minetype according to the key name.

signedURL signed URL. reader io.Reader the read instance for reading the data for the upload. options the options for uploading the data. The valid options are CacheControl, ContentDisposition, ContentEncoding,

Expires, ServerSideEncryption, ObjectACL and custom metadata. Check out the following link for details:
https://help.aliyun.com/document_detail/oss/api-reference/object/PutObject.html

error it's nil if no error, otherwise it's an error object.

func (bucket Bucket) PutSymlink(symObjectKey string, targetObjectKey string, options ...Option) error

PutSymlink creates a symlink (to point to an existing object)

Symlink cannot point to another symlink. When creating a symlink, it does not check the existence of the target file, and does not check if the target file is symlink. Neither it checks the caller's permission on the target file. All these checks are deferred to the actual GetObject call via this symlink. If trying to add an existing file, as long as the caller has the write permission, the existing one will be overwritten. If the x-oss-meta- is specified, it will be added as the metadata of the symlink file.

symObjectKey the symlink object's key. targetObjectKey the target object key to point to.

error it's nil if no error, otherwise it's an error object.

func (Bucket) RestoreObject

func (bucket Bucket) RestoreObject(objectKey string, options ...Option) error

RestoreObject restores the object from the archive storage.

An archive object is in cold status by default and it cannot be accessed. When restore is called on the cold object, it will become available for access after some time. If multiple restores are called on the same file when the object is being restored, server side does nothing for additional calls but returns success. By default, the restored object is available for access for one day. After that it will be unavailable again. But if another RestoreObject are called after the file is restored, then it will extend one day's access time of that object, up to 7 days.

objectKey object key to restore.

error it's nil if no error, otherwise it's an error object.

func (Bucket) RestoreObjectDetail

func (bucket Bucket) RestoreObjectDetail(objectKey string, restoreConfig RestoreConfiguration, options ...Option) error

RestoreObjectDetail support more features than RestoreObject

func (Bucket) SelectObject

func (bucket Bucket) SelectObject(key string, selectReq SelectRequest, options ...Option) (io.ReadCloser, error)

SelectObject is the select object api, approve csv and json file.

key the object key. selectReq the request data for select object options the options for select file of the object.

o.ReadCloser reader instance for reading data from response. It must be called close() after the usage and only valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (Bucket) SelectObjectIntoFile

func (bucket Bucket) SelectObjectIntoFile(key, fileName string, selectReq SelectRequest, options ...Option) error

SelectObjectIntoFile is the selectObject to file api

key the object key. fileName saving file's name to localstation. selectReq the request data for select object options the options for select file of the object.

error it's nil if no error, otherwise it's an error object.

func (Bucket) SetObjectACL

func (bucket Bucket) SetObjectACL(objectKey string, objectACL ACLType, options ...Option) error

SetObjectACL updates the object's ACL.

Only the bucket's owner could update object's ACL which priority is higher than bucket's ACL. For example, if the bucket ACL is private and object's ACL is public-read-write. Then object's ACL is used and it means all users could read or write that object. When the object's ACL is not set, then bucket's ACL is used as the object's ACL.

Object read operations include GetObject, HeadObject, CopyObject and UploadPartCopy on the source object; Object write operations include PutObject, PostObject, AppendObject, DeleteObject, DeleteMultipleObjects, CompleteMultipartUpload and CopyObject on target object.

objectKey the target object key (to set the ACL on) objectAcl object ACL. Valid options are PrivateACL, PublicReadACL, PublicReadWriteACL.

error it's nil if no error, otherwise it's an error object.

func (Bucket) SetObjectMeta

func (bucket Bucket) SetObjectMeta(objectKey string, options ...Option) error

SetObjectMeta sets the metadata of the Object.

objectKey object options options for setting the metadata. The valid options are CacheControl, ContentDisposition, ContentEncoding, Expires,

ServerSideEncryption, and custom metadata.

error it's nil if no error, otherwise it's an error object.

func (Bucket) SignRtmpURL

func (bucket Bucket) SignRtmpURL(channelName, playlistName string, expires int64) (string, error)

SignRtmpURL Generate a RTMP push-stream signature URL for the trusted user to push the RTMP stream to the live-channel.

channelName the name of the channel playlistName the name of the playlist, must end with ".m3u8" expires expiration (in seconds)

string singed rtmp push stream url error nil if success, otherwise error

func (Bucket) SignURL

func (bucket Bucket) SignURL(objectKey string, method HTTPMethod, expiredInSec int64, options ...Option) (string, error)

SignURL signs the URL. Users could access the object directly with this URL without getting the AK.

objectKey the target object to sign. signURLConfig the configuration for the signed URL

string returns the signed URL, when error is nil. error it's nil if no error, otherwise it's an error object.

func (Bucket) UploadFile

func (bucket Bucket) UploadFile(objectKey, filePath string, partSize int64, options ...Option) error

UploadFile is multipart file upload.

objectKey the object name. filePath the local file path to upload. partSize the part size in byte. options the options for uploading object.

error it's nil if the operation succeeds, otherwise it's an error object.

func (Bucket) UploadPart

func (bucket Bucket) UploadPart(imur InitiateMultipartUploadResult, reader io.Reader,
	partSize int64, partNumber int, options ...Option) (UploadPart, error)

UploadPart uploads parts

After initializing a Multipart Upload, the upload Id and object key could be used for uploading the parts. Each part has its part number (ranges from 1 to 10,000). And for each upload Id, the part number identifies the position of the part in the whole file. And thus with the same part number and upload Id, another part upload will overwrite the data. Except the last one, minimal part size is 100KB. There's no limit on the last part size.

imur the returned value of InitiateMultipartUpload. reader io.Reader the reader for the part's data. size the part size. partNumber the part number (ranges from 1 to 10,000). Invalid part number will lead to InvalidArgument error.

UploadPart the return value of the upload part. It consists of PartNumber and ETag. It's valid when error is nil. error it's nil if the operation succeeds, otherwise it's an error object.

func (Bucket) UploadPartCopy

func (bucket Bucket) UploadPartCopy(imur InitiateMultipartUploadResult, srcBucketName, srcObjectKey string,
	startPosition, partSize int64, partNumber int, options ...Option) (UploadPart, error)

UploadPartCopy uploads part copy

imur the return value of InitiateMultipartUpload copySrc source Object name startPosition the part's start index in the source file partSize the part size partNumber the part number, ranges from 1 to 10,000. If it exceeds the range OSS returns InvalidArgument error. options the constraints of source object for the copy. The copy happens only when these contraints are met. Otherwise it returns error.

CopySourceIfNoneMatch, CopySourceIfModifiedSince  CopySourceIfUnmodifiedSince, check out the following link for the detail
https://help.aliyun.com/document_detail/oss/api-reference/multipart-upload/UploadPartCopy.html

UploadPart the return value consists of PartNumber and ETag. error it's nil if the operation succeeds, otherwise it's an error object.

func (Bucket) UploadPartFromFile

func (bucket Bucket) UploadPartFromFile(imur InitiateMultipartUploadResult, filePath string,
	startPosition, partSize int64, partNumber int, options ...Option) (UploadPart, error)

UploadPartFromFile uploads part from the file.

imur the return value of a successful InitiateMultipartUpload. filePath the local file path to upload. startPosition the start position in the local file. partSize the part size. partNumber the part number (from 1 to 10,000)

UploadPart the return value consists of PartNumber and ETag. error it's nil if the operation succeeds, otherwise it's an error object.

type BucketInfo

type BucketInfo struct {
	XMLName          xml.Name  `xml:"Bucket"`
	Name             string    `xml:"Name"`                     // Bucket name
	Location         string    `xml:"Location"`                 // Bucket datacenter
	CreationDate     time.Time `xml:"CreationDate"`             // Bucket creation time
	ExtranetEndpoint string    `xml:"ExtranetEndpoint"`         // Bucket external endpoint
	IntranetEndpoint string    `xml:"IntranetEndpoint"`         // Bucket internal endpoint
	ACL              string    `xml:"AccessControlList>Grant"`  // Bucket ACL
	RedundancyType   string    `xml:"DataRedundancyType"`       // Bucket DataRedundancyType
	Owner            Owner     `xml:"Owner"`                    // Bucket owner
	StorageClass     string    `xml:"StorageClass"`             // Bucket storage class
	SseRule          SSERule   `xml:"ServerSideEncryptionRule"` // Bucket ServerSideEncryptionRule
	Versioning       string    `xml:"Versioning"`               // Bucket Versioning
}

BucketInfo defines Bucket information

type BucketProperties

type BucketProperties struct {
	XMLName      xml.Name  `xml:"Bucket"`
	Name         string    `xml:"Name"`         // Bucket name
	Location     string    `xml:"Location"`     // Bucket datacenter
	CreationDate time.Time `xml:"CreationDate"` // Bucket create time
	StorageClass string    `xml:"StorageClass"` // Bucket storage class
}

BucketProperties defines bucket properties

type BucketQoSConfiguration

type BucketQoSConfiguration struct {
	XMLName                   xml.Name `xml:"QoSConfiguration"`
	TotalUploadBandwidth      *int     `xml:"TotalUploadBandwidth"`      // Total upload bandwidth
	IntranetUploadBandwidth   *int     `xml:"IntranetUploadBandwidth"`   // Intranet upload bandwidth
	ExtranetUploadBandwidth   *int     `xml:"ExtranetUploadBandwidth"`   // Extranet upload bandwidth
	TotalDownloadBandwidth    *int     `xml:"TotalDownloadBandwidth"`    // Total download bandwidth
	IntranetDownloadBandwidth *int     `xml:"IntranetDownloadBandwidth"` // Intranet download bandwidth
	ExtranetDownloadBandwidth *int     `xml:"ExtranetDownloadBandwidth"` // Extranet download bandwidth
	TotalQPS                  *int     `xml:"TotalQps"`                  // Total Qps
	IntranetQPS               *int     `xml:"IntranetQps"`               // Intranet Qps
	ExtranetQPS               *int     `xml:"ExtranetQps"`               // Extranet Qps
}

BucketQoSConfiguration define QoS configuration

type BucketStat

type BucketStat struct {
	XMLName              xml.Name `xml:"BucketStat"`
	Storage              int64    `xml:"Storage"`
	ObjectCount          int64    `xml:"ObjectCount"`
	MultipartUploadCount int64    `xml:"MultipartUploadCount"`
}

type CORSRule

type CORSRule struct {
	XMLName       xml.Name `xml:"CORSRule"`
	AllowedOrigin []string `xml:"AllowedOrigin"` // Allowed origins. By default it's wildcard '*'
	AllowedMethod []string `xml:"AllowedMethod"` // Allowed methods
	AllowedHeader []string `xml:"AllowedHeader"` // Allowed headers
	ExposeHeader  []string `xml:"ExposeHeader"`  // Allowed response headers
	MaxAgeSeconds int      `xml:"MaxAgeSeconds"` // Max cache ages in seconds
}

CORSRule defines CORS rules

type CORSXML

type CORSXML struct {
	XMLName   xml.Name   `xml:"CORSConfiguration"`
	CORSRules []CORSRule `xml:"CORSRule"` // CORS rules
}

CORSXML defines CORS configuration

type CRCCheckError

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

CRCCheckError is returned when crc check is inconsistent between client and server

func (CRCCheckError) Error

func (e CRCCheckError) Error() string

Error implements interface error

type CSV

type CSV struct {
	XMLName         xml.Name `xml:"CSV"`
	RecordDelimiter string   `xml:"RecordDelimiter,omitempty"`
	FieldDelimiter  string   `xml:"FieldDelimiter,omitempty"`
	QuoteCharacter  string   `xml:"QuoteCharacter,omitempty"`
}

type CSVSelectInput

type CSVSelectInput struct {
	XMLName          xml.Name `xml:"CSV"`
	FileHeaderInfo   string   `xml:"FileHeaderInfo,omitempty"`
	RecordDelimiter  string   `xml:"RecordDelimiter,omitempty"`
	FieldDelimiter   string   `xml:"FieldDelimiter,omitempty"`
	QuoteCharacter   string   `xml:"QuoteCharacter,omitempty"`
	CommentCharacter string   `xml:"CommentCharacter,omitempty"`
	Range            string   `xml:"Range,omitempty"`
	SplitRange       string
}

type CSVSelectOutput

type CSVSelectOutput struct {
	XMLName         xml.Name `xml:"CSV"`
	RecordDelimiter string   `xml:"RecordDelimiter,omitempty"`
	FieldDelimiter  string   `xml:"FieldDelimiter,omitempty"`
}

type Client

type Client struct {
	Config     *Config      // OSS client configuration
	Conn       *Conn        // Send HTTP request
	HTTPClient *http.Client //http.Client to use - if nil will make its own
}

Client OSS client

func New

func New(endpoint, accessKeyID, accessKeySecret string, options ...ClientOption) (*Client, error)

New creates a new client.

endpoint the OSS datacenter endpoint such as http://oss-cn-hangzhou.aliyuncs.com . accessKeyId access key Id. accessKeySecret access key secret.

Client creates the new client instance, the returned value is valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (Client) Bucket

func (client Client) Bucket(bucketName string) (*Bucket, error)

Bucket gets the bucket instance.

bucketName the bucket name. Bucket the bucket object, when error is nil.

error it's nil if no error, otherwise it's an error object.

func (Client) CreateBucket

func (client Client) CreateBucket(bucketName string, options ...Option) error

CreateBucket creates a bucket.

bucketName the bucket name, it's globably unique and immutable. The bucket name can only consist of lowercase letters, numbers and dash ('-').

It must start with lowercase letter or number and the length can only be between 3 and 255.

options options for creating the bucket, with optional ACL. The ACL could be ACLPrivate, ACLPublicRead, and ACLPublicReadWrite. By default it's ACLPrivate.

It could also be specified with StorageClass option, which supports StorageStandard, StorageIA(infrequent access), StorageArchive.

error it's nil if no error, otherwise it's an error object.

func (Client) DeleteBucket

func (client Client) DeleteBucket(bucketName string, options ...Option) error

DeleteBucket deletes the bucket. Only empty bucket can be deleted (no object and parts).

bucketName the bucket name.

error it's nil if no error, otherwise it's an error object.

func (Client) DeleteBucketCORS

func (client Client) DeleteBucketCORS(bucketName string) error

DeleteBucketCORS deletes the bucket's static website settings.

bucketName the bucket name.

error it's nil if no error, otherwise it's an error object.

func (Client) DeleteBucketEncryption

func (client Client) DeleteBucketEncryption(bucketName string, options ...Option) error

DeleteBucketEncryption delete bucket encryption config bucketName the bucket name. error it's nil if no error, otherwise it's an error bucket

func (Client) DeleteBucketInventory

func (client Client) DeleteBucketInventory(bucketName, strInventoryId string, options ...Option) error

DeleteBucketInventory API operation for Object Storage Service.

Delete Bucket inventory information.

bucketName tht bucket name.

strInventoryId the inventory id.

error it's nil if no error, otherwise it's an error.

func (Client) DeleteBucketLifecycle

func (client Client) DeleteBucketLifecycle(bucketName string) error

DeleteBucketLifecycle deletes the bucket's lifecycle.

bucketName the bucket name.

error it's nil if no error, otherwise it's an error object.

func (Client) DeleteBucketLogging

func (client Client) DeleteBucketLogging(bucketName string) error

DeleteBucketLogging deletes the logging configuration to disable the logging on the bucket.

bucketName the bucket name to disable the logging.

error it's nil if no error, otherwise it's an error object.

func (Client) DeleteBucketPolicy

func (client Client) DeleteBucketPolicy(bucketName string, options ...Option) error

DeleteBucketPolicy API operation for Object Storage Service.

Deletes the policy from the bucket.

bucketName the bucket name.

error it's nil if no error, otherwise it's an error object.

func (Client) DeleteBucketQosInfo

func (client Client) DeleteBucketQosInfo(bucketName string, options ...Option) error

DeleteBucketQosInfo API operation for Object Storage Service.

Delete Bucket QoS information.

bucketName tht bucket name.

error it's nil if no error, otherwise it's an error object.

func (Client) DeleteBucketTagging

func (client Client) DeleteBucketTagging(bucketName string, options ...Option) error

DeleteBucketTagging delete bucket tagging bucketName name of bucket error nil if success, otherwise error

func (Client) DeleteBucketWebsite

func (client Client) DeleteBucketWebsite(bucketName string) error

DeleteBucketWebsite deletes the bucket's static web site settings.

bucketName the bucket name.

error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketACL

func (client Client) GetBucketACL(bucketName string) (GetBucketACLResult, error)

GetBucketACL gets the bucket ACL.

bucketName the bucket name.

GetBucketAclResponse the result object, and it's only valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketAsyncTask

func (client Client) GetBucketAsyncTask(bucketName string, taskID string, options ...Option) (AsynFetchTaskInfo, error)

GetBucketAsyncTask API operation for set async fetch task

bucketName tht bucket name.

taskid returned by SetBucketAsyncTask

error it's nil if success, otherwise it's an error.

func (Client) GetBucketCORS

func (client Client) GetBucketCORS(bucketName string) (GetBucketCORSResult, error)

GetBucketCORS gets the bucket's CORS settings.

bucketName the bucket name. GetBucketCORSResult the result object upon successful request. It's only valid when error is nil.

error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketEncryption

func (client Client) GetBucketEncryption(bucketName string, options ...Option) (GetBucketEncryptionResult, error)

GetBucketEncryption get bucket encryption bucketName the bucket name. error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketInfo

func (client Client) GetBucketInfo(bucketName string, options ...Option) (GetBucketInfoResult, error)

GetBucketInfo gets the bucket information.

bucketName the bucket name. GetBucketInfoResult the result object upon successful request. It's only valid when error is nil.

error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketInventory

func (client Client) GetBucketInventory(bucketName string, strInventoryId string, options ...Option) (InventoryConfiguration, error)

GetBucketInventory API operation for Object Storage Service

Get the Bucket inventory.

bucketName tht bucket name.

strInventoryId the inventory id.

InventoryConfiguration the inventory configuration.

error it's nil if no error, otherwise it's an error.

func (Client) GetBucketLifecycle

func (client Client) GetBucketLifecycle(bucketName string) (GetBucketLifecycleResult, error)

GetBucketLifecycle gets the bucket's lifecycle settings.

bucketName the bucket name.

GetBucketLifecycleResponse the result object upon successful request. It's only valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketLocation

func (client Client) GetBucketLocation(bucketName string) (string, error)

GetBucketLocation gets the bucket location.

Checks out the following link for more information : https://help.aliyun.com/document_detail/oss/user_guide/oss_concept/endpoint.html

bucketName the bucket name

string bucket's datacenter location error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketLogging

func (client Client) GetBucketLogging(bucketName string) (GetBucketLoggingResult, error)

GetBucketLogging gets the bucket's logging settings

bucketName the bucket name GetBucketLoggingResponse the result object upon successful request. It's only valid when error is nil.

error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketPolicy

func (client Client) GetBucketPolicy(bucketName string, options ...Option) (string, error)

GetBucketPolicy API operation for Object Storage Service.

Get the policy from the bucket.

bucketName the bucket name.

string return the bucket's policy, and it's only valid when error is nil.

error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketQosInfo

func (client Client) GetBucketQosInfo(bucketName string, options ...Option) (BucketQoSConfiguration, error)

GetBucketQosInfo API operation for Object Storage Service.

Get Bucket Qos information.

bucketName tht bucket name.

BucketQoSConfiguration the return qos configuration.

error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketReferer

func (client Client) GetBucketReferer(bucketName string) (GetBucketRefererResult, error)

GetBucketReferer gets the bucket's referrer white list.

bucketName the bucket name.

GetBucketRefererResponse the result object upon successful request. It's only valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketRequestPayment

func (client Client) GetBucketRequestPayment(bucketName string, options ...Option) (RequestPaymentConfiguration, error)

GetBucketRequestPayment API operation for Object Storage Service.

Get bucket requestPayment

bucketName the bucket name.

RequestPaymentConfiguration the payment configuration

error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketStat

func (client Client) GetBucketStat(bucketName string) (GetBucketStatResult, error)

GetBucketStat get bucket stat bucketName the bucket name. error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketTagging

func (client Client) GetBucketTagging(bucketName string, options ...Option) (GetBucketTaggingResult, error)

GetBucketTagging get tagging of the bucket bucketName name of bucket error nil if success, otherwise error

func (Client) GetBucketVersioning

func (client Client) GetBucketVersioning(bucketName string, options ...Option) (GetBucketVersioningResult, error)

GetBucketVersioning get bucket versioning status:Enabled、Suspended bucketName the bucket name. error it's nil if no error, otherwise it's an error object.

func (Client) GetBucketWebsite

func (client Client) GetBucketWebsite(bucketName string) (GetBucketWebsiteResult, error)

GetBucketWebsite gets the bucket's default page (index page) and the error page.

bucketName the bucket name

GetBucketWebsiteResponse the result object upon successful request. It's only valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (Client) GetUserQoSInfo

func (client Client) GetUserQoSInfo(options ...Option) (UserQoSConfiguration, error)

GetUserQoSInfo API operation for Object Storage Service.

Get user qos.

UserQoSConfiguration the User Qos and range Information.

error it's nil if no error, otherwise it's an error object.

func (Client) IsBucketExist

func (client Client) IsBucketExist(bucketName string) (bool, error)

IsBucketExist checks if the bucket exists

bucketName the bucket name.

bool true if it exists, and it's only valid when error is nil. error it's nil if no error, otherwise it's an error object.

func (Client) LimitUploadSpeed

func (client Client) LimitUploadSpeed(upSpeed int) error

LimitUploadSpeed set upload bandwidth limit speed,default is 0,unlimited upSpeed KB/s, 0 is unlimited,default is 0 error it's nil if success, otherwise failure

func (Client) ListBucketInventory

func (client Client) ListBucketInventory(bucketName, continuationToken string, options ...Option) (ListInventoryConfigurationsResult, error)

ListBucketInventory API operation for Object Storage Service

List the Bucket inventory.

bucketName tht bucket name.

continuationToken the users token.

ListInventoryConfigurationsResult list all inventory configuration by .

error it's nil if no error, otherwise it's an error.

func (Client) ListBuckets

func (client Client) ListBuckets(options ...Option) (ListBucketsResult, error)

ListBuckets lists buckets of the current account under the given endpoint, with optional filters.

options specifies the filters such as Prefix, Marker and MaxKeys. Prefix is the bucket name's prefix filter.

And marker makes sure the returned buckets' name are greater than it in lexicographic order.
Maxkeys limits the max keys to return, and by default it's 100 and up to 1000.
For the common usage scenario, please check out list_bucket.go in the sample.

ListBucketsResponse the response object if error is nil.

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketACL

func (client Client) SetBucketACL(bucketName string, bucketACL ACLType) error

SetBucketACL sets bucket's ACL.

bucketName the bucket name bucketAcl the bucket ACL: ACLPrivate, ACLPublicRead and ACLPublicReadWrite.

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketAsyncTask

func (client Client) SetBucketAsyncTask(bucketName string, asynConf AsyncFetchTaskConfiguration, options ...Option) (AsyncFetchTaskResult, error)

SetBucketAsyncTask API operation for set async fetch task

bucketName tht bucket name.

asynConf configruation

error it's nil if success, otherwise it's an error.

func (Client) SetBucketCORS

func (client Client) SetBucketCORS(bucketName string, corsRules []CORSRule) error

SetBucketCORS sets the bucket's CORS rules

For more information, please check out https://help.aliyun.com/document_detail/oss/user_guide/security_management/cors.html

bucketName the bucket name corsRules the CORS rules to set. The related sample code is in sample/bucket_cors.go.

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketEncryption

func (client Client) SetBucketEncryption(bucketName string, encryptionRule ServerEncryptionRule, options ...Option) error

SetBucketEncryption set bucket encryption config bucketName the bucket name. error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketInventory

func (client Client) SetBucketInventory(bucketName string, inventoryConfig InventoryConfiguration, options ...Option) error

SetBucketInventory API operation for Object Storage Service

Set the Bucket inventory.

bucketName tht bucket name.

inventoryConfig the inventory configuration.

error it's nil if no error, otherwise it's an error.

func (Client) SetBucketLifecycle

func (client Client) SetBucketLifecycle(bucketName string, rules []LifecycleRule) error

SetBucketLifecycle sets the bucket's lifecycle.

For more information, checks out following link: https://help.aliyun.com/document_detail/oss/user_guide/manage_object/object_lifecycle.html

bucketName the bucket name. rules the lifecycle rules. There're two kind of rules: absolute time expiration and relative time expiration in days and day/month/year respectively.

Check out sample/bucket_lifecycle.go for more details.

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketLogging

func (client Client) SetBucketLogging(bucketName, targetBucket, targetPrefix string,
	isEnable bool) error

SetBucketLogging sets the bucket logging settings.

OSS could automatically store the access log. Only the bucket owner could enable the logging. Once enabled, OSS would save all the access log into hourly log files in a specified bucket. For more information, please check out https://help.aliyun.com/document_detail/oss/user_guide/security_management/logging.html

bucketName bucket name to enable the log. targetBucket the target bucket name to store the log files. targetPrefix the log files' prefix.

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketPolicy

func (client Client) SetBucketPolicy(bucketName string, policy string, options ...Option) error

SetBucketPolicy API operation for Object Storage Service.

Set the policy from the bucket.

bucketName the bucket name.

policy the bucket policy.

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketQoSInfo

func (client Client) SetBucketQoSInfo(bucketName string, qosConf BucketQoSConfiguration, options ...Option) error

SetBucketQoSInfo API operation for Object Storage Service.

Set Bucket Qos information.

bucketName tht bucket name.

qosConf the qos configuration.

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketReferer

func (client Client) SetBucketReferer(bucketName string, referers []string, allowEmptyReferer bool) error

SetBucketReferer sets the bucket's referer whitelist and the flag if allowing empty referrer.

To avoid stealing link on OSS data, OSS supports the HTTP referrer header. A whitelist referrer could be set either by API or web console, as well as the allowing empty referrer flag. Note that this applies to requests from webbrowser only. For example, for a bucket os-example and its referrer http://www.aliyun.com, all requests from this URL could access the bucket. For more information, please check out this link : https://help.aliyun.com/document_detail/oss/user_guide/security_management/referer.html

bucketName the bucket name. referers the referrer white list. A bucket could have a referrer list and each referrer supports one '*' and multiple '?' as wildcards.

The sample could be found in sample/bucket_referer.go

allowEmptyReferer the flag of allowing empty referrer. By default it's true.

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketRequestPayment

func (client Client) SetBucketRequestPayment(bucketName string, paymentConfig RequestPaymentConfiguration, options ...Option) error

SetBucketRequestPayment API operation for Object Storage Service.

Set the requestPayment of bucket

bucketName the bucket name.

paymentConfig the payment configuration

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketTagging

func (client Client) SetBucketTagging(bucketName string, tagging Tagging, options ...Option) error

SetBucketTagging add tagging to bucket bucketName name of bucket tagging tagging to be added error nil if success, otherwise error

func (Client) SetBucketVersioning

func (client Client) SetBucketVersioning(bucketName string, versioningConfig VersioningConfig, options ...Option) error

SetBucketVersioning set bucket versioning:Enabled、Suspended bucketName the bucket name. error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketWebsite

func (client Client) SetBucketWebsite(bucketName, indexDocument, errorDocument string) error

SetBucketWebsite sets the bucket's static website's index and error page.

OSS supports static web site hosting for the bucket data. When the bucket is enabled with that, you can access the file in the bucket like the way to access a static website. For more information, please check out: https://help.aliyun.com/document_detail/oss/user_guide/static_host_website.html

bucketName the bucket name to enable static web site. indexDocument index page. errorDocument error page.

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketWebsiteDetail

func (client Client) SetBucketWebsiteDetail(bucketName string, wxml WebsiteXML, options ...Option) error

SetBucketWebsiteDetail sets the bucket's static website's detail

OSS supports static web site hosting for the bucket data. When the bucket is enabled with that, you can access the file in the bucket like the way to access a static website. For more information, please check out: https://help.aliyun.com/document_detail/oss/user_guide/static_host_website.html

bucketName the bucket name to enable static web site.

wxml the website's detail

error it's nil if no error, otherwise it's an error object.

func (Client) SetBucketWebsiteXml

func (client Client) SetBucketWebsiteXml(bucketName string, webXml string, options ...Option) error

SetBucketWebsiteXml sets the bucket's static website's rule

OSS supports static web site hosting for the bucket data. When the bucket is enabled with that, you can access the file in the bucket like the way to access a static website. For more information, please check out: https://help.aliyun.com/document_detail/oss/user_guide/static_host_website.html

bucketName the bucket name to enable static web site.

wxml the website's detail

error it's nil if no error, otherwise it's an error object.

type ClientOption

type ClientOption func(*Client)

ClientOption client option such as UseCname, Timeout, SecurityToken.

func AdditionalHeaders

func AdditionalHeaders(headers []string) ClientOption

AdditionalHeaders sets special http headers needed to be signed

func AuthProxy

func AuthProxy(proxyHost, proxyUser, proxyPassword string) ClientOption

AuthProxy sets the proxy information with user name and password.

proxyHost the proxy host in the format "host:port". For example, proxy.com:80 . proxyUser the proxy user name. proxyPassword the proxy password.

func AuthVersion

func AuthVersion(authVersion AuthVersionType) ClientOption

AuthVersion sets auth version: v1 or v2 signature which oss_server needed

func EnableCRC

func EnableCRC(isEnableCRC bool) ClientOption

EnableCRC enables the CRC checksum. Default is true.

isEnableCRC true: enable CRC checksum; false: disable the CRC checksum.

func EnableMD5

func EnableMD5(isEnableMD5 bool) ClientOption

EnableMD5 enables MD5 validation.

isEnableMD5 true: enable MD5 validation; false: disable MD5 validation.

func HTTPClient

func HTTPClient(HTTPClient *http.Client) ClientOption

HTTPClient sets the http.Client in use to the one passed in

func MD5ThresholdCalcInMemory

func MD5ThresholdCalcInMemory(threshold int64) ClientOption

MD5ThresholdCalcInMemory sets the memory usage threshold for computing the MD5, default is 16MB.

threshold the memory threshold in bytes. When the uploaded content is more than 16MB, the temp file is used for computing the MD5.

func Proxy

func Proxy(proxyHost string) ClientOption

Proxy sets the proxy (optional). The default is not using proxy.

proxyHost the proxy host in the format "host:port". For example, proxy.com:80 .

func RedirectEnabled

func RedirectEnabled(enabled bool) ClientOption

only effective from go1.7 onward,RedirectEnabled set http redirect enabled or not

func SecurityToken

func SecurityToken(token string) ClientOption

SecurityToken sets the temporary user's SecurityToken.

token STS token

func SetCredentialsProvider

func SetCredentialsProvider(provider CredentialsProvider) ClientOption

SetCredentialsProvider sets funciton for get the user's ak

func SetLocalAddr

func SetLocalAddr(localAddr net.Addr) ClientOption

SetLocalAddr sets funciton for local addr

func SetLogLevel

func SetLogLevel(LogLevel int) ClientOption

SetLogLevel sets the oss sdk log level

func SetLogger

func SetLogger(Logger *log.Logger) ClientOption

SetLogger sets the oss sdk logger

func Timeout

func Timeout(connectTimeoutSec, readWriteTimeout int64) ClientOption

Timeout sets the HTTP timeout in seconds.

connectTimeoutSec HTTP timeout in seconds. Default is 10 seconds. 0 means infinite (not recommended) readWriteTimeout HTTP read or write's timeout in seconds. Default is 20 seconds. 0 means infinite.

func UseCname

func UseCname(isUseCname bool) ClientOption

UseCname sets the flag of using CName. By default it's false.

isUseCname true: the endpoint has the CName, false: the endpoint does not have cname. Default is false.

func UserAgent

func UserAgent(userAgent string) ClientOption

UserAgent specifies UserAgent. The default is aliyun-sdk-go/1.2.0 (windows/-/amd64;go1.5.2).

userAgent the user agent string.

type CompleteMultipartUploadResult

type CompleteMultipartUploadResult struct {
	XMLName  xml.Name `xml:"CompleteMultipartUploadResult"`
	Location string   `xml:"Location"` // Object URL
	Bucket   string   `xml:"Bucket"`   // Bucket name
	ETag     string   `xml:"ETag"`     // Object ETag
	Key      string   `xml:"Key"`      // Object name
}

CompleteMultipartUploadResult defines result object of CompleteMultipartUploadRequest

type Condition

type Condition struct {
	XMLName                     xml.Name        `xml:"Condition"`
	KeyPrefixEquals             string          `xml:"KeyPrefixEquals,omitempty"`             // Matching objcet prefix
	HTTPErrorCodeReturnedEquals int             `xml:"HttpErrorCodeReturnedEquals,omitempty"` // The rule is for Accessing to the specified object
	IncludeHeader               []IncludeHeader `xml:"IncludeHeader"`                         // The rule is for request which include header
}

Condition defines codition in the RoutingRule

type Config

type Config struct {
	Endpoint            string              // OSS endpoint
	AccessKeyID         string              // AccessId
	AccessKeySecret     string              // AccessKey
	RetryTimes          uint                // Retry count by default it's 5.
	UserAgent           string              // SDK name/version/system information
	IsDebug             bool                // Enable debug mode. Default is false.
	Timeout             uint                // Timeout in seconds. By default it's 60.
	SecurityToken       string              // STS Token
	IsCname             bool                // If cname is in the endpoint.
	HTTPTimeout         HTTPTimeout         // HTTP timeout
	HTTPMaxConns        HTTPMaxConns        // Http max connections
	IsUseProxy          bool                // Flag of using proxy.
	ProxyHost           string              // Flag of using proxy host.
	IsAuthProxy         bool                // Flag of needing authentication.
	ProxyUser           string              // Proxy user
	ProxyPassword       string              // Proxy password
	IsEnableMD5         bool                // Flag of enabling MD5 for upload.
	MD5Threshold        int64               // Memory footprint threshold for each MD5 computation (16MB is the default), in byte. When the data is more than that, temp file is used.
	IsEnableCRC         bool                // Flag of enabling CRC for upload.
	LogLevel            int                 // Log level
	Logger              *log.Logger         // For write log
	UploadLimitSpeed    int                 // Upload limit speed:KB/s, 0 is unlimited
	UploadLimiter       *OssLimiter         // Bandwidth limit reader for upload
	CredentialsProvider CredentialsProvider // User provides interface to get AccessKeyID, AccessKeySecret, SecurityToken
	LocalAddr           net.Addr            // local client host info
	UserSetUa           bool                // UserAgent is set by user or not
	AuthVersion         AuthVersionType     //  v1 or v2 signature,default is v1
	AdditionalHeaders   []string            //  special http headers needed to be sign
	RedirectEnabled     bool                //  only effective from go1.7 onward, enable http redirect or not
}

Config defines oss configuration

func (*Config) GetCredentials

func (config *Config) GetCredentials() Credentials

for get Credentials

func (*Config) LimitUploadSpeed

func (config *Config) LimitUploadSpeed(uploadSpeed int) error

LimitUploadSpeed uploadSpeed:KB/s, 0 is unlimited,default is 0

func (*Config) WriteLog

func (config *Config) WriteLog(LogLevel int, format string, a ...interface{})

WriteLog output log function

type Conn

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

Conn defines OSS Conn

func (Conn) Do

func (conn Conn) Do(method, bucketName, objectName string, params map[string]interface{}, headers map[string]string,
	data io.Reader, initCRC uint64, listener ProgressListener) (*Response, error)

Do sends request and returns the response

func (Conn) DoURL

func (conn Conn) DoURL(method HTTPMethod, signedURL string, headers map[string]string,
	data io.Reader, initCRC uint64, listener ProgressListener) (*Response, error)

DoURL sends the request with signed URL and returns the response result.

func (Conn) LoggerHTTPReq

func (conn Conn) LoggerHTTPReq(req *http.Request)

LoggerHTTPReq Print the header information of the http request

func (Conn) LoggerHTTPResp

func (conn Conn) LoggerHTTPResp(req *http.Request, resp *http.Response)

LoggerHTTPResp Print Response to http request

type CopyObjectResult

type CopyObjectResult struct {
	XMLName      xml.Name  `xml:"CopyObjectResult"`
	LastModified time.Time `xml:"LastModified"` // New object's last modified time.
	ETag         string    `xml:"ETag"`         // New object's ETag
}

CopyObjectResult defines result object of CopyObject

type CreateLiveChannelResult

type CreateLiveChannelResult struct {
	XMLName     xml.Name `xml:"CreateLiveChannelResult"`
	PublishUrls []string `xml:"PublishUrls>Url"` //push urls list
	PlayUrls    []string `xml:"PlayUrls>Url"`    //play urls list
}

CreateLiveChannelResult the result of crete live-channel

type Credentials

type Credentials interface {
	GetAccessKeyID() string
	GetAccessKeySecret() string
	GetSecurityToken() string
}

CredentialInf is interface for get AccessKeyID,AccessKeySecret,SecurityToken

type CredentialsProvider

type CredentialsProvider interface {
	GetCredentials() Credentials
}

CredentialInfBuild is interface for get CredentialInf

type CsvMetaRequest

type CsvMetaRequest struct {
	XMLName            xml.Name           `xml:"CsvMetaRequest"`
	InputSerialization InputSerialization `xml:"InputSerialization"`
	OverwriteIfExists  *bool              `xml:"OverwriteIfExists,omitempty"`
}

type DataRedundancyType

type DataRedundancyType string

RedundancyType bucket data Redundancy type

const (
	// RedundancyLRS Local redundancy, default value
	RedundancyLRS DataRedundancyType = "LRS"

	// RedundancyZRS Same city redundancy
	RedundancyZRS DataRedundancyType = "ZRS"
)

type DeleteObject

type DeleteObject struct {
	XMLName   xml.Name `xml:"Object"`
	Key       string   `xml:"Key"`                 // Object name
	VersionId string   `xml:"VersionId,omitempty"` // Object VersionId
}

DeleteObject defines the struct for deleting object

type DeleteObjectVersionsResult

type DeleteObjectVersionsResult struct {
	XMLName              xml.Name         `xml:"DeleteResult"`
	DeletedObjectsDetail []DeletedKeyInfo `xml:"Deleted"` // Deleted object detail info
}

DeleteObjectsResult_inner defines result of DeleteObjects request

type DeleteObjectsResult

type DeleteObjectsResult struct {
	XMLName        xml.Name
	DeletedObjects []string // Deleted object key list
}

DeleteObjectsResult defines result of DeleteObjects request

type DeletedKeyInfo

type DeletedKeyInfo struct {
	XMLName               xml.Name `xml:"Deleted"`
	Key                   string   `xml:"Key"`                   // Object key
	VersionId             string   `xml:"VersionId"`             // VersionId
	DeleteMarker          bool     `xml:"DeleteMarker"`          // Object DeleteMarker
	DeleteMarkerVersionId string   `xml:"DeleteMarkerVersionId"` // Object DeleteMarkerVersionId
}

DeleteKeyInfo defines object delete info

type DiscardReadCloser

type DiscardReadCloser struct {
	RC      io.ReadCloser
	Discard int
}

func (*DiscardReadCloser) Close

func (drc *DiscardReadCloser) Close() error

func (*DiscardReadCloser) Read

func (drc *DiscardReadCloser) Read(b []byte) (int, error)

type EndFrame

type EndFrame struct {
	TotalScanned   int64
	HTTPStatusCode int32
	ErrorMsg       string
}

EndFrame is EndFrameType of SelectObject api

type ErrorDocument

type ErrorDocument struct {
	XMLName xml.Name `xml:"ErrorDocument"`
	Key     string   `xml:"Key"` // 404 error file name
}

ErrorDocument defines the 404 error page info

type FileChunk

type FileChunk struct {
	Number int   // Chunk number
	Offset int64 // Chunk offset
	Size   int64 // Chunk size.
}

FileChunk is the file chunk definition

func SplitFileByPartNum

func SplitFileByPartNum(fileName string, chunkNum int) ([]FileChunk, error)

SplitFileByPartNum splits big file into parts by the num of parts. Split the file with specified parts count, returns the split result when error is nil.

func SplitFileByPartSize

func SplitFileByPartSize(fileName string, chunkSize int64) ([]FileChunk, error)

SplitFileByPartSize splits big file into parts by the size of parts. Splits the file by the part size. Returns the FileChunk when error is nil.

type GetBucketACLResult

type GetBucketACLResult struct {
	XMLName xml.Name `xml:"AccessControlPolicy"`
	ACL     string   `xml:"AccessControlList>Grant"` // Bucket ACL
	Owner   Owner    `xml:"Owner"`                   // Bucket owner
}

GetBucketACLResult defines GetBucketACL request's result

type GetBucketCORSResult

type GetBucketCORSResult CORSXML

GetBucketCORSResult defines the result from GetBucketCORS request.

type GetBucketEncryptionResult

type GetBucketEncryptionResult ServerEncryptionRule

type GetBucketInfoResult

type GetBucketInfoResult struct {
	XMLName    xml.Name   `xml:"BucketInfo"`
	BucketInfo BucketInfo `xml:"Bucket"`
}

GetBucketInfoResult defines the result from GetBucketInfo request.

type GetBucketLifecycleResult

type GetBucketLifecycleResult LifecycleConfiguration

GetBucketLifecycleResult defines GetBucketLifecycle's result object

type GetBucketLoggingResult

type GetBucketLoggingResult LoggingXML

GetBucketLoggingResult defines the result from GetBucketLogging request

type GetBucketRefererResult

type GetBucketRefererResult RefererXML

GetBucketRefererResult defines result object for GetBucketReferer request

type GetBucketStatResult

type GetBucketStatResult BucketStat

type GetBucketTaggingResult

type GetBucketTaggingResult Tagging

type GetBucketVersioningResult

type GetBucketVersioningResult VersioningConfig

type GetBucketWebsiteResult

type GetBucketWebsiteResult WebsiteXML

GetBucketWebsiteResult defines the result from GetBucketWebsite request.

type GetObjectACLResult

type GetObjectACLResult GetBucketACLResult

GetObjectACLResult defines result of GetObjectACL request

type GetObjectRequest

type GetObjectRequest struct {
	ObjectKey string
}

GetObjectRequest is the request of DoGetObject

type GetObjectResult

type GetObjectResult struct {
	Response  *Response
	ClientCRC hash.Hash64
	ServerCRC uint64
}

GetObjectResult is the result of DoGetObject

type GetObjectTaggingResult

type GetObjectTaggingResult Tagging

for GetObjectTagging return value

type HTTPMaxConns

type HTTPMaxConns struct {
	MaxIdleConns        int
	MaxIdleConnsPerHost int
}

HTTPMaxConns defines max idle connections and max idle connections per host

type HTTPMethod

type HTTPMethod string

HTTPMethod HTTP request method

const (
	// HTTPGet HTTP GET
	HTTPGet HTTPMethod = "GET"

	// HTTPPut HTTP PUT
	HTTPPut HTTPMethod = "PUT"

	// HTTPHead HTTP HEAD
	HTTPHead HTTPMethod = "HEAD"

	// HTTPPost HTTP POST
	HTTPPost HTTPMethod = "POST"

	// HTTPDelete HTTP DELETE
	HTTPDelete HTTPMethod = "DELETE"
)

type HTTPTimeout

type HTTPTimeout struct {
	ConnectTimeout   time.Duration
	ReadWriteTimeout time.Duration
	HeaderTimeout    time.Duration
	LongTimeout      time.Duration
	IdleConnTimeout  time.Duration
}

HTTPTimeout defines HTTP timeout.

type IncludeHeader

type IncludeHeader struct {
	XMLName xml.Name `xml:"IncludeHeader"`
	Key     string   `xml:"Key,omitempty"`    // The Include header key
	Equals  string   `xml:"Equals,omitempty"` // The Include header value
}

IncludeHeader defines includeHeader in the RoutingRule's Condition

type IndexDocument

type IndexDocument struct {
	XMLName xml.Name `xml:"IndexDocument"`
	Suffix  string   `xml:"Suffix"` // The file name for the index page
}

IndexDocument defines the index page info

type InitiateMultipartUploadResult

type InitiateMultipartUploadResult struct {
	XMLName  xml.Name `xml:"InitiateMultipartUploadResult"`
	Bucket   string   `xml:"Bucket"`   // Bucket name
	Key      string   `xml:"Key"`      // Object name to upload
	UploadID string   `xml:"UploadId"` // Generated UploadId
}

InitiateMultipartUploadResult defines result of InitiateMultipartUpload request

type InputSerialization

type InputSerialization struct {
	XMLName         xml.Name `xml:"InputSerialization"`
	CSV             CSV      `xml:CSV,omitempty`
	JSON            JSON     `xml:JSON,omitempty`
	CompressionType string   `xml:"CompressionType,omitempty"`
}

type InputSerializationSelect

type InputSerializationSelect struct {
	XMLName         xml.Name        `xml:"InputSerialization"`
	CsvBodyInput    CSVSelectInput  `xml:CSV,omitempty`
	JsonBodyInput   JSONSelectInput `xml:JSON,omitempty`
	CompressionType string          `xml:"CompressionType,omitempty"`
}

type InvEncryption

type InvEncryption struct {
	XMLName xml.Name   `xml:"Encryption"`
	SseOss  *InvSseOss `xml:"SSE-OSS"`
	SseKms  *InvSseKms `xml:"SSE-KMS"`
}

type InvSseKms

type InvSseKms struct {
	XMLName xml.Name `xml:"SSE-KMS"`
	KmsId   string   `xml:"KeyId,omitempty"`
}

type InvSseOss

type InvSseOss struct {
	XMLName xml.Name `xml:"SSE-OSS"`
}

type InventoryConfiguration

type InventoryConfiguration struct {
	XMLName                xml.Name             `xml:"InventoryConfiguration"`
	Id                     string               `xml:"Id,omitempty"`
	IsEnabled              *bool                `xml:"IsEnabled,omitempty"`
	Prefix                 string               `xml:"Filter>Prefix,omitempty"`
	OSSBucketDestination   OSSBucketDestination `xml:"Destination>OSSBucketDestination,omitempty"`
	Frequency              string               `xml:"Schedule>Frequency,omitempty"`
	IncludedObjectVersions string               `xml:"IncludedObjectVersions,omitempty"`
	OptionalFields         OptionalFields       `xml:OptionalFields,omitempty`
}

InventoryConfiguration is Inventory config

type JSON

type JSON struct {
	XMLName  xml.Name `xml:"JSON"`
	JSONType string   `xml:"Type,omitempty"`
}

type JSONSelectInput

type JSONSelectInput struct {
	XMLName                 xml.Name `xml:"JSON"`
	JSONType                string   `xml:"Type,omitempty"`
	Range                   string   `xml:"Range,omitempty"`
	ParseJSONNumberAsString *bool    `xml:"ParseJsonNumberAsString"`
	SplitRange              string
}

func (*JSONSelectInput) JsonIsEmpty

func (jsonInput *JSONSelectInput) JsonIsEmpty() bool

type JSONSelectOutput

type JSONSelectOutput struct {
	XMLName         xml.Name `xml:"JSON"`
	RecordDelimiter string   `xml:"RecordDelimiter,omitempty"`
}

type JsonMetaRequest

type JsonMetaRequest struct {
	XMLName            xml.Name           `xml:"JsonMetaRequest"`
	InputSerialization InputSerialization `xml:"InputSerialization"`
	OverwriteIfExists  *bool              `xml:"OverwriteIfExists,omitempty"`
}

type LifecycleAbortMultipartUpload

type LifecycleAbortMultipartUpload struct {
	XMLName           xml.Name `xml:"AbortMultipartUpload"`
	Days              int      `xml:"Days,omitempty"`              // Relative expiration time: The expiration time in days after the last modified time
	CreatedBeforeDate string   `xml:"CreatedBeforeDate,omitempty"` // objects created before the date will be expired
}

LifecycleAbortMultipartUpload defines the rule's abort multipart upload propery

type LifecycleConfiguration

type LifecycleConfiguration struct {
	XMLName xml.Name        `xml:"LifecycleConfiguration"`
	Rules   []LifecycleRule `xml:"Rule"`
}

LifecycleConfiguration is the Bucket Lifecycle configuration

type LifecycleExpiration

type LifecycleExpiration struct {
	XMLName                   xml.Name `xml:"Expiration"`
	Days                      int      `xml:"Days,omitempty"`                      // Relative expiration time: The expiration time in days after the last modified time
	Date                      string   `xml:"Date,omitempty"`                      // Absolute expiration time: The expiration time in date, not recommended
	CreatedBeforeDate         string   `xml:"CreatedBeforeDate,omitempty"`         // objects created before the date will be expired
	ExpiredObjectDeleteMarker *bool    `xml:"ExpiredObjectDeleteMarker,omitempty"` // Specifies whether the expired delete tag is automatically deleted
}

LifecycleExpiration defines the rule's expiration property

type LifecycleRule

type LifecycleRule struct {
	XMLName              xml.Name                       `xml:"Rule"`
	ID                   string                         `xml:"ID,omitempty"`                   // The rule ID
	Prefix               string                         `xml:"Prefix"`                         // The object key prefix
	Status               string                         `xml:"Status"`                         // The rule status (enabled or not)
	Tags                 []Tag                          `xml:"Tag,omitempty"`                  // the tags property
	Expiration           *LifecycleExpiration           `xml:"Expiration,omitempty"`           // The expiration property
	Transitions          []LifecycleTransition          `xml:"Transition,omitempty"`           // The transition property
	AbortMultipartUpload *LifecycleAbortMultipartUpload `xml:"AbortMultipartUpload,omitempty"` // The AbortMultipartUpload property
	NonVersionExpiration *LifecycleVersionExpiration    `xml:"NoncurrentVersionExpiration,omitempty"`
	NonVersionTransition *LifecycleVersionTransition    `xml:"NoncurrentVersionTransition,omitempty"`
}

LifecycleRule defines Lifecycle rules

func BuildLifecycleRuleByDate

func BuildLifecycleRuleByDate(id, prefix string, status bool, year, month, day int) LifecycleRule

BuildLifecycleRuleByDate builds a lifecycle rule objects will expiration in specified date

func BuildLifecycleRuleByDays

func BuildLifecycleRuleByDays(id, prefix string, status bool, days int) LifecycleRule

BuildLifecycleRuleByDays builds a lifecycle rule objects will expiration in days after the last modified time

type LifecycleTransition

type LifecycleTransition struct {
	XMLName           xml.Name         `xml:"Transition"`
	Days              int              `xml:"Days,omitempty"`              // Relative transition time: The transition time in days after the last modified time
	CreatedBeforeDate string           `xml:"CreatedBeforeDate,omitempty"` // objects created before the date will be expired
	StorageClass      StorageClassType `xml:"StorageClass,omitempty"`      // Specifies the target storage type
}

LifecycleTransition defines the rule's transition propery

type LifecycleVersionExpiration

type LifecycleVersionExpiration struct {
	XMLName        xml.Name `xml:"NoncurrentVersionExpiration"`
	NoncurrentDays int      `xml:"NoncurrentDays,omitempty"` // How many days after the Object becomes a non-current version
}

LifecycleVersionExpiration defines the rule's NoncurrentVersionExpiration propery

type LifecycleVersionTransition

type LifecycleVersionTransition struct {
	XMLName        xml.Name         `xml:"NoncurrentVersionTransition"`
	NoncurrentDays int              `xml:"NoncurrentDays,omitempty"` // How many days after the Object becomes a non-current version
	StorageClass   StorageClassType `xml:"StorageClass,omitempty"`
}

LifecycleVersionTransition defines the rule's NoncurrentVersionTransition propery

type LimitSpeedReader

type LimitSpeedReader struct {
	io.ReadCloser
	// contains filtered or unexported fields
}

LimitSpeedReader for limit bandwidth upload

func (*LimitSpeedReader) Close

func (r *LimitSpeedReader) Close() error

Close ...

func (*LimitSpeedReader) Read

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

Read

type LimitedReadCloser

type LimitedReadCloser struct {
	io.LimitedReader
}

LimitedRC support Close()

func (*LimitedReadCloser) Close

func (lc *LimitedReadCloser) Close() error

type ListBucketsResult

type ListBucketsResult struct {
	XMLName     xml.Name           `xml:"ListAllMyBucketsResult"`
	Prefix      string             `xml:"Prefix"`         // The prefix in this query
	Marker      string             `xml:"Marker"`         // The marker filter
	MaxKeys     int                `xml:"MaxKeys"`        // The max entry count to return. This information is returned when IsTruncated is true.
	IsTruncated bool               `xml:"IsTruncated"`    // Flag true means there's remaining buckets to return.
	NextMarker  string             `xml:"NextMarker"`     // The marker filter for the next list call
	Owner       Owner              `xml:"Owner"`          // The owner information
	Buckets     []BucketProperties `xml:"Buckets>Bucket"` // The bucket list
}

ListBucketsResult defines the result object from ListBuckets request

type ListInventoryConfigurationsResult

type ListInventoryConfigurationsResult struct {
	XMLName                xml.Name                 `xml:"ListInventoryConfigurationsResult"`
	InventoryConfiguration []InventoryConfiguration `xml:"InventoryConfiguration,omitempty`
	IsTruncated            *bool                    `xml:"IsTruncated,omitempty"`
	NextContinuationToken  string                   `xml:"NextContinuationToken,omitempty"`
}

type ListLiveChannelResult

type ListLiveChannelResult struct {
	XMLName     xml.Name          `xml:"ListLiveChannelResult"`
	Prefix      string            `xml:"Prefix"`      //Filter by the name start with the value of "Prefix"
	Marker      string            `xml:"Marker"`      //cursor from which starting list
	MaxKeys     int               `xml:"MaxKeys"`     //The maximum count returned. the default value is 100. it cannot be greater than 1000.
	IsTruncated bool              `xml:"IsTruncated"` //Indicates whether all results have been returned, "true" indicates partial results returned while "false" indicates all results have been returned
	NextMarker  string            `xml:"NextMarker"`  //NextMarker indicate the Marker value of the next request
	LiveChannel []LiveChannelInfo `xml:"LiveChannel"` //The infomation of live-channel
}

ListLiveChannelResult the result of ListLiveChannel

type ListMultipartUploadResult

type ListMultipartUploadResult struct {
	XMLName            xml.Name            `xml:"ListMultipartUploadsResult"`
	Bucket             string              `xml:"Bucket"`                // Bucket name
	Delimiter          string              `xml:"Delimiter"`             // Delimiter for grouping object.
	Prefix             string              `xml:"Prefix"`                // Object prefix
	KeyMarker          string              `xml:"KeyMarker"`             // Object key marker
	UploadIDMarker     string              `xml:"UploadIdMarker"`        // UploadId marker
	NextKeyMarker      string              `xml:"NextKeyMarker"`         // Next key marker, if not all entries returned.
	NextUploadIDMarker string              `xml:"NextUploadIdMarker"`    // Next uploadId marker, if not all entries returned.
	MaxUploads         int                 `xml:"MaxUploads"`            // Max uploads to return
	IsTruncated        bool                `xml:"IsTruncated"`           // Flag indicates all entries are returned.
	Uploads            []UncompletedUpload `xml:"Upload"`                // Ongoing uploads (not completed, not aborted)
	CommonPrefixes     []string            `xml:"CommonPrefixes>Prefix"` // Common prefixes list.
}

ListMultipartUploadResult defines result object of ListMultipartUpload

type ListObjectVersionsResult

type ListObjectVersionsResult struct {
	XMLName             xml.Name                       `xml:"ListVersionsResult"`
	Name                string                         `xml:"Name"`                  // The Bucket Name
	Owner               Owner                          `xml:"Owner"`                 // The owner of bucket
	Prefix              string                         `xml:"Prefix"`                // The object prefix
	KeyMarker           string                         `xml:"KeyMarker"`             // The start marker filter.
	VersionIdMarker     string                         `xml:"VersionIdMarker"`       // The start VersionIdMarker filter.
	MaxKeys             int                            `xml:"MaxKeys"`               // Max keys to return
	Delimiter           string                         `xml:"Delimiter"`             // The delimiter for grouping objects' name
	IsTruncated         bool                           `xml:"IsTruncated"`           // Flag indicates if all results are returned (when it's false)
	NextKeyMarker       string                         `xml:"NextKeyMarker"`         // The start point of the next query
	NextVersionIdMarker string                         `xml:"NextVersionIdMarker"`   // The start point of the next query
	CommonPrefixes      []string                       `xml:"CommonPrefixes>Prefix"` // You can think of commonprefixes as "folders" whose names end with the delimiter
	ObjectDeleteMarkers []ObjectDeleteMarkerProperties `xml:"DeleteMarker"`          // DeleteMarker list
	ObjectVersions      []ObjectVersionProperties      `xml:"Version"`               // version list
}

ListObjectVersionsResult defines the result from ListObjectVersions request

type ListObjectsResult

type ListObjectsResult struct {
	XMLName        xml.Name           `xml:"ListBucketResult"`
	Prefix         string             `xml:"Prefix"`                // The object prefix
	Marker         string             `xml:"Marker"`                // The marker filter.
	MaxKeys        int                `xml:"MaxKeys"`               // Max keys to return
	Delimiter      string             `xml:"Delimiter"`             // The delimiter for grouping objects' name
	IsTruncated    bool               `xml:"IsTruncated"`           // Flag indicates if all results are returned (when it's false)
	NextMarker     string             `xml:"NextMarker"`            // The start point of the next query
	Objects        []ObjectProperties `xml:"Contents"`              // Object list
	CommonPrefixes []string           `xml:"CommonPrefixes>Prefix"` // You can think of commonprefixes as "folders" whose names end with the delimiter
}

ListObjectsResult defines the result from ListObjects request

type ListUploadedPartsResult

type ListUploadedPartsResult struct {
	XMLName              xml.Name       `xml:"ListPartsResult"`
	Bucket               string         `xml:"Bucket"`               // Bucket name
	Key                  string         `xml:"Key"`                  // Object name
	UploadID             string         `xml:"UploadId"`             // Upload ID
	NextPartNumberMarker string         `xml:"NextPartNumberMarker"` // Next part number
	MaxParts             int            `xml:"MaxParts"`             // Max parts count
	IsTruncated          bool           `xml:"IsTruncated"`          // Flag indicates all entries returned.false: all entries returned.
	UploadedParts        []UploadedPart `xml:"Part"`                 // Uploaded parts
}

ListUploadedPartsResult defines result object of ListUploadedParts

type LiveChannelAudio

type LiveChannelAudio struct {
	XMLName    xml.Name `xml:"Audio"`
	SampleRate int      `xml:"SampleRate"` //SampleRate
	Bandwidth  int      `xml:"Bandwidth"`  //Bandwidth (unit: B/s)
	Codec      string   `xml:"Codec"`      //Encoding forma
}

LiveChannelAudio audio stream information

type LiveChannelConfiguration

type LiveChannelConfiguration struct {
	XMLName     xml.Name          `xml:"LiveChannelConfiguration"`
	Description string            `xml:"Description,omitempty"` //Description of live-channel, up to 128 bytes
	Status      string            `xml:"Status,omitempty"`      //�Specify the status of livechannel
	Target      LiveChannelTarget `xml:"Target"`                //target configuration of live-channel
	// use point instead of struct to avoid omit empty snapshot
	Snapshot *LiveChannelSnapshot `xml:"Snapshot,omitempty"` //snapshot configuration of live-channel
}

LiveChannelConfiguration defines the configuration for live-channel

type LiveChannelHistory

type LiveChannelHistory struct {
	XMLName xml.Name     `xml:"LiveChannelHistory"`
	Record  []LiveRecord `xml:"LiveRecord"` //push records list
}

LiveChannelHistory the result of GetLiveChannelHistory, at most return up to lastest 10 push records

type LiveChannelInfo

type LiveChannelInfo struct {
	XMLName      xml.Name  `xml:"LiveChannel"`
	Name         string    `xml:"Name"`            //The name of live-channel
	Description  string    `xml:"Description"`     //Description of live-channel
	Status       string    `xml:"Status"`          //Status: disabled or enabled
	LastModified time.Time `xml:"LastModified"`    //Last modification time, format: ISO8601
	PublishUrls  []string  `xml:"PublishUrls>Url"` //push urls list
	PlayUrls     []string  `xml:"PlayUrls>Url"`    //play urls list
}

LiveChannelInfo the infomation of live-channel

type LiveChannelSnapshot

type LiveChannelSnapshot struct {
	XMLName     xml.Name `xml:"Snapshot"`
	RoleName    string   `xml:"RoleName,omitempty"`    //The role of snapshot operations, it sholud has write permission of DestBucket and the permission to send messages to the NotifyTopic.
	DestBucket  string   `xml:"DestBucket,omitempty"`  //Bucket the snapshots will be written to. should be the same owner as the source bucket.
	NotifyTopic string   `xml:"NotifyTopic,omitempty"` //Topics of MNS for notifying users of high frequency screenshot operation results
	Interval    int      `xml:"Interval,omitempty"`    //interval of snapshots, threre is no snapshot if no I-frame during the interval time
}

LiveChannelSnapshot snapshot configuration of live-channel

type LiveChannelStat

type LiveChannelStat struct {
	XMLName       xml.Name         `xml:"LiveChannelStat"`
	Status        string           `xml:"Status"`        //Current push status of live-channel: Disabled,Live,Idle
	ConnectedTime time.Time        `xml:"ConnectedTime"` //The time when the client starts pushing, format: ISO8601
	RemoteAddr    string           `xml:"RemoteAddr"`    //The ip address of the client
	Video         LiveChannelVideo `xml:"Video"`         //Video stream information
	Audio         LiveChannelAudio `xml:"Audio"`         //Audio stream information
}

LiveChannelStat the result of get live-channel state

type LiveChannelTarget

type LiveChannelTarget struct {
	XMLName      xml.Name `xml:"Target"`
	Type         string   `xml:"Type"`                   //the type of object, only supports HLS
	FragDuration int      `xml:"FragDuration,omitempty"` //the length of each ts object (in seconds), in the range [1,100]
	FragCount    int      `xml:"FragCount,omitempty"`    //the number of ts objects in the m3u8 object, in the range of [1,100]
	PlaylistName string   `xml:"PlaylistName,omitempty"` //the name of m3u8 object, which must end with ".m3u8" and the length range is [6,128]
}

LiveChannelTarget target configuration of live-channel

type LiveChannelVideo

type LiveChannelVideo struct {
	XMLName   xml.Name `xml:"Video"`
	Width     int      `xml:"Width"`     //Width (unit: pixels)
	Height    int      `xml:"Height"`    //Height (unit: pixels)
	FrameRate int      `xml:"FrameRate"` //FramRate
	Bandwidth int      `xml:"Bandwidth"` //Bandwidth (unit: B/s)
}

LiveChannelVideo video stream information

type LiveRecord

type LiveRecord struct {
	XMLName    xml.Name  `xml:"LiveRecord"`
	StartTime  time.Time `xml:"StartTime"`  //StartTime, format: ISO8601
	EndTime    time.Time `xml:"EndTime"`    //EndTime, format: ISO8601
	RemoteAddr string    `xml:"RemoteAddr"` //The ip address of remote client
}

LiveRecord push recode

type LoggingEnabled

type LoggingEnabled struct {
	XMLName      xml.Name `xml:"LoggingEnabled"`
	TargetBucket string   `xml:"TargetBucket"` // The bucket name for storing the log files
	TargetPrefix string   `xml:"TargetPrefix"` // The log file prefix
}

LoggingEnabled defines the logging configuration information

type LoggingXML

type LoggingXML struct {
	XMLName        xml.Name       `xml:"BucketLoggingStatus"`
	LoggingEnabled LoggingEnabled `xml:"LoggingEnabled"` // The logging configuration information
}

LoggingXML defines logging configuration

type MetaEndFrameCSV

type MetaEndFrameCSV struct {
	TotalScanned int64
	Status       int32
	SplitsCount  int32
	RowsCount    int64
	ColumnsCount int32
	ErrorMsg     string
}

MetaEndFrameCSV is MetaEndFrameCSVType of CreateSelectObjectMeta

type MetaEndFrameJSON

type MetaEndFrameJSON struct {
	TotalScanned int64
	Status       int32
	SplitsCount  int32
	RowsCount    int64
	ErrorMsg     string
}

MetaEndFrameJSON is MetaEndFrameJSON of CreateSelectObjectMeta

type MetadataDirectiveType

type MetadataDirectiveType string

MetadataDirectiveType specifying whether use the metadata of source object when copying object.

const (
	// MetaCopy the target object's metadata is copied from the source one
	MetaCopy MetadataDirectiveType = "COPY"

	// MetaReplace the target object's metadata is created as part of the copy request (not same as the source one)
	MetaReplace MetadataDirectiveType = "REPLACE"
)

type MirrorHeaderSet

type MirrorHeaderSet struct {
	XMLName xml.Name `xml:"Set"`
	Key     string   `xml:"Key,omitempty"`   // The mirror header key
	Value   string   `xml:"Value,omitempty"` // The mirror header value
}

MirrorHeaderSet defines Set for Redirect's MirrorHeaders

type MirrorHeaders

type MirrorHeaders struct {
	XMLName xml.Name          `xml:"MirrorHeaders"`
	PassAll *bool             `xml:"PassAll"` // Penetrating all of headers to source website.
	Pass    []string          `xml:"Pass"`    // Penetrating some of headers to source website.
	Remove  []string          `xml:"Remove"`  // Prohibit passthrough some of headers to source website
	Set     []MirrorHeaderSet `xml:"Set"`     // Setting some of headers send to source website
}

MirrorHeaders defines MirrorHeaders in the Redirect

type OSSBucketDestination

type OSSBucketDestination struct {
	XMLName    xml.Name       `xml:"OSSBucketDestination"`
	Format     string         `xml:"Format,omitempty"`
	AccountId  string         `xml:"AccountId,omitempty"`
	RoleArn    string         `xml:"RoleArn,omitempty"`
	Bucket     string         `xml:"Bucket,omitempty"`
	Prefix     string         `xml:"Prefix,omitempty"`
	Encryption *InvEncryption `xml:"Encryption,omitempty"`
}

type ObjectDeleteMarkerProperties

type ObjectDeleteMarkerProperties struct {
	XMLName      xml.Name  `xml:"DeleteMarker"`
	Key          string    `xml:"Key"`          // The Object Key
	VersionId    string    `xml:"VersionId"`    // The Object VersionId
	IsLatest     bool      `xml:"IsLatest"`     // is current version or not
	LastModified time.Time `xml:"LastModified"` // Object last modified time
	Owner        Owner     `xml:"Owner"`        // bucket owner element
}

type ObjectProperties

type ObjectProperties struct {
	XMLName      xml.Name  `xml:"Contents"`
	Key          string    `xml:"Key"`          // Object key
	Type         string    `xml:"Type"`         // Object type
	Size         int64     `xml:"Size"`         // Object size
	ETag         string    `xml:"ETag"`         // Object ETag
	Owner        Owner     `xml:"Owner"`        // Object owner information
	LastModified time.Time `xml:"LastModified"` // Object last modified time
	StorageClass string    `xml:"StorageClass"` // Object storage class (Standard, IA, Archive)
}

ObjectProperties defines Objecct properties

type ObjectVersionProperties

type ObjectVersionProperties struct {
	XMLName      xml.Name  `xml:"Version"`
	Key          string    `xml:"Key"`          // The Object Key
	VersionId    string    `xml:"VersionId"`    // The Object VersionId
	IsLatest     bool      `xml:"IsLatest"`     // is latest version or not
	LastModified time.Time `xml:"LastModified"` // Object last modified time
	Type         string    `xml:"Type"`         // Object type
	Size         int64     `xml:"Size"`         // Object size
	ETag         string    `xml:"ETag"`         // Object ETag
	StorageClass string    `xml:"StorageClass"` // Object storage class (Standard, IA, Archive)
	Owner        Owner     `xml:"Owner"`        // bucket owner element
}

type Option

type Option func(map[string]optionValue) error

Option HTTP option

func ACL

func ACL(acl ACLType) Option

ACL is an option to set X-Oss-Acl header

func ACReqHeaders

func ACReqHeaders(value string) Option

ACReqHeaders is an option to set Access-Control-Request-Headers header

func ACReqMethod

func ACReqMethod(value string) Option

ACReqMethod is an option to set Access-Control-Request-Method header

func AcceptEncoding

func AcceptEncoding(value string) Option

AcceptEncoding is an option to set Accept-Encoding header

func AddContentType

func AddContentType(options []Option, keys ...string) []Option

func AddParam

func AddParam(key string, value interface{}) Option

AddParam Allow users to set personalized http params

func CacheControl

func CacheControl(value string) Option

CacheControl is an option to set Cache-Control header

func Callback

func Callback(callback string) Option

Callback is an option to set callback values

func CallbackVar

func CallbackVar(callbackVar string) Option

CallbackVar is an option to set callback user defined values

func Checkpoint

func Checkpoint(isEnable bool, filePath string) Option

Checkpoint sets the isEnable flag and checkpoint file path for DownloadFile/UploadFile.

func CheckpointDir

func CheckpointDir(isEnable bool, dirPath string) Option

CheckpointDir sets the isEnable flag and checkpoint dir path for DownloadFile/UploadFile.

func ChoiceAbortPartOption

func ChoiceAbortPartOption(options []Option) []Option

ChoiceAbortPartOption choices valid option supported by AbortMultipartUpload

func ChoiceCompletePartOption

func ChoiceCompletePartOption(options []Option) []Option

ChoiceCompletePartOption choices valid option supported by CompleteMulitiPart

func ChoiceHeadObjectOption

func ChoiceHeadObjectOption(options []Option) []Option

ChoiceHeadObjectOption choices valid option supported by HeadObject

func ChoiceTransferPartOption

func ChoiceTransferPartOption(options []Option) []Option

choiceTransferPartOption choices valid option supported by Uploadpart or DownloadPart

func ContentDisposition

func ContentDisposition(value string) Option

ContentDisposition is an option to set Content-Disposition header

func ContentEncoding

func ContentEncoding(value string) Option

ContentEncoding is an option to set Content-Encoding header

func ContentLanguage

func ContentLanguage(value string) Option

ContentLanguage is an option to set Content-Language header

func ContentLength

func ContentLength(length int64) Option

ContentLength is an option to set Content-Length header

func ContentMD5

func ContentMD5(value string) Option

ContentMD5 is an option to set Content-MD5 header

func ContentType

func ContentType(value string) Option

ContentType is an option to set Content-Type header

func CopySource

func CopySource(sourceBucket, sourceObject string) Option

CopySource is an option to set X-Oss-Copy-Source header

func CopySourceIfMatch

func CopySourceIfMatch(value string) Option

CopySourceIfMatch is an option to set X-Oss-Copy-Source-If-Match header

func CopySourceIfModifiedSince

func CopySourceIfModifiedSince(t time.Time) Option

CopySourceIfModifiedSince is an option to set X-Oss-CopySource-If-Modified-Since header

func CopySourceIfNoneMatch

func CopySourceIfNoneMatch(value string) Option

CopySourceIfNoneMatch is an option to set X-Oss-Copy-Source-If-None-Match header

func CopySourceIfUnmodifiedSince

func CopySourceIfUnmodifiedSince(t time.Time) Option

CopySourceIfUnmodifiedSince is an option to set X-Oss-Copy-Source-If-Unmodified-Since header

func CopySourceRange

func CopySourceRange(startPosition, partSize int64) Option

CopySourceRange is an option to set X-Oss-Copy-Source header

func CopySourceVersion

func CopySourceVersion(sourceBucket, sourceObject string, versionId string) Option

CopySourceVersion is an option to set X-Oss-Copy-Source header,include versionId

func DeleteObjectsQuiet

func DeleteObjectsQuiet(isQuiet bool) Option

DeleteObjectsQuiet false:DeleteObjects in verbose mode; true:DeleteObjects in quite mode. Default is false.

func DeleteOption

func DeleteOption(options []Option, strKey string) []Option

func Delimiter

func Delimiter(value string) Option

Delimiter is an option to set delimiler parameter

func EncodingType

func EncodingType(value string) Option

EncodingType is an option to set encoding-type parameter

func Expires

func Expires(t time.Time) Option

Expires is an option to set Expires header

func ForbidOverWrite

func ForbidOverWrite(forbidWrite bool) Option

ForbidOverWrite is an option to set X-Oss-Forbid-Overwrite

func GetResponseHeader

func GetResponseHeader(respHeader *http.Header) Option

GetResponseHeader for get response http header

func IfMatch

func IfMatch(value string) Option

IfMatch is an option to set If-Match header

func IfModifiedSince

func IfModifiedSince(t time.Time) Option

IfModifiedSince is an option to set If-Modified-Since header

func IfNoneMatch

func IfNoneMatch(value string) Option

IfNoneMatch is an option to set IfNoneMatch header

func IfUnmodifiedSince

func IfUnmodifiedSince(t time.Time) Option

IfUnmodifiedSince is an option to set If-Unmodified-Since header

func InitCRC

func InitCRC(initCRC uint64) Option

InitCRC Init AppendObject CRC

func KeyMarker

func KeyMarker(value string) Option

KeyMarker is an option to set key-marker parameter

func Marker

func Marker(value string) Option

Marker is an option to set marker parameter

func MaxKeys

func MaxKeys(value int) Option

MaxKeys is an option to set maxkeys parameter

func MaxParts

func MaxParts(value int) Option

MaxParts is an option to set max-parts parameter

func MaxUploads

func MaxUploads(value int) Option

MaxUploads is an option to set max-uploads parameter

func Meta

func Meta(key, value string) Option

Meta is an option to set Meta header

func MetadataDirective

func MetadataDirective(directive MetadataDirectiveType) Option

MetadataDirective is an option to set X-Oss-Metadata-Directive header

func NormalizedRange

func NormalizedRange(nr string) Option

NormalizedRange is an option to set Range header, such as 1024-2048 or 1024- or -2048

func ObjectACL

func ObjectACL(acl ACLType) Option

ObjectACL is an option to set X-Oss-Object-Acl header

func ObjectStorageClass

func ObjectStorageClass(storageClass StorageClassType) Option

ObjectStorageClass is an option to set the storage class of object

func Origin

func Origin(value string) Option

Origin is an option to set Origin header

func PartNumberMarker

func PartNumberMarker(value int) Option

PartNumberMarker is an option to set part-number-marker parameter

func Prefix

func Prefix(value string) Option

Prefix is an option to set prefix parameter

func Process

func Process(value string) Option

Process is an option to set x-oss-process param

func Progress

func Progress(listener ProgressListener) Option

Progress set progress listener

func Range

func Range(start, end int64) Option

Range is an option to set Range header, [start, end]

func RangeBehavior

func RangeBehavior(value string) Option

RangeBehavior is an option to set Range value, such as "standard"

func RedundancyType

func RedundancyType(value DataRedundancyType) Option

RedundancyType bucket data redundancy type

func RequestPayer

func RequestPayer(payerType PayerType) Option

RequestPayer is an option to set payer who pay for the request

func RequestPayerParam

func RequestPayerParam(payerType PayerType) Option

RequestPayerParam is an option to set payer who pay for the request

func ResponseCacheControl

func ResponseCacheControl(value string) Option

ResponseCacheControl is an option to set response-cache-control param

func ResponseContentDisposition

func ResponseContentDisposition(value string) Option

ResponseContentDisposition is an option to set response-content-disposition param

func ResponseContentEncoding

func ResponseContentEncoding(value string) Option

ResponseContentEncoding is an option to set response-content-encoding param

func ResponseContentLanguage

func ResponseContentLanguage(value string) Option

ResponseContentLanguage is an option to set response-content-language param

func ResponseContentType

func ResponseContentType(value string) Option

ResponseContentType is an option to set response-content-type param

func ResponseExpires

func ResponseExpires(value string) Option

ResponseExpires is an option to set response-expires param

func Routines

func Routines(n int) Option

Routines DownloadFile/UploadFile routine count

func SSECAlgorithm

func SSECAlgorithm(value string) Option

SSECAlgorithm is an option to set X-Oss-Server-Side-Encryption-Customer-Algorithm header

func SSECKey

func SSECKey(value string) Option

SSECKey is an option to set X-Oss-Server-Side-Encryption-Customer-Key header

func SSECKeyMd5

func SSECKeyMd5(value string) Option

SSECKeyMd5 is an option to set X-Oss-Server-Side-Encryption-Customer-Key-Md5 header

func Sequential

func Sequential() Option

Sequential is an option to set sequential parameter for InitiateMultipartUpload

func ServerSideDataEncryption

func ServerSideDataEncryption(value string) Option

ServerSideDataEncryption is an option to set X-Oss-Server-Side-Data-Encryption header

func ServerSideEncryption

func ServerSideEncryption(value string) Option

ServerSideEncryption is an option to set X-Oss-Server-Side-Encryption header

func ServerSideEncryptionKeyID

func ServerSideEncryptionKeyID(value string) Option

ServerSideEncryptionKeyID is an option to set X-Oss-Server-Side-Encryption-Key-Id header

func SetHeader

func SetHeader(key string, value interface{}) Option

SetHeader Allow users to set personalized http headers

func SetTagging

func SetTagging(tagging Tagging) Option

SetTagging is an option to set object tagging

func StorageClass

func StorageClass(value StorageClassType) Option

StorageClass bucket storage class

func TagKey

func TagKey(value string) Option

TagKey is an option to set tag key parameter

func TagValue

func TagValue(value string) Option

TagValue is an option to set tag value parameter

func TaggingDirective

func TaggingDirective(directive TaggingDirectiveType) Option

TaggingDirective is an option to set X-Oss-Metadata-Directive header

func TrafficLimitHeader

func TrafficLimitHeader(value int64) Option

TrafficLimitHeader is an option to set X-Oss-Traffic-Limit

func TrafficLimitParam

func TrafficLimitParam(value int64) Option

TrafficLimitParam is a option to set x-oss-traffic-limit

func UploadIDMarker

func UploadIDMarker(value string) Option

UploadIDMarker is an option to set upload-id-marker parameter

func UserAgentHeader

func UserAgentHeader(ua string) Option

UserAgentHeader is an option to set HTTPHeaderUserAgent

func VersionId

func VersionId(value string) Option

VersionId is an option to set versionId parameter

func VersionIdMarker

func VersionIdMarker(value string) Option

VersionIdMarker is an option to set version-id-marker parameter

type OptionalFields

type OptionalFields struct {
	XMLName xml.Name `xml:"OptionalFields,omitempty`
	Field   []string `xml:"Field,omitempty`
}

type OssLimiter

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

OssLimiter wrapper rate.Limiter

func GetOssLimiter

func GetOssLimiter(uploadSpeed int) (ossLimiter *OssLimiter, err error)

GetOssLimiter create OssLimiter uploadSpeed KB/s

type OutputSerializationSelect

type OutputSerializationSelect struct {
	XMLName          xml.Name         `xml:"OutputSerialization"`
	CsvBodyOutput    CSVSelectOutput  `xml:CSV,omitempty`
	JsonBodyOutput   JSONSelectOutput `xml:JSON,omitempty`
	OutputRawData    *bool            `xml:"OutputRawData,omitempty"`
	KeepAllColumns   *bool            `xml:"KeepAllColumns,omitempty"`
	EnablePayloadCrc *bool            `xml:"EnablePayloadCrc,omitempty"`
	OutputHeader     *bool            `xml:"OutputHeader,omitempty"`
}

type Owner

type Owner struct {
	XMLName     xml.Name `xml:"Owner"`
	ID          string   `xml:"ID"`          // Owner ID
	DisplayName string   `xml:"DisplayName"` // Owner's display name
}

Owner defines Bucket/Object's owner

type PayerType

type PayerType string

PayerType the type of request payer

const (
	// Requester the requester who send the request
	Requester PayerType = "Requester"

	// BucketOwner the requester who send the request
	BucketOwner PayerType = "BucketOwner"
)

type PostSelectResult

type PostSelectResult struct {
	Response *SelectObjectResponse
}

PostSelectResult is the request of SelectObject

type ProcessObjectResult

type ProcessObjectResult struct {
	Bucket   string `json:"bucket"`
	FileSize int    `json:"fileSize"`
	Object   string `json:"object"`
	Status   string `json:"status"`
}

ProcessObjectResult defines result object of ProcessObject

type ProgressEvent

type ProgressEvent struct {
	ConsumedBytes int64
	TotalBytes    int64
	RwBytes       int64
	EventType     ProgressEventType
}

ProgressEvent defines progress event

type ProgressEventType

type ProgressEventType int

ProgressEventType defines transfer progress event type

const (
	// TransferStartedEvent transfer started, set TotalBytes
	TransferStartedEvent ProgressEventType = 1 + iota
	// TransferDataEvent transfer data, set ConsumedBytes anmd TotalBytes
	TransferDataEvent
	// TransferCompletedEvent transfer completed
	TransferCompletedEvent
	// TransferFailedEvent transfer encounters an error
	TransferFailedEvent
)

type ProgressListener

type ProgressListener interface {
	ProgressChanged(event *ProgressEvent)
}

ProgressListener listens progress change

func GetProgressListener

func GetProgressListener(options []Option) ProgressListener

GetProgressListener gets the progress callback

type PutObjectRequest

type PutObjectRequest struct {
	ObjectKey string
	Reader    io.Reader
}

PutObjectRequest is the request of DoPutObject

type ReadFlagInfo

type ReadFlagInfo struct {
	OpenLine            bool
	ConsumedBytesLength int32
	EnablePayloadCrc    bool
	OutputRawData       bool
}

ReadFlagInfo if reading the frame data, recode the reading status

type Redirect

type Redirect struct {
	XMLName               xml.Name      `xml:"Redirect"`
	RedirectType          string        `xml:"RedirectType,omitempty"`         // The redirect type, it have Mirror,External,Internal,AliCDN
	PassQueryString       *bool         `xml:"PassQueryString"`                // Whether to send the specified request's parameters, true or false
	MirrorURL             string        `xml:"MirrorURL,omitempty"`            // Mirror of the website address back to the source.
	MirrorPassQueryString *bool         `xml:"MirrorPassQueryString"`          // To Mirror of the website Whether to send the specified request's parameters, true or false
	MirrorFollowRedirect  *bool         `xml:"MirrorFollowRedirect"`           // Redirect the location, if the mirror return 3XX
	MirrorCheckMd5        *bool         `xml:"MirrorCheckMd5"`                 // Check the mirror is MD5.
	MirrorHeaders         MirrorHeaders `xml:"MirrorHeaders,omitempty"`        // Mirror headers
	Protocol              string        `xml:"Protocol,omitempty"`             // The redirect Protocol
	HostName              string        `xml:"HostName,omitempty"`             // The redirect HostName
	ReplaceKeyPrefixWith  string        `xml:"ReplaceKeyPrefixWith,omitempty"` // object name'Prefix replace the value
	HttpRedirectCode      int           `xml:"HttpRedirectCode,omitempty"`     // THe redirect http code
	ReplaceKeyWith        string        `xml:"ReplaceKeyWith,omitempty"`       // object name replace the value
}

Redirect defines redirect in the RoutingRule

type RefererXML

type RefererXML struct {
	XMLName           xml.Name `xml:"RefererConfiguration"`
	AllowEmptyReferer bool     `xml:"AllowEmptyReferer"`   // Allow empty referrer
	RefererList       []string `xml:"RefererList>Referer"` // Referer whitelist
}

RefererXML defines Referer configuration

type RequestPaymentConfiguration

type RequestPaymentConfiguration struct {
	XMLName xml.Name `xml:"RequestPaymentConfiguration"`
	Payer   string   `xml:"Payer,omitempty"`
}

RequestPaymentConfiguration define the request payment configuration

type Response

type Response struct {
	StatusCode int
	Headers    http.Header
	Body       io.ReadCloser
	ClientCRC  uint64
	ServerCRC  uint64
}

Response defines HTTP response from OSS

func (*Response) Close

func (r *Response) Close() error

Close close http reponse body

func (*Response) Read

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

type RestoreConfiguration

type RestoreConfiguration struct {
	XMLName xml.Name `xml:"RestoreRequest"`
	Days    int32    `xml:"Days,omitempty"`
	Tier    string   `xml:"JobParameters>Tier,omitempty"`
}

RestoreConfiguration for RestoreObject

type RestoreMode

type RestoreMode string

RestoreMode the restore mode for coldArchive object

const (
	//RestoreExpedited object will be restored in 1 hour
	RestoreExpedited RestoreMode = "Expedited"

	//RestoreStandard object will be restored in 2-5 hours
	RestoreStandard RestoreMode = "Standard"

	//RestoreBulk object will be restored in 5-10 hours
	RestoreBulk RestoreMode = "Bulk"
)

type RoutingRule

type RoutingRule struct {
	XMLName    xml.Name  `xml:"RoutingRule"`
	RuleNumber int       `xml:"RuleNumber,omitempty"` // The routing number
	Condition  Condition `xml:"Condition,omitempty"`  // The routing condition
	Redirect   Redirect  `xml:"Redirect,omitempty"`   // The routing redirect

}

RoutingRule defines the routing rules

type SSEDefaultRule

type SSEDefaultRule struct {
	XMLName           xml.Name `xml:"ApplyServerSideEncryptionByDefault"`
	SSEAlgorithm      string   `xml:"SSEAlgorithm,omitempty"`
	KMSMasterKeyID    string   `xml:"KMSMasterKeyID,omitempty"`
	KMSDataEncryption string   `xml:"KMSDataEncryption,,omitempty"`
}

Server Encryption deafult rule for the bucket

type SSERule

type SSERule struct {
	XMLName           xml.Name `xml:"ServerSideEncryptionRule"`    // Bucket ServerSideEncryptionRule
	KMSMasterKeyID    string   `xml:"KMSMasterKeyID,omitempty"`    // Bucket KMSMasterKeyID
	SSEAlgorithm      string   `xml:"SSEAlgorithm,omitempty"`      // Bucket SSEAlgorithm
	KMSDataEncryption string   `xml:"KMSDataEncryption,omitempty"` //Bucket KMSDataEncryption
}

type SelectObjectResponse

type SelectObjectResponse struct {
	StatusCode          int
	Headers             http.Header
	Body                io.ReadCloser
	Frame               SelectObjectResult
	ReadTimeOut         uint
	ClientCRC32         uint32
	ServerCRC32         uint32
	WriterForCheckCrc32 hash.Hash32
	Finish              bool
}

SelectObjectResponse defines HTTP response from OSS SelectObject

func (*SelectObjectResponse) Close

func (sr *SelectObjectResponse) Close() error

Close http reponse body

func (*SelectObjectResponse) Read

func (sr *SelectObjectResponse) Read(p []byte) (n int, err error)

type SelectObjectResult

type SelectObjectResult struct {
	Version          byte
	FrameType        int32
	PayloadLength    int32
	HeaderCheckSum   uint32
	Offset           uint64
	Data             string           // DataFrame
	EndFrame         EndFrame         // EndFrame
	MetaEndFrameCSV  MetaEndFrameCSV  // MetaEndFrameCSV
	MetaEndFrameJSON MetaEndFrameJSON // MetaEndFrameJSON
	PayloadChecksum  uint32
	ReadFlagInfo
}

SelectObjectResult is the SelectObject api's return

type SelectOptions

type SelectOptions struct {
	XMLName                  xml.Name `xml:"Options"`
	SkipPartialDataRecord    *bool    `xml:"SkipPartialDataRecord,omitempty"`
	MaxSkippedRecordsAllowed string   `xml:"MaxSkippedRecordsAllowed,omitempty"`
}

CsvOptions is a element in the SelectObject api request's params

type SelectRequest

type SelectRequest struct {
	XMLName                   xml.Name                  `xml:"SelectRequest"`
	Expression                string                    `xml:"Expression"`
	InputSerializationSelect  InputSerializationSelect  `xml:"InputSerialization"`
	OutputSerializationSelect OutputSerializationSelect `xml:"OutputSerialization"`
	SelectOptions             SelectOptions             `xml:"Options,omitempty"`
}

SelectRequest is for the SelectObject request params of json file

type ServerEncryptionRule

type ServerEncryptionRule struct {
	XMLName    xml.Name       `xml:"ServerSideEncryptionRule"`
	SSEDefault SSEDefaultRule `xml:"ApplyServerSideEncryptionByDefault"`
}

Server Encryption rule for the bucket

type ServiceError

type ServiceError struct {
	XMLName    xml.Name `xml:"Error"`
	Code       string   `xml:"Code"`      // The error code returned from OSS to the caller
	Message    string   `xml:"Message"`   // The detail error message from OSS
	RequestID  string   `xml:"RequestId"` // The UUID used to uniquely identify the request
	HostID     string   `xml:"HostId"`    // The OSS server cluster's Id
	Endpoint   string   `xml:"Endpoint"`
	RawMessage string   // The raw messages from OSS
	StatusCode int      // HTTP status code
}

ServiceError contains fields of the error response from Oss Service REST API.

func (ServiceError) Error

func (e ServiceError) Error() string

Error implements interface error

type StorageClassType

type StorageClassType string

StorageClassType bucket storage type

const (
	// StorageStandard standard
	StorageStandard StorageClassType = "Standard"

	// StorageIA infrequent access
	StorageIA StorageClassType = "IA"

	// StorageArchive archive
	StorageArchive StorageClassType = "Archive"

	// StorageColdArchive cold archive
	StorageColdArchive StorageClassType = "ColdArchive"
)

type Tag

type Tag struct {
	XMLName xml.Name `xml:"Tag"`
	Key     string   `xml:"Key"`
	Value   string   `xml:"Value"`
}

Tag a tag for the object

type Tagging

type Tagging struct {
	XMLName xml.Name `xml:"Tagging"`
	Tags    []Tag    `xml:"TagSet>Tag,omitempty"`
}

Tagging tagset for the object

type TaggingDirectiveType

type TaggingDirectiveType string

TaggingDirectiveType specifying whether use the tagging of source object when copying object.

const (
	// TaggingCopy the target object's tagging is copied from the source one
	TaggingCopy TaggingDirectiveType = "COPY"

	// TaggingReplace the target object's tagging is created as part of the copy request (not same as the source one)
	TaggingReplace TaggingDirectiveType = "REPLACE"
)

type UncompletedUpload

type UncompletedUpload struct {
	XMLName   xml.Name  `xml:"Upload"`
	Key       string    `xml:"Key"`       // Object name
	UploadID  string    `xml:"UploadId"`  // The UploadId
	Initiated time.Time `xml:"Initiated"` // Initialization time in the format such as 2012-02-23T04:18:23.000Z
}

UncompletedUpload structure wraps an uncompleted upload task

type UnexpectedStatusCodeError

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

UnexpectedStatusCodeError is returned when a storage service responds with neither an error nor with an HTTP status code indicating success.

func (UnexpectedStatusCodeError) Error

Error implements interface error

func (UnexpectedStatusCodeError) Got

Got is the actual status code returned by oss.

type UnpackedRange

type UnpackedRange struct {
	HasStart bool  // Flag indicates if the start point is specified
	HasEnd   bool  // Flag indicates if the end point is specified
	Start    int64 // Start point
	End      int64 // End point
}

UnpackedRange

func GetRangeConfig

func GetRangeConfig(options []Option) (*UnpackedRange, error)

GetRangeConfig gets the download range from the options.

func ParseRange

func ParseRange(normalizedRange string) (*UnpackedRange, error)

ParseRange parse various styles of range such as bytes=M-N

type UploadPart

type UploadPart struct {
	XMLName    xml.Name `xml:"Part"`
	PartNumber int      `xml:"PartNumber"` // Part number
	ETag       string   `xml:"ETag"`       // ETag value of the part's data
}

UploadPart defines the upload/copy part

type UploadPartCopyResult

type UploadPartCopyResult struct {
	XMLName      xml.Name  `xml:"CopyPartResult"`
	LastModified time.Time `xml:"LastModified"` // Last modified time
	ETag         string    `xml:"ETag"`         // ETag
}

UploadPartCopyResult defines result object of multipart copy request.

type UploadPartRequest

type UploadPartRequest struct {
	InitResult *InitiateMultipartUploadResult
	Reader     io.Reader
	PartSize   int64
	PartNumber int
}

UploadPartRequest is the request of DoUploadPart

type UploadPartResult

type UploadPartResult struct {
	Part UploadPart
}

UploadPartResult is the result of DoUploadPart

type UploadParts

type UploadParts []UploadPart

func (UploadParts) Len

func (slice UploadParts) Len() int

func (UploadParts) Less

func (slice UploadParts) Less(i, j int) bool

func (UploadParts) Swap

func (slice UploadParts) Swap(i, j int)

type UploadedPart

type UploadedPart struct {
	XMLName      xml.Name  `xml:"Part"`
	PartNumber   int       `xml:"PartNumber"`   // Part number
	LastModified time.Time `xml:"LastModified"` // Last modified time
	ETag         string    `xml:"ETag"`         // ETag cache
	Size         int       `xml:"Size"`         // Part size
}

UploadedPart defines uploaded part

type UserQoSConfiguration

type UserQoSConfiguration struct {
	XMLName xml.Name `xml:"QoSConfiguration"`
	Region  string   `xml:"Region,omitempty"` // Effective area of Qos configuration
	BucketQoSConfiguration
}

UserQoSConfiguration define QoS and Range configuration

type VersioningConfig

type VersioningConfig struct {
	XMLName xml.Name `xml:"VersioningConfiguration"`
	Status  string   `xml:"Status"`
}

VersioningConfig for the bucket

type VersioningStatus

type VersioningStatus string

bucket versioning status

const (
	// Versioning Status definition: Enabled
	VersionEnabled VersioningStatus = "Enabled"

	// Versioning Status definition: Suspended
	VersionSuspended VersioningStatus = "Suspended"
)

type WebsiteXML

type WebsiteXML struct {
	XMLName       xml.Name      `xml:"WebsiteConfiguration"`
	IndexDocument IndexDocument `xml:"IndexDocument,omitempty"`            // The index page
	ErrorDocument ErrorDocument `xml:"ErrorDocument,omitempty"`            // The error page
	RoutingRules  []RoutingRule `xml:"RoutingRules>RoutingRule,omitempty"` // The routing Rule list
}

WebsiteXML defines Website configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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