Documentation ¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func Duration(v time.Duration) *time.Duration
- func Int(v int) *int
- func Int64(v int64) *int64
- func String(v string) *string
- func StringMap(vs map[string]string) map[string]*string
- func StringSlice(vs []string) []*string
- func Time(v time.Time) *time.Time
- func Version() string
- type ACLType
- type AlgorithmType
- type AuthVersionType
- type BucketProperties
- type CanceledError
- type Client
- func (c *Client) GetObject(ctx context.Context, request *GetObjectRequest, optFns ...func(*Options)) (result *GetObjectResult, err error)
- func (c *Client) InvokeOperation(ctx context.Context, input *OperationInput, optFns ...func(*Options)) (output *OperationOutput, err error)
- func (c *Client) ListBuckets(ctx context.Context, request *ListBucketsRequest, optFns ...func(*Options)) (result *ListBucketsResult, err error)
- func (c *Client) ListObjects(ctx context.Context, request *ListObjectsRequest, optFns ...func(*Options)) (result *ListObjectsResult, err error)
- func (c *Client) MarshalInput(request interface{}, input *OperationInput) error
- type ClientError
- type CommonPrefix
- type Config
- func (c Config) Copy() Config
- func (c *Config) WithCredentialsProvider(provider credentials.CredentialsProvider) *Config
- func (c *Config) WithEndpoint(endpoint string) *Config
- func (c *Config) WithHTTPClient(client *http.Client) *Config
- func (c *Config) WithRegion(region string) *Config
- func (c *Config) WithRetryMaxAttempts(value int) *Config
- func (c *Config) WithRetryer(retryer retry.Retryer) *Config
- func (c *Config) WithUsePathStyle(enable bool) *Config
- type DataRedundancyType
- type DeserializationError
- type GetObjectRequest
- type GetObjectResult
- type InvalidParamError
- type ListBucketsRequest
- type ListBucketsResult
- type ListObjectsRequest
- type ListObjectsResult
- type MetadataDirectiveType
- type ObjectProperties
- type OperationError
- type OperationInput
- type OperationMetadata
- type OperationOutput
- type Options
- type Owner
- type ParamRequiredError
- type PayerType
- type RequestCommon
- type RestoreMode
- type ResultCommon
- type SerializationError
- type ServiceError
- type StorageClassType
- type TaggingDirectiveType
- type UrlRequestStyle
- type VersioningStatus
Constants ¶
View Source
const ( DefaultConnectTimeout = 5 * time.Second DefaultReadWriteTimeout = 10 * time.Second DefaultIdleConnectionTimeout = 50 * time.Second DefaultMaxConnections = 100 )
View Source
const ( HeaderOssPrefix string = "X-Oss-" HeaderOssMetaPrefix = "X-Oss-Meta-" HeaderOssACL = "X-Oss-Acl" HeaderOssObjectACL = "X-Oss-Object-Acl" HeaderOssSecurityToken = "X-Oss-Security-Token" HeaderOssServerSideEncryption = "X-Oss-Server-Side-Encryption" HeaderOssServerSideEncryptionKeyID = "X-Oss-Server-Side-Encryption-Key-Id" HeaderOssServerSideDataEncryption = "X-Oss-Server-Side-Data-Encryption" HeaderOssSSECAlgorithm = "X-Oss-Server-Side-Encryption-Customer-Algorithm" HeaderOssSSECKey = "X-Oss-Server-Side-Encryption-Customer-Key" HeaderOssSSECKeyMd5 = "X-Oss-Server-Side-Encryption-Customer-Key-MD5" HeaderOssCopySource = "X-Oss-Copy-Source" HeaderOssCopySourceRange = "X-Oss-Copy-Source-Range" HeaderOssCopySourceIfMatch = "X-Oss-Copy-Source-If-Match" HeaderOssCopySourceIfNoneMatch = "X-Oss-Copy-Source-If-None-Match" HeaderOssCopySourceIfModifiedSince = "X-Oss-Copy-Source-If-Modified-Since" HeaderOssCopySourceIfUnmodifiedSince = "X-Oss-Copy-Source-If-Unmodified-Since" HeaderOssMetadataDirective = "X-Oss-Metadata-Directive" HeaderOssNextAppendPosition = "X-Oss-Next-Append-Position" HeaderOssRequestID = "X-Oss-Request-Id" HeaderOssCRC64 = "X-Oss-Hash-Crc64ecma" HeaderOssSymlinkTarget = "X-Oss-Symlink-Target" HeaderOssStorageClass = "X-Oss-Storage-Class" HeaderOssCallback = "X-Oss-Callback" HeaderOssCallbackVar = "X-Oss-Callback-Var" HeaderOssRequester = "X-Oss-Request-Payer" HeaderOssTagging = "X-Oss-Tagging" HeaderOssTaggingDirective = "X-Oss-Tagging-Directive" HeaderOssTrafficLimit = "X-Oss-Traffic-Limit" HeaderOssForbidOverWrite = "X-Oss-Forbid-Overwrite" HeaderOssRangeBehavior = "X-Oss-Range-Behavior" HeaderOssAllowSameActionOverLap = "X-Oss-Allow-Same-Action-Overlap" HeaderOssDate = "X-Oss-Date" HeaderOssContentSha256 = "X-Oss-Content-Sha256" HeaderOssEC = "X-Oss-Ec" HeaderOssERR = "X-Oss-Err" )
OSS headers
View Source
const (
SdkName = "aliyun-oss-go-sdk"
)
Variables ¶
This section is empty.
Functions ¶
func StringSlice ¶
StringSlice returns a slice of string pointers from the values.
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 AuthVersionType ¶
type AuthVersionType string
AuthVersion the version of auth
const ( // AuthV1 v1 AuthV1 AuthVersionType = "v1" // AuthV2 v2 AuthV2 AuthVersionType = "v2" // AuthV4 v4 AuthV4 AuthVersionType = "v4" )
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 Region string `xml:"Region"` // Bucket storage class ExtranetEndpoint string `xml:"ExtranetEndpoint"` // Bucket name IntranetEndpoint string `xml:"IntranetEndpoint"` // Bucket name }
type CanceledError ¶
type CanceledError struct {
Err error
}
func (*CanceledError) CanceledError ¶
func (*CanceledError) CanceledError() bool
func (*CanceledError) Error ¶
func (e *CanceledError) Error() string
func (*CanceledError) Unwrap ¶
func (e *CanceledError) Unwrap() error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetObject ¶
func (c *Client) GetObject(ctx context.Context, request *GetObjectRequest, optFns ...func(*Options)) (result *GetObjectResult, err error)
func (*Client) InvokeOperation ¶
func (c *Client) InvokeOperation(ctx context.Context, input *OperationInput, optFns ...func(*Options)) (output *OperationOutput, err error)
func (*Client) ListBuckets ¶
func (c *Client) ListBuckets(ctx context.Context, request *ListBucketsRequest, optFns ...func(*Options)) (result *ListBucketsResult, err error)
func (*Client) ListObjects ¶
func (c *Client) ListObjects(ctx context.Context, request *ListObjectsRequest, optFns ...func(*Options)) (result *ListObjectsResult, err error)
func (*Client) MarshalInput ¶
func (c *Client) MarshalInput(request interface{}, input *OperationInput) error
type ClientError ¶
func (*ClientError) Error ¶
func (e *ClientError) Error() string
func (*ClientError) Unwrap ¶
func (e *ClientError) Unwrap() error
type CommonPrefix ¶
type CommonPrefix struct { //XMLName xml.Name `xml:"CommonPrefix"` Prefix string `xml:"Prefix"` // The prefix contained in the returned object names. }
type Config ¶
type Config struct { // The region to send requests to. Region string Endpoint string // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. RetryMaxAttempts int // Retryer guides how HTTP requests should be retried in case of recoverable failures. Retryer retry.Retryer // Allows you to enable the client to use path-style addressing, i.e., https://oss-cn-hangzhou.aliyuncs.com/bucket/key. // By default, the oss client will use virtual hosted addressing i.e., https://bucket.oss-cn-hangzhou.aliyuncs.com/key. UsePathStyle bool // The HTTP client to invoke API calls with. Defaults to client's default HTTP // implementation if nil. HTTPClient *http.Client CredentialsProvider credentials.CredentialsProvider }
func LoadDefaultConfig ¶
func LoadDefaultConfig() *Config
func (*Config) WithCredentialsProvider ¶
func (c *Config) WithCredentialsProvider(provider credentials.CredentialsProvider) *Config
func (*Config) WithEndpoint ¶
func (*Config) WithRegion ¶
func (*Config) WithRetryMaxAttempts ¶
func (*Config) WithUsePathStyle ¶
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 DeserializationError ¶
func (*DeserializationError) Error ¶
func (e *DeserializationError) Error() string
func (*DeserializationError) Unwrap ¶
func (e *DeserializationError) Unwrap() error
type GetObjectRequest ¶
type GetObjectRequest struct { RequestCommon Bucket string `input:"host,bucket,required"` // The name of the bucket containing the objects Key string `input:"path,key,required"` // The name of the object }
type GetObjectResult ¶
type GetObjectResult struct { ResultCommon Body io.ReadCloser }
type InvalidParamError ¶
type ListBucketsRequest ¶
type ListBucketsRequest struct { RequestCommon Marker string `input:"query,marker"` // Marker is where you want server to start listing from MaxKeys int32 `input:"query,max-keys"` // Sets the maximum number of keys returned in the response Prefix string `input:"query,prefix"` // Limits the response to keys that begin with the specified prefix ResourceGroupId string `input:"header,x-oss-resource-group-id"` }
type ListBucketsResult ¶
type ListBucketsResult struct { ResultCommon XMLName xml.Name `xml:"ListAllMyBucketsResult"` Prefix string `xml:"Prefix"` // The object prefix Marker string `xml:"Marker"` // The marker filter. MaxKeys int `xml:"MaxKeys"` // Max keys to return 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 Owner Owner `xml:"Owner,omitempty"` // Object owner information Buckets []BucketProperties `xml:"Buckets>Bucket"` // You can think of commonprefixes as "folders" whose names end with the delimiter }
type ListObjectsRequest ¶
type ListObjectsRequest struct { RequestCommon Bucket string `input:"host,bucket,required"` // The name of the bucket containing the objects Delimiter string `input:"query,delimiter"` // A delimiter is a character that you use to group keys EncodingType string `input:"query,encoding-type"` // Requests Server to encode the object keys in the respons Marker string `input:"query,marker"` // Marker is where you want server to start listing from MaxKeys int32 `input:"query,max-keys"` // Sets the maximum number of keys returned in the response Prefix string `input:"query,prefix"` // Limits the response to keys that begin with the specified prefix }
type ListObjectsResult ¶
type ListObjectsResult struct { ResultCommon XMLName xml.Name `xml:"ListBucketResult"` Name string `xml:"Name"` // The bucket name 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 EncodingType string `xml:"EncodingType"` // The encoding type of the content in the response Contents []ObjectProperties `xml:"Contents"` // Metadata about each object CommonPrefixes []CommonPrefix `xml:"CommonPrefixes"` // You can think of commonprefixes as "folders" whose names end with the delimiter }
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 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,omitempty"` // Object owner information LastModified time.Time `xml:"LastModified"` // Object last modified time StorageClass string `xml:"StorageClass"` // Object storage class (Standard, IA, Archive) RestoreInfo string `xml:"RestoreInfo,omitempty"` // Object restoreInfo }
type OperationError ¶
func (*OperationError) Error ¶
func (e *OperationError) Error() string
func (*OperationError) Operation ¶
func (e *OperationError) Operation() string
func (*OperationError) Unwrap ¶
func (e *OperationError) Unwrap() error
type OperationInput ¶
type OperationMetadata ¶
type OperationMetadata struct {
// contains filtered or unexported fields
}
func (OperationMetadata) Clone ¶
func (m OperationMetadata) Clone() OperationMetadata
func (OperationMetadata) Get ¶
func (m OperationMetadata) Get(key interface{}) interface{}
func (OperationMetadata) Has ¶
func (m OperationMetadata) Has(key interface{}) bool
func (*OperationMetadata) Set ¶
func (m *OperationMetadata) Set(key, value interface{})
type OperationOutput ¶
type OperationOutput struct { Input *OperationInput Status string StatusCode int Headers http.Header Body io.ReadCloser Metadata OperationMetadata }
type Options ¶
type ParamRequiredError ¶
type ParamRequiredError struct {
// contains filtered or unexported fields
}
func NewErrParamInvalid ¶
func NewErrParamInvalid(field string) *ParamRequiredError
func NewErrParamRequired ¶
func NewErrParamRequired(field string) *ParamRequiredError
func (*ParamRequiredError) SetContext ¶
func (e *ParamRequiredError) SetContext(ctx string)
type RequestCommon ¶
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 ResultCommon ¶
type ResultCommon struct { Status string StatusCode int Headers http.Header Metadata OperationMetadata }
type SerializationError ¶
type SerializationError struct {
Err error
}
func (*SerializationError) Error ¶
func (e *SerializationError) Error() string
func (*SerializationError) Unwrap ¶
func (e *SerializationError) Unwrap() error
type ServiceError ¶
type ServiceError struct { XMLName xml.Name `xml:"Error"` Code string `xml:"Code"` Message string `xml:"Message"` RequestID string `xml:"RequestId"` EC string `xml:"EC"` StatusCode int Snapshot []byte Timestamp time.Time RequestTarget string }
func (*ServiceError) Error ¶
func (e *ServiceError) Error() string
func (*ServiceError) HttpStatusCode ¶
func (e *ServiceError) HttpStatusCode() int
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" // StorageDeepColdArchive deep cold archive StorageDeepColdArchive StorageClassType = "DeepColdArchive" )
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 UrlRequestStyle ¶
type UrlRequestStyle int
const ( VirtualHostedStyle UrlRequestStyle = iota PathStyle CNameStyle )
func (UrlRequestStyle) String ¶
func (f UrlRequestStyle) String() string
type VersioningStatus ¶
type VersioningStatus string
bucket versioning status
const ( // Versioning Status definition: Enabled VersionEnabled VersioningStatus = "Enabled" // Versioning Status definition: Suspended VersionSuspended VersioningStatus = "Suspended" )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.