Documentation ¶
Overview ¶
Package fds 是小米云对象存储服务FDS的go语言客户端。
sdk通过封装原始的JSON Restful API,来实现方便地调用。
更多的使用方法,可以通过源码中的fds_test.go文件学到。
Usage:
package main import ( "log" "os" "github.com/XiaoMi/go-fds/fds" "github.com/XiaoMi/go-fds/fds/manager" ) func main() { conf, _ := fds.NewClientConfiguration(os.Getenv("GO_FDS_TEST_ENDPOINT")) client := fds.New(os.Getenv("GO_FDS_TEST_ACCESS_KEY_ID"), os.Getenv("GO_FDS_TEST_ACCESS_KEY_SECRET"), conf) downloader := manager.NewDownloader(client, 1024*1024, 10, true) request := &manager.DownloadRequest{ GetObjectRequest: fds.GetObjectRequest{ BucketName: "hellodf", ObjectName: "build.log", }, FilePath: "/home/XiaoMi/tmp/build.log", } err := downloader.Download(request) if err != nil { log.Fatalln(err) } else { log.Println("Done") } }
Index ¶
- Constants
- Variables
- type AccessControlList
- type AccessLog
- type Client
- func (client *Client) AbortMultipartUpload(request *InitMultipartUploadResponse) error
- func (client *Client) AbortMultipartUploadWithContext(ctx context.Context, request *InitMultipartUploadResponse) error
- func (client *Client) CompleteMultipartUpload(request *InitMultipartUploadResponse, list *UploadPartList) (*PutObjectResponse, error)
- func (client *Client) CompleteMultipartUploadV2(request *CompleteMultipartUploadRequest) (*PutObjectResponse, error)
- func (client *Client) CompleteMultipartUploadWithContext(ctx context.Context, request *CompleteMultipartUploadRequest) (*PutObjectResponse, error)
- func (client *Client) CopyObject(request *CopyObjectRequest) error
- func (client *Client) CopyObjectWithContext(ctx context.Context, request *CopyObjectRequest) error
- func (client *Client) CreateBucket(request *CreateBucketRequest) error
- func (client *Client) CreateBucketWithContext(ctx context.Context, request *CreateBucketRequest) error
- func (client *Client) DeleteBucket(bucketName string) error
- func (client *Client) DeleteBucketWithContext(ctx context.Context, bucketName string) error
- func (client *Client) DeleteObject(bucketName, objectName string) error
- func (client *Client) DeleteObjectWithContext(ctx context.Context, bucketName, objectName string) error
- func (client *Client) DeleteObjects(bucketName string, objectNames []string, put2trash bool) error
- func (client *Client) DeleteObjectsWithContext(ctx context.Context, bucketName string, objectNames []string, put2trash bool) error
- func (client *Client) DeleteObjectsWithPrefix(bucketName, prefix string, put2stash bool) error
- func (client *Client) DeleteObjectsWithPrefixWithContext(ctx context.Context, bucketName, prefix string, put2stash bool) error
- func (client *Client) DoesBucketExist(bucketName string) (bool, error)
- func (client *Client) DoesBucketExitsWithContext(ctx context.Context, bucketName string) (bool, error)
- func (client *Client) DoesObjectExist(bucketName, objectName string) (bool, error)
- func (client *Client) DoesObjectExistWithContext(ctx context.Context, bucketName, objectName string) (bool, error)
- func (client *Client) GenerateAbsoluteObjectURL(bucketName, objectName string) *url.URL
- func (client *Client) GeneratePresignedURL(request *GeneratePresignedURLRequest) (*url.URL, error)
- func (client *Client) GetAccessLog(bucketName string) (*AccessLog, error)
- func (client *Client) GetAccessLogWithContext(ctx context.Context, bucketName string) (*AccessLog, error)
- func (client *Client) GetBucketACL(bucketName string) (*AccessControlList, error)
- func (client *Client) GetBucketACLWithContext(ctx context.Context, bucketName string) (*AccessControlList, error)
- func (client *Client) GetBucketInfo(bucketName string) (*GetBucketInfoResponse, error)
- func (client *Client) GetBucketInfoWithContext(ctx context.Context, bucketName string) (*GetBucketInfoResponse, error)
- func (client *Client) GetLifecycleConfig(request *GetLifecycleConfigRequest) (*LifecycleConfig, error)
- func (client *Client) GetLifecycleConfigWithContext(ctx context.Context, request *GetLifecycleConfigRequest) (*LifecycleConfig, error)
- func (client *Client) GetObject(request *GetObjectRequest) (io.ReadCloser, error)
- func (client *Client) GetObjectACL(request *GetObjectACLRequest) (*AccessControlList, error)
- func (client *Client) GetObjectACLWithContext(ctx context.Context, request *GetObjectACLRequest) (*AccessControlList, error)
- func (client *Client) GetObjectMetadata(bucketName, objectName string) (*ObjectMetadata, error)
- func (client *Client) GetObjectMetadataWithContext(ctx context.Context, bucketName, objectName string) (*ObjectMetadata, error)
- func (client *Client) GetObjectWithContext(ctx context.Context, request *GetObjectRequest) (io.ReadCloser, error)
- func (client *Client) InitMultipartUpload(request *InitMultipartUploadRequest) (*InitMultipartUploadResponse, error)
- func (client *Client) InitMultipartUploadWithContext(ctx context.Context, request *InitMultipartUploadRequest) (*InitMultipartUploadResponse, error)
- func (client *Client) ListAuthorizedBuckets() (*ListBucketsResponse, error)
- func (client *Client) ListAuthorizedBucketsWithContext(ctx context.Context) (*ListBucketsResponse, error)
- func (client *Client) ListBuckets() (*ListBucketsResponse, error)
- func (client *Client) ListBucketsWithContext(ctx context.Context) (*ListBucketsResponse, error)
- func (client *Client) ListObjects(request *ListObjectsRequest) (*ObjectListing, error)
- func (client *Client) ListObjectsNextBatch(previous *ObjectListing) (*ObjectListing, error)
- func (client *Client) ListObjectsNextBatchWithContext(ctx context.Context, previous *ObjectListing) (*ObjectListing, error)
- func (client *Client) ListObjectsWithContext(ctx context.Context, request *ListObjectsRequest) (*ObjectListing, error)
- func (client *Client) MigrateBucket(request *MigrateBucketRequest) error
- func (client *Client) MigrateBucketWithContext(ctx context.Context, request *MigrateBucketRequest) error
- func (client *Client) PutObject(request *PutObjectRequest) (*PutObjectResponse, error)
- func (client *Client) PutObjectWithContext(ctx context.Context, request *PutObjectRequest) (*PutObjectResponse, error)
- func (client *Client) RenameObject(bucketName, sourceObjectName, targetObjectName string) error
- func (client *Client) RenameObjectWithContext(ctx context.Context, bucketName, sourceObjectName, targetObjectName string) error
- func (client *Client) RestoreObject(bucketName, objectName string) error
- func (client *Client) RestoreObjectWithContext(ctx context.Context, bucketName, objectName string) error
- func (client *Client) SetAccessLog(bucketName string, accessLog *AccessLog) error
- func (client *Client) SetAccessLogWithContext(ctx context.Context, bucketName string, accessLog *AccessLog) error
- func (client *Client) SetBucketACL(bucketName string, acl *AccessControlList) error
- func (client *Client) SetBucketACLWithContext(ctx context.Context, bucketName string, acl *AccessControlList) error
- func (client *Client) SetLifecycleConfig(bucketName string, config *LifecycleConfig) error
- func (client *Client) SetLifecycleConfigWithContext(ctx context.Context, bucketName string, config *LifecycleConfig) error
- func (client *Client) SetLifecycleRule(bucketName string, rule *LifecycleRule) error
- func (client *Client) SetLifecycleRuleWithContext(ctx context.Context, bucketName string, rule *LifecycleRule) error
- func (client *Client) SetObjectACL(request *SetObjectACLRequest) error
- func (client *Client) SetObjectACLWithContext(ctx context.Context, request *SetObjectACLRequest) error
- func (client *Client) SetObjectMetadata(request *SetObjectMetadataRequest) error
- func (client *Client) SetObjectMetadataWithContext(ctx context.Context, request *SetObjectMetadataRequest) error
- func (client *Client) SetObjectPublic(bucketName, objectName string) error
- func (client *Client) SetObjectPublicWithContext(ctx context.Context, bucketName, objectName string) error
- func (client *Client) UploadPart(request *UploadPartRequest) (*UploadPartResponse, error)
- func (client *Client) UploadPartWithContext(ctx context.Context, request *UploadPartRequest) (*UploadPartResponse, error)
- type ClientConfiguration
- type CompleteMultipartUploadRequest
- type CopyObjectRequest
- type CreateBucketRequest
- type GeneratePresignedURLRequest
- type GetBucketInfoResponse
- type GetLifecycleConfigRequest
- type GetObjectACLRequest
- type GetObjectRequest
- type Grant
- type GrantKey
- type GrantPermission
- type GrantType
- type HTTPMethod
- type HTTPTimeout
- type InitMultipartUploadRequest
- type InitMultipartUploadResponse
- type LifecycleAction
- type LifecycleActionType
- type LifecycleBaseItem
- type LifecycleConfig
- type LifecycleRule
- type ListBucketsResponse
- type ListObjectsRequest
- type MigrateBucketRequest
- type ObjectListing
- type ObjectMetadata
- func (metadata *ObjectMetadata) Get(k string) string
- func (metadata *ObjectMetadata) GetContentLength() (int64, error)
- func (metadata *ObjectMetadata) GetContentType() string
- func (metadata *ObjectMetadata) GetRawMetadata() map[string]string
- func (metadata *ObjectMetadata) Set(k, v string) error
- func (metadata *ObjectMetadata) SetContentLength(length int64)
- func (metadata *ObjectMetadata) SetContentType(contentType string)
- type ObjectSummary
- type Owner
- type PutObjectRequest
- type PutObjectResponse
- type ServerError
- type SetObjectACLRequest
- type SetObjectMetadataRequest
- type StorageClass
- type UploadPartList
- type UploadPartRequest
- type UploadPartResponse
Constants ¶
const ( XiaomiPrefix = "x-xiaomi-" XiaomiMetaPrefix = "x-xiaomi-meta-" HTTPHeaderGalaxyAccessKeyID = "GalaxyAccessKeyId" HTTPHeaderSignature = "Signature" HTTPHeaderExpires = "Expires" HTTPHeaderCacheControl = "cache-control" HTTPHeaderContentLength = "content-length" HTTPHeaderContentEncoding = "content-encoding" HTTPHeaderLastModified = "last-modified" HTTPHeaderContentMD5 = "content-md5" HTTPHeaderContentType = "content-type" HTTPHeaderLastChecked = "last-checked" HTTPHeaderUploadTime = "upload-time" HTTPHeaderDate = "date" HTTPHeaderAuthorization = "authorization" HTTPHeaderRange = "range" HTTPHeaderContentRange = "content-range" HTTPHeaderContentMetadataLength = XiaomiMetaPrefix + HTTPHeaderContentLength HTTPHeaderServerSideEncryption = XiaomiMetaPrefix + "server-side-encryption" HTTPHeaderStorageClass = XiaomiMetaPrefix + "storage-class" HTTPHeaderOngoingRestore = XiaomiMetaPrefix + "ongoing-restore" HTTPHeaderRestoreExpireDate = XiaomiMetaPrefix + "restore-expiry" HTTPHeaderCRC64ECMA = XiaomiMetaPrefix + "hash-crc64ecma" HTTPHeaderMultipartUploadMode = XiaomiPrefix + "multipart-upload-mode" )
Headers
const ( MaxPartSize = 5 * 1024 * 1024 * 1024 // Max part size, 5GB MinPartSize = 5 * 1024 * 1024 // Min part size, 5MB FilePermMode = os.FileMode(0664) // Default file permission TempFilePrefix = "fds-go-temp-" // Temp file prefix DefaultListObjectsMaxKeys = 1000 URLComSuffix = ".fds.api.xiaomi.com" URLNetSuffix = "-fds.api.xiaomi.net" URLCDNSuffix = ".fds.api.mi-img.com" Version = "0.9.0" // Go SDK version )
Other constants
const ( ModeMultiBlob = "MULTI_BLOB" ModeDierect = "DIRECT" )
const ( DNSCacheTTLSecond = 600 * time.Second LBDialRetries = 3 MinHealthyNodeRatio = 0.5 MaxNodeFailedRatio = 0 )
Variables ¶
var (
ErrorEndpoint = errors.New("wrong endpoint")
)
Errors
Functions ¶
This section is empty.
Types ¶
type AccessControlList ¶
type AccessControlList struct { Grants []Grant `json:"accessControlList"` Owner Owner `json:"owner"` }
AccessControlList is access control list
func (*AccessControlList) AddGrant ¶
func (acl *AccessControlList) AddGrant(grant Grant)
AddGrant add a grant into ACL
type AccessLog ¶
type AccessLog struct { BucketName string `json:"bucketName"` Enabled bool `json:"enabled"` LogBucketName string `json:"logBucketName"` LogPrefix string `json:"logPrefix"` }
AccessLog is accesslog
type Client ¶
type Client struct { Configuration *ClientConfiguration AccessID string AccessSecret string // contains filtered or unexported fields }
Client supplies an interface for interaction with FDS
func New ¶
func New(accessID, accessSecret string, conf *ClientConfiguration) *Client
New a FDSClient
func (*Client) AbortMultipartUpload ¶
func (client *Client) AbortMultipartUpload(request *InitMultipartUploadResponse) error
AbortMultipartUpload aborts the progress of multipart uploading
func (*Client) AbortMultipartUploadWithContext ¶
func (client *Client) AbortMultipartUploadWithContext(ctx context.Context, request *InitMultipartUploadResponse) error
AbortMultipartUploadWithContext aborts the progress of multipart uploading with context controlling
func (*Client) CompleteMultipartUpload ¶
func (client *Client) CompleteMultipartUpload(request *InitMultipartUploadResponse, list *UploadPartList) (*PutObjectResponse, error)
CompleteMultipartUpload completes the progress of multipart uploading
func (*Client) CompleteMultipartUploadV2 ¶ added in v1.0.3
func (client *Client) CompleteMultipartUploadV2(request *CompleteMultipartUploadRequest) (*PutObjectResponse, error)
CompleteMultipartUpload completes the progress of multipart uploading
func (*Client) CompleteMultipartUploadWithContext ¶
func (client *Client) CompleteMultipartUploadWithContext(ctx context.Context, request *CompleteMultipartUploadRequest) (*PutObjectResponse, error)
CompleteMultipartUploadWithContext completes the progress of multipart uploading with context controlling
func (*Client) CopyObject ¶
func (client *Client) CopyObject(request *CopyObjectRequest) error
CopyObject copy object from a bucket to other bucket
func (*Client) CopyObjectWithContext ¶
func (client *Client) CopyObjectWithContext(ctx context.Context, request *CopyObjectRequest) error
CopyObjectWithContext copy object from a bucket to other bucket with context controlling
func (*Client) CreateBucket ¶
func (client *Client) CreateBucket(request *CreateBucketRequest) error
CreateBucket creates new bucket
func (*Client) CreateBucketWithContext ¶
func (client *Client) CreateBucketWithContext(ctx context.Context, request *CreateBucketRequest) error
CreateBucketWithContext creates new bucket with context controlling
func (*Client) DeleteBucket ¶
DeleteBucket delete a bucket
func (*Client) DeleteBucketWithContext ¶
DeleteBucketWithContext delete bucket with context controlling
func (*Client) DeleteObject ¶
DeleteObject deletes objectName in bucketName
func (*Client) DeleteObjectWithContext ¶
func (client *Client) DeleteObjectWithContext(ctx context.Context, bucketName, objectName string) error
DeleteObjectWithContext deletes object in bucket with context controlling
func (*Client) DeleteObjects ¶
DeleteObjects will delete all objects in objectNames
func (*Client) DeleteObjectsWithContext ¶
func (client *Client) DeleteObjectsWithContext(ctx context.Context, bucketName string, objectNames []string, put2trash bool) error
DeleteObjectsWithContext will delete all objects in bucket with context controlling
func (*Client) DeleteObjectsWithPrefix ¶
DeleteObjectsWithPrefix will delete all objects with prefix of prefix
func (*Client) DeleteObjectsWithPrefixWithContext ¶
func (client *Client) DeleteObjectsWithPrefixWithContext(ctx context.Context, bucketName, prefix string, put2stash bool) error
DeleteObjectsWithPrefixWithContext will delete all objects with prefix of prefix with context controlling
func (*Client) DoesBucketExist ¶
DoesBucketExist judge whether a bucket exist
func (*Client) DoesBucketExitsWithContext ¶
func (client *Client) DoesBucketExitsWithContext(ctx context.Context, bucketName string) (bool, error)
DoesBucketExitsWithContext judge whether bucket exitst with context controlling
func (*Client) DoesObjectExist ¶
DoesObjectExist judge wether object exists
func (*Client) DoesObjectExistWithContext ¶
func (client *Client) DoesObjectExistWithContext(ctx context.Context, bucketName, objectName string) (bool, error)
DoesObjectExistWithContext judge wether object exists with context controlling
func (*Client) GenerateAbsoluteObjectURL ¶
GenerateAbsoluteObjectURL generates a absoluted url
func (*Client) GeneratePresignedURL ¶
func (client *Client) GeneratePresignedURL(request *GeneratePresignedURLRequest) (*url.URL, error)
GeneratePresignedURL generates presigned url
func (*Client) GetAccessLog ¶
GetAccessLog gets access log
func (*Client) GetAccessLogWithContext ¶
func (client *Client) GetAccessLogWithContext(ctx context.Context, bucketName string) (*AccessLog, error)
GetAccessLogWithContext gets access log with context controlling
func (*Client) GetBucketACL ¶
func (client *Client) GetBucketACL(bucketName string) (*AccessControlList, error)
GetBucketACL will return AccessControlList of bucket
func (*Client) GetBucketACLWithContext ¶
func (client *Client) GetBucketACLWithContext(ctx context.Context, bucketName string) (*AccessControlList, error)
GetBucketACLWithContext will return AccessControlList of bucket with context controlling
func (*Client) GetBucketInfo ¶
func (client *Client) GetBucketInfo(bucketName string) (*GetBucketInfoResponse, error)
GetBucketInfo get information of a bucket
func (*Client) GetBucketInfoWithContext ¶
func (client *Client) GetBucketInfoWithContext(ctx context.Context, bucketName string) (*GetBucketInfoResponse, error)
GetBucketInfoWithContext get information of bucket with context controlling
func (*Client) GetLifecycleConfig ¶
func (client *Client) GetLifecycleConfig(request *GetLifecycleConfigRequest) (*LifecycleConfig, error)
GetLifecycleConfig returns LifecycleConfig of bucket
func (*Client) GetLifecycleConfigWithContext ¶
func (client *Client) GetLifecycleConfigWithContext(ctx context.Context, request *GetLifecycleConfigRequest) (*LifecycleConfig, error)
GetLifecycleConfigWithContext returns LifecycleConfig of bucket with context controlling
func (*Client) GetObject ¶
func (client *Client) GetObject(request *GetObjectRequest) (io.ReadCloser, error)
GetObject will get full content of object
func (*Client) GetObjectACL ¶
func (client *Client) GetObjectACL(request *GetObjectACLRequest) (*AccessControlList, error)
GetObjectACL will return AccessControlList of object
func (*Client) GetObjectACLWithContext ¶
func (client *Client) GetObjectACLWithContext(ctx context.Context, request *GetObjectACLRequest) (*AccessControlList, error)
GetObjectACLWithContext will return AccessControlList of object with context controlling
func (*Client) GetObjectMetadata ¶
func (client *Client) GetObjectMetadata(bucketName, objectName string) (*ObjectMetadata, error)
GetObjectMetadata gets metadata of objectName in bucketName
func (*Client) GetObjectMetadataWithContext ¶
func (client *Client) GetObjectMetadataWithContext(ctx context.Context, bucketName, objectName string) (*ObjectMetadata, error)
GetObjectMetadataWithContext gets metadata of objectName in bucketName with context controlling
func (*Client) GetObjectWithContext ¶
func (client *Client) GetObjectWithContext(ctx context.Context, request *GetObjectRequest) (io.ReadCloser, error)
GetObjectWithContext will get full content of object with context controlling
func (*Client) InitMultipartUpload ¶
func (client *Client) InitMultipartUpload(request *InitMultipartUploadRequest) (*InitMultipartUploadResponse, error)
InitMultipartUpload starts a progress of multipart uploading
func (*Client) InitMultipartUploadWithContext ¶
func (client *Client) InitMultipartUploadWithContext(ctx context.Context, request *InitMultipartUploadRequest) (*InitMultipartUploadResponse, error)
InitMultipartUploadWithContext starts a progress of multipart uploading with context controlling
func (*Client) ListAuthorizedBuckets ¶
func (client *Client) ListAuthorizedBuckets() (*ListBucketsResponse, error)
ListAuthorizedBuckets will return all buckets user could access
func (*Client) ListAuthorizedBucketsWithContext ¶
func (client *Client) ListAuthorizedBucketsWithContext(ctx context.Context) (*ListBucketsResponse, error)
ListAuthorizedBucketsWithContext will return all buckets users could access with context controlling
func (*Client) ListBuckets ¶
func (client *Client) ListBuckets() (*ListBucketsResponse, error)
ListBuckets list all buckets
func (*Client) ListBucketsWithContext ¶
func (client *Client) ListBucketsWithContext(ctx context.Context) (*ListBucketsResponse, error)
ListBucketsWithContext list all buckets with context controlling
func (*Client) ListObjects ¶
func (client *Client) ListObjects(request *ListObjectsRequest) (*ObjectListing, error)
ListObjects list all objects with Prefix and Delimiter
func (*Client) ListObjectsNextBatch ¶
func (client *Client) ListObjectsNextBatch(previous *ObjectListing) (*ObjectListing, error)
ListObjectsNextBatch list next batch of ListObjects
func (*Client) ListObjectsNextBatchWithContext ¶
func (client *Client) ListObjectsNextBatchWithContext(ctx context.Context, previous *ObjectListing) (*ObjectListing, error)
ListObjectsNextBatchWithContext list next batch of ListObjects with context controlling
func (*Client) ListObjectsWithContext ¶
func (client *Client) ListObjectsWithContext(ctx context.Context, request *ListObjectsRequest) (*ObjectListing, error)
ListObjectsWithContext list all objects with Prefix and Delimiter with context controlling
func (*Client) MigrateBucket ¶
func (client *Client) MigrateBucket(request *MigrateBucketRequest) error
MigrateBucket will change bucket's orgId and teamId
func (*Client) MigrateBucketWithContext ¶
func (client *Client) MigrateBucketWithContext(ctx context.Context, request *MigrateBucketRequest) error
MigrateBucketWithContext will change bucket's orgId and teamId with context controlling
func (*Client) PutObject ¶
func (client *Client) PutObject(request *PutObjectRequest) (*PutObjectResponse, error)
PutObject will create object
func (*Client) PutObjectWithContext ¶
func (client *Client) PutObjectWithContext(ctx context.Context, request *PutObjectRequest) (*PutObjectResponse, error)
PutObjectWithContext will create object with context controlling
func (*Client) RenameObject ¶
RenameObject renames sourceObjectName in bucketName to targetObjectName
func (*Client) RenameObjectWithContext ¶
func (client *Client) RenameObjectWithContext(ctx context.Context, bucketName, sourceObjectName, targetObjectName string) error
RenameObjectWithContext renames sourceObjectName in bucketName to targetObjectName with context controlling
func (*Client) RestoreObject ¶
RestoreObject restore object which is deleted if this object is avaliable
func (*Client) RestoreObjectWithContext ¶
func (client *Client) RestoreObjectWithContext(ctx context.Context, bucketName, objectName string) error
RestoreObjectWithContext restore object which is deleted if this object is avaliable with context controlling
func (*Client) SetAccessLog ¶
SetAccessLog sets acccess log
func (*Client) SetAccessLogWithContext ¶
func (client *Client) SetAccessLogWithContext(ctx context.Context, bucketName string, accessLog *AccessLog) error
SetAccessLogWithContext sets acccess log with context controlling
func (*Client) SetBucketACL ¶
func (client *Client) SetBucketACL(bucketName string, acl *AccessControlList) error
SetBucketACL sets AccessControlList for bucket
func (*Client) SetBucketACLWithContext ¶
func (client *Client) SetBucketACLWithContext(ctx context.Context, bucketName string, acl *AccessControlList) error
SetBucketACLWithContext sets AccessControlList for bucket with context controlling
func (*Client) SetLifecycleConfig ¶
func (client *Client) SetLifecycleConfig(bucketName string, config *LifecycleConfig) error
SetLifecycleConfig sets LifecycleConfig of bucket
func (*Client) SetLifecycleConfigWithContext ¶
func (client *Client) SetLifecycleConfigWithContext(ctx context.Context, bucketName string, config *LifecycleConfig) error
SetLifecycleConfigWithContext sets LifecycleConfig of bucket with context controlling
func (*Client) SetLifecycleRule ¶
func (client *Client) SetLifecycleRule(bucketName string, rule *LifecycleRule) error
SetLifecycleRule sets LifecycleRule of bucket
func (*Client) SetLifecycleRuleWithContext ¶
func (client *Client) SetLifecycleRuleWithContext(ctx context.Context, bucketName string, rule *LifecycleRule) error
SetLifecycleRuleWithContext sets LifecycleRule of bucket with context controlling
func (*Client) SetObjectACL ¶
func (client *Client) SetObjectACL(request *SetObjectACLRequest) error
SetObjectACL sets AccessControlList for object
func (*Client) SetObjectACLWithContext ¶
func (client *Client) SetObjectACLWithContext(ctx context.Context, request *SetObjectACLRequest) error
SetObjectACLWithContext sets AccessControlList for object with context controlling
func (*Client) SetObjectMetadata ¶
func (client *Client) SetObjectMetadata(request *SetObjectMetadataRequest) error
SetObjectMetadata sets metadata of object
func (*Client) SetObjectMetadataWithContext ¶
func (client *Client) SetObjectMetadataWithContext(ctx context.Context, request *SetObjectMetadataRequest) error
SetObjectMetadataWithContext sets metadata of object with context controlling
func (*Client) SetObjectPublic ¶
SetObjectPublic is a shortcut of setting object public
func (*Client) SetObjectPublicWithContext ¶
func (client *Client) SetObjectPublicWithContext(ctx context.Context, bucketName, objectName string) error
SetObjectPublicWithContext is a shortcut of setting object public with context controlling
func (*Client) UploadPart ¶
func (client *Client) UploadPart(request *UploadPartRequest) (*UploadPartResponse, error)
UploadPart upload part of multipart uploading
func (*Client) UploadPartWithContext ¶
func (client *Client) UploadPartWithContext(ctx context.Context, request *UploadPartRequest) (*UploadPartResponse, error)
UploadPartWithContext upload part of multipart uploading with context controlling
type ClientConfiguration ¶
type ClientConfiguration struct { Endpoint string EnableHTTPS bool EnableCDNForUpload bool EnableCDNForDownload bool EnableMd5Calculate bool Timeout uint HTTPTimeout HTTPTimeout MaxConnection uint BatchDeleteSize uint RetryCount uint RetryInterval uint PartSize uint MaxDNSRecord uint DownloadBandwidth uint64 UploadBandwidth uint64 HTTPKeepAliveTimeoutMs uint64 // contains filtered or unexported fields }
ClientConfiguration required by FDSClient initialization
func NewClientConfiguration ¶
func NewClientConfiguration(endpoint string) (*ClientConfiguration, error)
NewClientConfiguration create a usable ClientConfiguration
func (*ClientConfiguration) CDNEndpoint ¶
func (conf *ClientConfiguration) CDNEndpoint() string
CDNEndpoint is endpoint of cdn
func (*ClientConfiguration) RegionName ¶
func (conf *ClientConfiguration) RegionName() string
RegionName get region name
type CompleteMultipartUploadRequest ¶ added in v1.0.3
type CompleteMultipartUploadRequest struct { BucketName string `param:"-" header:"-"` ObjectName string `param:"-" header:"-"` UploadID string `param:"uploadId" header:"-"` UploadParts *UploadPartList `header:"-" param:"-"` Metadata *ObjectMetadata `header:"-" param:"-"` }
CompleteMultipartUploadRequest is required by CompleteMultipartUpload
type CopyObjectRequest ¶
type CopyObjectRequest struct { SourceBucketName string `param:"-" header:"-"` SourceObjectName string `param:"-" header:"-"` TargetBucketName string `param:"-" header:"-"` TargetObjectName string `param:"-" header:"-"` // contains filtered or unexported fields }
CopyObjectRequest is the input of CopyObject method
type CreateBucketRequest ¶
type CreateBucketRequest struct { BucketName string `param:"-" header:"-"` StorageClassType StorageClass `param:"storageClass,omitempty" header:"-"` OrgID string `param:"orgId,omitempty" header:"-"` }
CreateBucketRequest if request of creating bucket OrgID is option, if setted, bucket will be created under orgnization of orgid
type GeneratePresignedURLRequest ¶
type GeneratePresignedURLRequest struct { CDN bool BucketName string ObjectName string Method HTTPMethod Expiration time.Time Metadata *ObjectMetadata }
GeneratePresignedURLRequest is input of GeneratePresignedURL
type GetBucketInfoResponse ¶
type GetBucketInfoResponse struct { AllowOutsideAccess bool `json:"allowOutsideAccess"` CreationTime int64 `json:"creationTime"` BucketName string `json:"name"` ObjectNum int64 `json:"numObjects"` UsedSpace int64 `json:"usedSpace"` }
GetBucketInfoResponse is result of GetBucketInfo
type GetLifecycleConfigRequest ¶
type GetLifecycleConfigRequest struct { BucketName string `param:"-" header:"-"` RuleID string `param:"lifecycle" header:"-"` }
GetLifecycleConfigRequest is request for getting lifecycle config
type GetObjectACLRequest ¶
type GetObjectACLRequest struct { BucketName string `param:"-" header:"-"` ObjectName string `param:"-" header:"-"` VersionID string `param:"versionId,omitempty" header:"-"` // contains filtered or unexported fields }
GetObjectACLRequest is input of GetObjectACL
type GetObjectRequest ¶
type GetObjectRequest struct { BucketName string `param:"-" header:"-"` ObjectName string `param:"-" header:"-"` Range string `param:"-" header:"Range,omitempty"` }
GetObjectRequest is the input of GetObject method
type Grant ¶
type Grant struct { Grantee GrantKey `json:"grantee"` Permission GrantPermission `json:"permission"` Type GrantType `json:"type"` }
Grant grants
type GrantPermission ¶
type GrantPermission string
GrantPermission is permission of Grantee
const ( GrantPermissionRead GrantPermission = "READ" GrantPermissionWrite GrantPermission = "WRITE" GrantPermissionReadObjects GrantPermission = "READ_OBJECTS" GrantPermissionSSOWrite GrantPermission = "SSO_WRITE" GrantPermissionFullControl GrantPermission = "FULL_CONTROL" )
GrantPermission const
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 TLSHandshakeTimeout time.Duration KeepAliveTimeout time.Duration }
HTTPTimeout defines HTTP timeout.
type InitMultipartUploadRequest ¶
type InitMultipartUploadRequest struct { BucketName string `param:"-" header:"-"` ObjectName string `param:"-" header:"-"` Metadata *ObjectMetadata `header:"-" param:"-"` // contains filtered or unexported fields }
InitMultipartUploadRequest is input of InitMultipartUpload
type InitMultipartUploadResponse ¶
type InitMultipartUploadResponse struct { BucketName string `json:"bucketName" param:"-" header:"-"` ObjectName string `json:"objectName" param:"-" header:"-"` UploadID string `json:"uploadId" param:"uploadId" header:"-"` }
InitMultipartUploadResponse is result of InitMultipartUpload
type LifecycleAction ¶
type LifecycleAction map[LifecycleActionType]LifecycleBaseItem
LifecycleAction is action in LifecycleRule
type LifecycleActionType ¶
type LifecycleActionType string
LifecycleActionType is enum type of action
const ( Expiration LifecycleActionType = "expiration" NonCurrentVersionExpiration LifecycleActionType = "nonCurrentVersionExpiration" AbortIncompleteMultipartUpload LifecycleActionType = "abortIncompleteMultipartUpload " )
Three LifecycleAction Types
type LifecycleBaseItem ¶
type LifecycleBaseItem struct {
Days float64 `json:"days"`
}
LifecycleBaseItem replaces days in action
type LifecycleConfig ¶
type LifecycleConfig struct {
Rules []LifecycleRule `json:"rules"`
}
LifecycleConfig is ttl config of bucket
func NewLifecycleConfigFromJSON ¶
func NewLifecycleConfigFromJSON(content []byte) (*LifecycleConfig, error)
NewLifecycleConfigFromJSON is a shortcut for translating json string to LifecycleConfig. Becuase, constructing a LifecycleConfig is too hard
type LifecycleRule ¶
type LifecycleRule struct { ID string `json:"id"` Prefix string `json:"prefix"` Enabled bool `json:"enabled"` Action LifecycleAction `json:"actions"` }
LifecycleRule is rule of LifecycleConfig
func NewLifecycleRuleFromJSON ¶
func NewLifecycleRuleFromJSON(content []byte) (*LifecycleRule, error)
NewLifecycleRuleFromJSON is a shortcut for translating json string to LifecycleRule. Becuase, constructing a LifecycleRule is too hard
type ListBucketsResponse ¶
type ListBucketsResponse struct { Owner Owner `json:"owner"` Buckets []GetBucketInfoResponse `json:"buckets"` }
ListBucketsResponse is result of ListBuckets
type ListObjectsRequest ¶
type ListObjectsRequest struct { BucketName string `param:"-" header:"-"` Prefix string `param:"prefix" header:"-"` Delimiter string `param:"delimiter" header:"-"` MaxKeys int `param:"maxKeys" header:"-"` }
ListObjectsRequest is input of ListObjectsRequest
type MigrateBucketRequest ¶
type MigrateBucketRequest struct { BucketName string `param:"-" header:"-"` OrgID string `param:"orgId" header:"-"` TeamID string `param:"teamId" header:"-"` // contains filtered or unexported fields }
MigrateBucketRequest is request of migrating bucket to other org and team
type ObjectListing ¶
type ObjectListing struct { BucketName string `json:"name" param:"-" header:"-"` Prefix string `json:"prefix" param:"prefix" header:"-"` MaxKeys int `json:"maxKeys" param:"maxKeys" header:"-"` Marker string `json:"marker" param:"-" header:"-"` Truncated bool `json:"truncated" param:"-" header:"-"` NextMarker string `json:"nextMarker" param:"marker" header:"-"` Delimiter string `json:"delimiter" param:"delimiter" header:"-"` ObjectSummaries []ObjectSummary `json:"objects" param:"-" header:"-"` CommonPrefixes []string `json:"commonPrefixes" param:"-" header:"-"` }
ObjectListing bean
type ObjectMetadata ¶
type ObjectMetadata struct {
// contains filtered or unexported fields
}
ObjectMetadata is metadata of object
func NewObjectMetadata ¶
func NewObjectMetadata() *ObjectMetadata
NewObjectMetadata create a default ObjectMetadata
func (*ObjectMetadata) Get ¶
func (metadata *ObjectMetadata) Get(k string) string
Get method of ObjectMetadata
func (*ObjectMetadata) GetContentLength ¶
func (metadata *ObjectMetadata) GetContentLength() (int64, error)
GetContentLength gets ContentLength of object metadata
func (*ObjectMetadata) GetContentType ¶ added in v1.0.3
func (metadata *ObjectMetadata) GetContentType() string
func (*ObjectMetadata) GetRawMetadata ¶ added in v1.0.3
func (metadata *ObjectMetadata) GetRawMetadata() map[string]string
func (*ObjectMetadata) Set ¶
func (metadata *ObjectMetadata) Set(k, v string) error
Set method of ObjectMetadata
func (*ObjectMetadata) SetContentLength ¶
func (metadata *ObjectMetadata) SetContentLength(length int64)
SetContentLength sets ContentLength of object metadata
func (*ObjectMetadata) SetContentType ¶ added in v1.0.3
func (metadata *ObjectMetadata) SetContentType(contentType string)
type ObjectSummary ¶
type ObjectSummary struct { ETag string `json:"etag"` ObjectName string `json:"name"` Owner Owner `json:"owner"` Size int64 `json:"size"` LastModified time.Time `json:"lastModified"` UploadTime int64 `json:"uploadTime"` }
ObjectSummary beans
type PutObjectRequest ¶
type PutObjectRequest struct { BucketName string `param:"-" header:"-"` ObjectName string `param:"-" header:"-"` Data io.Reader `param:"-" header:"-"` CacheControl string `header:"Cache-Control,omitempty" param:"-"` ContentDisposition string `header:"Content-Disposition,omitempty" param:"-"` ContentEncoding string `header:"Content-Encoding,omitempty" param:"-"` ContentType string `header:"Content-Type,omitempty" param:"-"` ContentLength int `header:"Content-Length,omitempty" param:"-"` ContentMd5 string `header:"Content-Md5,omitempty" param:"-"` Expect string `header:"Expect,omitempty" param:"-"` Metadata *ObjectMetadata `header:"-" param:"-"` }
PutObjectRequest is the input of PutObject method
type PutObjectResponse ¶
type PutObjectResponse struct { BucketName string `json:"bucketName"` ObjectName string `json:"objectName"` AccessKeyID string `json:"accessKeyId"` Signature string `json:"signature"` Expires int64 `json:"expires"` PreviousVersionID string `json:"previousVersionId"` OutsideAccess bool `json:"outsideAccess"` }
PutObjectResponse is the result of PutObject method
type ServerError ¶
type ServerError struct {
// contains filtered or unexported fields
}
ServerError is a common structure for FDS client error
func (*ServerError) Message ¶
func (e *ServerError) Message() string
Message is the msg of ServerError
type SetObjectACLRequest ¶
type SetObjectACLRequest struct { BucketName string `param:"-" header:"-"` ObjectName string `param:"-" header:"-"` VersionID string `param:"versionId,omitempty" header:"-"` ACL *AccessControlList `param:"-" header:"-"` // contains filtered or unexported fields }
SetObjectACLRequest is input of SetObjectACL
type SetObjectMetadataRequest ¶
type SetObjectMetadataRequest struct { BucketName string `param:"-" header:"-"` ObjectName string `param:"-" header:"-"` Metadata *ObjectMetadata `param:"-" header:"-"` // contains filtered or unexported fields }
SetObjectMetadataRequest is input of SetObjectMetadata
type StorageClass ¶ added in v1.0.3
type StorageClass string
Storage Class
const ( Standard StorageClass = "STANDARD" StandardInfrequentAccess StorageClass = "STANDARD_IA" Archive StorageClass = "Archive" )
type UploadPartList ¶
type UploadPartList struct {
UploadPartResultList []UploadPartResponse `json:"uploadPartResultList"`
}
UploadPartList is required by CompleteMultipartUpload
type UploadPartRequest ¶
type UploadPartRequest struct { BucketName string `param:"-" header:"-"` ObjectName string `param:"-" header:"-"` UploadID string `param:"uploadId" header:"-"` PartNumber int `param:"partNumber" header:"-"` Data io.Reader `param:"-" header:"-"` }
UploadPartRequest is input of UploadPart
type UploadPartResponse ¶
type UploadPartResponse struct { PartNumber int `json:"partNumber"` ETag string `json:"etag"` PartSize int64 `json:"partSize"` }
UploadPartResponse is result of UploadPart
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package manager provides a concurrent downloading api with checkpoint for FDS
|
Package manager provides a concurrent downloading api with checkpoint for FDS |