Documentation ¶
Overview ¶
Package cli implements functions used to call the API in Tencent Cloud COS(Cloud Object Storage). These functions are all in a struct Client.
If you want to use the functions in this package, you should first fill the field of struct ClientConfig, and call NewClient to generate one Client, and use this client to call the functions you need.
Index ¶
- Constants
- Variables
- type AbortFile
- type Client
- func (client *Client) AbortParts(cosPath string) bool
- func (client *Client) CopyFile(sourcePath string, cosPath string, headers *http.Header, options *CopyOption) int
- func (client *Client) CopyFolder(sourcePath string, cosPath string, headers *http.Header, options *CopyOption) int
- func (client *Client) CreateBucket() bool
- func (client *Client) DeleteBucket(force bool) bool
- func (client *Client) DeleteFile(cosPath string, options *DeleteOption) int
- func (client *Client) DeleteFolder(cosPath string, options *DeleteOption) int
- func (client *Client) DeleteObjects(deleteList []string) (successNum int, failNum int)
- func (client *Client) DownloadFile(cosPath string, localPath string, _ *http.Header, options *DownloadOption) int
- func (client *Client) DownloadFolder(cosPath string, localPath string, options *DownloadOption) int
- func (client *Client) GetBucketACL() bool
- func (client *Client) GetBucketVersioning() bool
- func (client *Client) GetObjectACL(cosPath string) bool
- func (client *Client) InfoObject(cosPath string, _ bool) bool
- func (client *Client) ListMultipartObjects(cosPath string) bool
- func (client *Client) ListObjects(cosPath string, options *ListOption) bool
- func (client *Client) PutBucketACL(grantRead, grantWrite, grantFullControl, cosPath string) bool
- func (client *Client) PutBucketVersioning(versioning bool) bool
- func (client *Client) PutObjectACL(grantRead, grantWrite, grantFullControl, cosPath string) bool
- func (client *Client) RestoreFile(cosPath string, options *RestoreOption) int
- func (client *Client) RestoreFolder(cosPath string, options *RestoreOption) int
- func (client *Client) UploadFile(localPath string, cosPath string, headers *http.Header, options *UploadOption) int
- func (client *Client) UploadFolder(localPath string, cosPath string, headers *http.Header, options *UploadOption) int
- type ClientConfig
- type CopyOption
- type DeleteOption
- type DownloadOption
- type FileDesc
- type ListOption
- type PathPair
- type RestoreOption
- type UploadOption
Constants ¶
const ( Expedited = iota Standard Bulk )
const (
VERSION = "1.8.6.22"
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Client *cos.Client Config *ClientConfig }
func (*Client) AbortParts ¶
func (*Client) CopyFile ¶
func (client *Client) CopyFile(sourcePath string, cosPath string, headers *http.Header, options *CopyOption) int
sourcePath: bucket-appid.cos.ap-guangzhou.myqcloud.com/path/to/file cosPath: test/file
func (*Client) CopyFolder ¶
func (client *Client) CopyFolder(sourcePath string, cosPath string, headers *http.Header, options *CopyOption) int
sourcePath: bucket-appid.cos.ap-guangzhou.myqcloud.com/path/ cosPath: test/
func (*Client) CreateBucket ¶
func (*Client) DeleteBucket ¶
func (*Client) DeleteFile ¶
func (client *Client) DeleteFile(cosPath string, options *DeleteOption) int
func (*Client) DeleteFolder ¶
func (client *Client) DeleteFolder(cosPath string, options *DeleteOption) int
func (*Client) DeleteObjects ¶
func (*Client) DownloadFile ¶
func (*Client) DownloadFolder ¶
func (client *Client) DownloadFolder(cosPath string, localPath string, options *DownloadOption) int
func (*Client) GetBucketACL ¶
GetBucketACL will get the ACL configured in client and prints it. if all things goes smoothly while requesting the information, return true. Otherwise, return false.
func (*Client) GetBucketVersioning ¶
func (*Client) GetObjectACL ¶
func (*Client) ListMultipartObjects ¶
func (*Client) ListObjects ¶
func (client *Client) ListObjects(cosPath string, options *ListOption) bool
func (*Client) PutBucketACL ¶
PutBucketACL reads the grant strings and applied them to bucketPath specified. If everything goes ok, return true. Otherwise(like network connection failed, no such remote object), return false.
func (*Client) PutBucketVersioning ¶
func (*Client) PutObjectACL ¶
PutObjectACL reads the grant strings and applied them to cosPath specified. If everything goes ok, return true. Otherwise(like network connection failed, no such remote object), return false.
func (*Client) RestoreFile ¶
func (client *Client) RestoreFile(cosPath string, options *RestoreOption) int
func (*Client) RestoreFolder ¶
func (client *Client) RestoreFolder(cosPath string, options *RestoreOption) int
func (*Client) UploadFile ¶
func (client *Client) UploadFile(localPath string, cosPath string, headers *http.Header, options *UploadOption) int
Upload a single file.
func (*Client) UploadFolder ¶
func (client *Client) UploadFolder(localPath string, cosPath string, headers *http.Header, options *UploadOption) int
Upload a folder.
type ClientConfig ¶
type ClientConfig struct { SecretID string SecretKey string Token string Bucket string Endpoint string MaxThread int PartSize int RetryTimes int Timeout int Schema string VerifyMethod string Anonymous bool }
func LoadConf ¶
func LoadConf(configPath string) *ClientConfig
Load config from config file path and return a ClientConfig.
type CopyOption ¶
type DownloadOption ¶
type ListOption ¶
type RestoreOption ¶
Source Files ¶
- client.go
- client_abort.go
- client_copy.go
- client_createbucket.go
- client_delete.go
- client_deletebucket.go
- client_download.go
- client_getacl.go
- client_getbucketversioning.go
- client_info.go
- client_list.go
- client_listparts.go
- client_putacl.go
- client_putbucketversioning.go
- client_restore.go
- client_upload.go
- doc.go