腾讯云 COS Golang SDK (XML API)
# Install
go get github.com/lily-lee/qcloud-cos-go-sdk/cos
# Update
go get -u github.com/lily-lee/qcloud-cos-go-sdk/cos
package main
import (
"github.com/lily-lee/qcloud-cos-go-sdk/cos"
"log"
)
func main() {
client, err := cos.NewClient("AppID", "SecretID", "SecretKey", "https", 600)
if err != nil {
// Handle Error
}
// GetService()
result, err := client.GetService()
if err != nil {
// Handle Error
}
log.Println("get service result:", result)
bucket, err := client.NewBucket("BucketName", "Region")
if err != nil {
// Handle Error
}
err = bucket.PutObjectFromFile("license", "./LICENSE", nil)
if err != nil {
// Handle Error
}
}
- New Client (NewClient())
- New Bucket (client.NewBucket())
- GET Service (client.GetService())
- CAM STS (client.GetSTS())
- DELETE Bucket (client.DeleteBucket())
- DELETE Bucket cors (client.DeleteBucketCORS())
- DELETE Bucket lifecycle (client.DeleteBucketLifecycle())
- GET Bucket (client.GetBucket())
- GET Bucket acl (client.GetBucketACL())
- GET Bucket cors (client.GetBucketCORS())
- GET Bucket location (client.GetBucketLocation())
- GET Bucket lifecycle (client.GetBucketLifecycle())
- HEAD Bucket (client.HeadBucket())
- List Multipart Uploads (client.ListMultipartUploads())
- PUT Bucket (client.PutBucket())
- PUT Bucket acl (client.PutBucketACL())
- PUT Bucket cors (client.PutBucketCORS())
- PUT Bucket lifecycle (client.PutBucketLifecycle())
- Abort Multipart Upload (bucket.AbortMultipartUpload()
- Complete Multipart Upload (bucket.CompleteMultipartUpload())
- DELETE Multipart Objects (bucket.DeleteMultiObject())
- DELETE Object (bucket.DeleteObject())
- GET Object (bucket.GetObject())
- GET Object to local file (bucket.GetObjectToFile())
- GET Object acl (bucket.GetObjectACL())
- HEAD Object (bucket.HeadObject())
- Initiate Multipart Upload (bucket.InitiateMultipartUpload())
- List Parts (bucket.ListParts())
- OPTIONS Object (bucket.OptionsObject())
- PUT Object (bucket.PutObject())
- PUT Object from file (bucket.PutObjectFromFile())
- PUT Object acl (bucket.PutObjectACL())
- PUT Object - Copy (bucket.PutObjectCopy())
- Upload Part (bucket.UploadPart())
- Upload Part - Copy (bucket.UploadPartCopy())