diff --git a/services/bos/client.go b/services/bos/client.go index aec79b24..c3e56545 100644 --- a/services/bos/client.go +++ b/services/bos/client.go @@ -147,8 +147,8 @@ func NewClientWithConfig(config *BosClientConfiguration) (*Client, error) { // ListBuckets - list all buckets // // RETURNS: -// - *api.ListBucketsResult: the all buckets -// - error: the return error if any occurs +// - *api.ListBucketsResult: the all buckets +// - error: the return error if any occurs func (c *Client) ListBuckets() (*api.ListBucketsResult, error) { return api.ListBuckets(c, c.BosContext) } @@ -156,11 +156,12 @@ func (c *Client) ListBuckets() (*api.ListBucketsResult, error) { // ListObjects - list all objects of the given bucket // // PARAMS: -// - bucket: the bucket name -// - args: the optional arguments to list objects +// - bucket: the bucket name +// - args: the optional arguments to list objects +// // RETURNS: -// - *api.ListObjectsResult: the all objects of the bucket -// - error: the return error if any occurs +// - *api.ListObjectsResult: the all objects of the bucket +// - error: the return error if any occurs func (c *Client) ListObjects(bucket string, args *api.ListObjectsArgs) (*api.ListObjectsResult, error) { return api.ListObjects(c, bucket, args, c.BosContext) @@ -169,14 +170,15 @@ func (c *Client) ListObjects(bucket string, // SimpleListObjects - list all objects of the given bucket with simple arguments // // PARAMS: -// - bucket: the bucket name -// - prefix: the prefix for listing -// - maxKeys: the max number of result objects -// - marker: the marker to mark the beginning for the listing -// - delimiter: the delimiter for list objects +// - bucket: the bucket name +// - prefix: the prefix for listing +// - maxKeys: the max number of result objects +// - marker: the marker to mark the beginning for the listing +// - delimiter: the delimiter for list objects +// // RETURNS: -// - *api.ListObjectsResult: the all objects of the bucket -// - error: the return error if any occurs +// - *api.ListObjectsResult: the all objects of the bucket +// - error: the return error if any occurs func (c *Client) SimpleListObjects(bucket, prefix string, maxKeys int, marker, delimiter string) (*api.ListObjectsResult, error) { args := &api.ListObjectsArgs{delimiter, marker, maxKeys, prefix} @@ -186,9 +188,10 @@ func (c *Client) SimpleListObjects(bucket, prefix string, maxKeys int, marker, // HeadBucket - test the given bucket existed and access authority // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - error: nil if exists and have authority otherwise the specific error +// - error: nil if exists and have authority otherwise the specific error func (c *Client) HeadBucket(bucket string) error { err, _ := api.HeadBucket(c, bucket, c.BosContext) return err @@ -197,10 +200,11 @@ func (c *Client) HeadBucket(bucket string) error { // DoesBucketExist - test the given bucket existed or not // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - bool: true if exists and false if not exists or occurs error -// - error: nil if exists or not exist, otherwise the specific error +// - bool: true if exists and false if not exists or occurs error +// - error: nil if exists or not exist, otherwise the specific error func (c *Client) DoesBucketExist(bucket string) (bool, error) { err, _ := api.HeadBucket(c, bucket, c.BosContext) if err == nil { @@ -217,7 +221,7 @@ func (c *Client) DoesBucketExist(bucket string) (bool, error) { return false, err } -//IsNsBucket - test the given bucket is namespace bucket or not +// IsNsBucket - test the given bucket is namespace bucket or not func (c *Client) IsNsBucket(bucket string) bool { err, resp := api.HeadBucket(c, bucket, c.BosContext) if err == nil && resp.Header(sdk_http.BCE_BUCKET_TYPE) == api.NAMESPACE_BUCKET { @@ -235,10 +239,11 @@ func (c *Client) IsNsBucket(bucket string) bool { // PutBucket - create a new bucket // // PARAMS: -// - bucket: the new bucket name +// - bucket: the new bucket name +// // RETURNS: -// - string: the location of the new bucket if create success -// - error: nil if create success otherwise the specific error +// - string: the location of the new bucket if create success +// - error: nil if create success otherwise the specific error func (c *Client) PutBucket(bucket string) (string, error) { return api.PutBucket(c, bucket, nil, c.BosContext) } @@ -250,9 +255,10 @@ func (c *Client) PutBucketWithArgs(bucket string, args *api.PutBucketArgs) (stri // DeleteBucket - delete a empty bucket // // PARAMS: -// - bucket: the bucket name to be deleted +// - bucket: the bucket name to be deleted +// // RETURNS: -// - error: nil if delete success otherwise the specific error +// - error: nil if delete success otherwise the specific error func (c *Client) DeleteBucket(bucket string) error { return api.DeleteBucket(c, bucket, c.BosContext) } @@ -260,10 +266,11 @@ func (c *Client) DeleteBucket(bucket string) error { // GetBucketLocation - get the location fo the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - string: the location of the bucket -// - error: nil if success otherwise the specific error +// - string: the location of the bucket +// - error: nil if success otherwise the specific error func (c *Client) GetBucketLocation(bucket string) (string, error) { return api.GetBucketLocation(c, bucket, c.BosContext) } @@ -271,10 +278,11 @@ func (c *Client) GetBucketLocation(bucket string) (string, error) { // PutBucketAcl - set the acl of the given bucket with acl body stream // // PARAMS: -// - bucket: the bucket name -// - aclBody: the acl json body stream +// - bucket: the bucket name +// - aclBody: the acl json body stream +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketAcl(bucket string, aclBody *bce.Body) error { return api.PutBucketAcl(c, bucket, "", aclBody, c.BosContext) } @@ -282,10 +290,11 @@ func (c *Client) PutBucketAcl(bucket string, aclBody *bce.Body) error { // PutBucketAclFromCanned - set the canned acl of the given bucket // // PARAMS: -// - bucket: the bucket name -// - cannedAcl: the cannedAcl string +// - bucket: the bucket name +// - cannedAcl: the cannedAcl string +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketAclFromCanned(bucket, cannedAcl string) error { return api.PutBucketAcl(c, bucket, cannedAcl, nil, c.BosContext) } @@ -293,10 +302,11 @@ func (c *Client) PutBucketAclFromCanned(bucket, cannedAcl string) error { // PutBucketAclFromFile - set the acl of the given bucket with acl json file name // // PARAMS: -// - bucket: the bucket name -// - aclFile: the acl file name +// - bucket: the bucket name +// - aclFile: the acl file name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketAclFromFile(bucket, aclFile string) error { body, err := bce.NewBodyFromFile(aclFile) if err != nil { @@ -308,10 +318,11 @@ func (c *Client) PutBucketAclFromFile(bucket, aclFile string) error { // PutBucketAclFromString - set the acl of the given bucket with acl json string // // PARAMS: -// - bucket: the bucket name -// - aclString: the acl string with json format +// - bucket: the bucket name +// - aclString: the acl string with json format +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketAclFromString(bucket, aclString string) error { body, err := bce.NewBodyFromString(aclString) if err != nil { @@ -323,10 +334,11 @@ func (c *Client) PutBucketAclFromString(bucket, aclString string) error { // PutBucketAclFromStruct - set the acl of the given bucket with acl data structure // // PARAMS: -// - bucket: the bucket name -// - aclObj: the acl struct object +// - bucket: the bucket name +// - aclObj: the acl struct object +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketAclFromStruct(bucket string, aclObj *api.PutBucketAclArgs) error { jsonBytes, jsonErr := json.Marshal(aclObj) if jsonErr != nil { @@ -342,10 +354,11 @@ func (c *Client) PutBucketAclFromStruct(bucket string, aclObj *api.PutBucketAclA // GetBucketAcl - get the acl of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - *api.GetBucketAclResult: the result of the bucket acl -// - error: nil if success otherwise the specific error +// - *api.GetBucketAclResult: the result of the bucket acl +// - error: nil if success otherwise the specific error func (c *Client) GetBucketAcl(bucket string) (*api.GetBucketAclResult, error) { return api.GetBucketAcl(c, bucket, c.BosContext) } @@ -353,10 +366,11 @@ func (c *Client) GetBucketAcl(bucket string) (*api.GetBucketAclResult, error) { // PutBucketLogging - set the loging setting of the given bucket with json stream // // PARAMS: -// - bucket: the bucket name -// - body: the json body +// - bucket: the bucket name +// - body: the json body +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketLogging(bucket string, body *bce.Body) error { return api.PutBucketLogging(c, bucket, body, c.BosContext) } @@ -364,10 +378,11 @@ func (c *Client) PutBucketLogging(bucket string, body *bce.Body) error { // PutBucketLoggingFromString - set the loging setting of the given bucket with json string // // PARAMS: -// - bucket: the bucket name -// - logging: the json format string +// - bucket: the bucket name +// - logging: the json format string +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketLoggingFromString(bucket, logging string) error { body, err := bce.NewBodyFromString(logging) if err != nil { @@ -379,10 +394,11 @@ func (c *Client) PutBucketLoggingFromString(bucket, logging string) error { // PutBucketLoggingFromStruct - set the loging setting of the given bucket with args object // // PARAMS: -// - bucket: the bucket name -// - obj: the logging setting object +// - bucket: the bucket name +// - obj: the logging setting object +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketLoggingFromStruct(bucket string, obj *api.PutBucketLoggingArgs) error { jsonBytes, jsonErr := json.Marshal(obj) if jsonErr != nil { @@ -398,10 +414,11 @@ func (c *Client) PutBucketLoggingFromStruct(bucket string, obj *api.PutBucketLog // GetBucketLogging - get the logging setting of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - *api.GetBucketLoggingResult: the logging setting of the bucket -// - error: nil if success otherwise the specific error +// - *api.GetBucketLoggingResult: the logging setting of the bucket +// - error: nil if success otherwise the specific error func (c *Client) GetBucketLogging(bucket string) (*api.GetBucketLoggingResult, error) { return api.GetBucketLogging(c, bucket, c.BosContext) } @@ -409,9 +426,10 @@ func (c *Client) GetBucketLogging(bucket string) (*api.GetBucketLoggingResult, e // DeleteBucketLogging - delete the logging setting of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) DeleteBucketLogging(bucket string) error { return api.DeleteBucketLogging(c, bucket, c.BosContext) } @@ -419,10 +437,11 @@ func (c *Client) DeleteBucketLogging(bucket string) error { // PutBucketLifecycle - set the lifecycle rule of the given bucket with raw stream // // PARAMS: -// - bucket: the bucket name -// - lifecycle: the lifecycle rule json body +// - bucket: the bucket name +// - lifecycle: the lifecycle rule json body +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketLifecycle(bucket string, lifecycle *bce.Body) error { return api.PutBucketLifecycle(c, bucket, lifecycle, c.BosContext) } @@ -430,10 +449,11 @@ func (c *Client) PutBucketLifecycle(bucket string, lifecycle *bce.Body) error { // PutBucketLifecycleFromString - set the lifecycle rule of the given bucket with string // // PARAMS: -// - bucket: the bucket name -// - lifecycle: the lifecycle rule json format string body +// - bucket: the bucket name +// - lifecycle: the lifecycle rule json format string body +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketLifecycleFromString(bucket, lifecycle string) error { body, err := bce.NewBodyFromString(lifecycle) if err != nil { @@ -445,10 +465,11 @@ func (c *Client) PutBucketLifecycleFromString(bucket, lifecycle string) error { // GetBucketLifecycle - get the lifecycle rule of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - *api.GetBucketLifecycleResult: the lifecycle rule of the bucket -// - error: nil if success otherwise the specific error +// - *api.GetBucketLifecycleResult: the lifecycle rule of the bucket +// - error: nil if success otherwise the specific error func (c *Client) GetBucketLifecycle(bucket string) (*api.GetBucketLifecycleResult, error) { return api.GetBucketLifecycle(c, bucket, c.BosContext) } @@ -456,9 +477,10 @@ func (c *Client) GetBucketLifecycle(bucket string) (*api.GetBucketLifecycleResul // DeleteBucketLifecycle - delete the lifecycle rule of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) DeleteBucketLifecycle(bucket string) error { return api.DeleteBucketLifecycle(c, bucket, c.BosContext) } @@ -466,10 +488,11 @@ func (c *Client) DeleteBucketLifecycle(bucket string) error { // PutBucketStorageclass - set the storage class of the given bucket // // PARAMS: -// - bucket: the bucket name -// - storageClass: the storage class string value +// - bucket: the bucket name +// - storageClass: the storage class string value +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketStorageclass(bucket, storageClass string) error { return api.PutBucketStorageclass(c, bucket, storageClass, c.BosContext) } @@ -477,10 +500,11 @@ func (c *Client) PutBucketStorageclass(bucket, storageClass string) error { // GetBucketStorageclass - get the storage class of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - string: the storage class string value -// - error: nil if success otherwise the specific error +// - string: the storage class string value +// - error: nil if success otherwise the specific error func (c *Client) GetBucketStorageclass(bucket string) (string, error) { return api.GetBucketStorageclass(c, bucket, c.BosContext) } @@ -488,11 +512,12 @@ func (c *Client) GetBucketStorageclass(bucket string) (string, error) { // PutBucketReplication - set the bucket replication config of different region // // PARAMS: -// - bucket: the bucket name -// - replicationConf: the replication config json body stream -// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// - bucket: the bucket name +// - replicationConf: the replication config json body stream +// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketReplication(bucket string, replicationConf *bce.Body, replicationRuleId string) error { return api.PutBucketReplication(c, bucket, replicationConf, replicationRuleId, c.BosContext) } @@ -500,11 +525,12 @@ func (c *Client) PutBucketReplication(bucket string, replicationConf *bce.Body, // PutBucketReplicationFromFile - set the bucket replication config with json file name // // PARAMS: -// - bucket: the bucket name -// - confFile: the config json file name -// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// - bucket: the bucket name +// - confFile: the config json file name +// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketReplicationFromFile(bucket, confFile string, replicationRuleId string) error { body, err := bce.NewBodyFromFile(confFile) if err != nil { @@ -516,11 +542,12 @@ func (c *Client) PutBucketReplicationFromFile(bucket, confFile string, replicati // PutBucketReplicationFromString - set the bucket replication config with json string // // PARAMS: -// - bucket: the bucket name -// - confString: the config string with json format -// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// - bucket: the bucket name +// - confString: the config string with json format +// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketReplicationFromString(bucket, confString string, replicationRuleId string) error { body, err := bce.NewBodyFromString(confString) if err != nil { @@ -532,11 +559,12 @@ func (c *Client) PutBucketReplicationFromString(bucket, confString string, repli // PutBucketReplicationFromStruct - set the bucket replication config with struct // // PARAMS: -// - bucket: the bucket name -// - confObj: the replication config struct object -// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// - bucket: the bucket name +// - confObj: the replication config struct object +// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketReplicationFromStruct(bucket string, confObj *api.PutBucketReplicationArgs, replicationRuleId string) error { jsonBytes, jsonErr := json.Marshal(confObj) @@ -553,11 +581,12 @@ func (c *Client) PutBucketReplicationFromStruct(bucket string, // GetBucketReplication - get the bucket replication config of the given bucket // // PARAMS: -// - bucket: the bucket name -// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// - bucket: the bucket name +// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// // RETURNS: -// - *api.GetBucketReplicationResult: the result of the bucket replication config -// - error: nil if success otherwise the specific error +// - *api.GetBucketReplicationResult: the result of the bucket replication config +// - error: nil if success otherwise the specific error func (c *Client) GetBucketReplication(bucket string, replicationRuleId string) (*api.GetBucketReplicationResult, error) { return api.GetBucketReplication(c, bucket, replicationRuleId, c.BosContext) } @@ -565,10 +594,11 @@ func (c *Client) GetBucketReplication(bucket string, replicationRuleId string) ( // ListBucketReplication - get all replication config of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - *api.ListBucketReplicationResult: the list of the bucket replication config -// - error: nil if success otherwise the specific error +// - *api.ListBucketReplicationResult: the list of the bucket replication config +// - error: nil if success otherwise the specific error func (c *Client) ListBucketReplication(bucket string) (*api.ListBucketReplicationResult, error) { return api.ListBucketReplication(c, bucket, c.BosContext) } @@ -576,10 +606,11 @@ func (c *Client) ListBucketReplication(bucket string) (*api.ListBucketReplicatio // DeleteBucketReplication - delete the bucket replication config of the given bucket // // PARAMS: -// - bucket: the bucket name -// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// - bucket: the bucket name +// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) DeleteBucketReplication(bucket string, replicationRuleId string) error { return api.DeleteBucketReplication(c, bucket, replicationRuleId, c.BosContext) } @@ -587,11 +618,12 @@ func (c *Client) DeleteBucketReplication(bucket string, replicationRuleId string // GetBucketReplicationProgress - get the bucket replication process of the given bucket // // PARAMS: -// - bucket: the bucket name -// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// - bucket: the bucket name +// - replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -] +// // RETURNS: -// - *api.GetBucketReplicationProgressResult: the process of the bucket replication -// - error: nil if success otherwise the specific error +// - *api.GetBucketReplicationProgressResult: the process of the bucket replication +// - error: nil if success otherwise the specific error func (c *Client) GetBucketReplicationProgress(bucket string, replicationRuleId string) ( *api.GetBucketReplicationProgressResult, error) { return api.GetBucketReplicationProgress(c, bucket, replicationRuleId, c.BosContext) @@ -600,10 +632,11 @@ func (c *Client) GetBucketReplicationProgress(bucket string, replicationRuleId s // PutBucketEncryption - set the bucket encryption config of the given bucket // // PARAMS: -// - bucket: the bucket name -// - algorithm: the encryption algorithm name +// - bucket: the bucket name +// - algorithm: the encryption algorithm name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketEncryption(bucket, algorithm string) error { return api.PutBucketEncryption(c, bucket, algorithm, c.BosContext) } @@ -611,10 +644,11 @@ func (c *Client) PutBucketEncryption(bucket, algorithm string) error { // GetBucketEncryption - get the bucket encryption config // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - string: the encryption algorithm name -// - error: nil if success otherwise the specific error +// - string: the encryption algorithm name +// - error: nil if success otherwise the specific error func (c *Client) GetBucketEncryption(bucket string) (string, error) { return api.GetBucketEncryption(c, bucket, c.BosContext) } @@ -622,9 +656,10 @@ func (c *Client) GetBucketEncryption(bucket string) (string, error) { // DeleteBucketEncryption - delete the bucket encryption config of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) DeleteBucketEncryption(bucket string) error { return api.DeleteBucketEncryption(c, bucket, c.BosContext) } @@ -632,10 +667,11 @@ func (c *Client) DeleteBucketEncryption(bucket string) error { // PutBucketStaticWebsite - set the bucket static website config // // PARAMS: -// - bucket: the bucket name -// - config: the static website config body stream +// - bucket: the bucket name +// - config: the static website config body stream +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketStaticWebsite(bucket string, config *bce.Body) error { return api.PutBucketStaticWebsite(c, bucket, config, c.BosContext) } @@ -643,10 +679,11 @@ func (c *Client) PutBucketStaticWebsite(bucket string, config *bce.Body) error { // PutBucketStaticWebsiteFromString - set the bucket static website config from json string // // PARAMS: -// - bucket: the bucket name -// - jsonConfig: the static website config json string +// - bucket: the bucket name +// - jsonConfig: the static website config json string +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketStaticWebsiteFromString(bucket, jsonConfig string) error { body, err := bce.NewBodyFromString(jsonConfig) if err != nil { @@ -658,10 +695,11 @@ func (c *Client) PutBucketStaticWebsiteFromString(bucket, jsonConfig string) err // PutBucketStaticWebsiteFromStruct - set the bucket static website config from struct // // PARAMS: -// - bucket: the bucket name -// - confObj: the static website config object +// - bucket: the bucket name +// - confObj: the static website config object +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketStaticWebsiteFromStruct(bucket string, confObj *api.PutBucketStaticWebsiteArgs) error { jsonBytes, jsonErr := json.Marshal(confObj) @@ -678,11 +716,12 @@ func (c *Client) PutBucketStaticWebsiteFromStruct(bucket string, // SimplePutBucketStaticWebsite - simple set the bucket static website config // // PARAMS: -// - bucket: the bucket name -// - index: the static website config for index file name -// - notFound: the static website config for notFound file name +// - bucket: the bucket name +// - index: the static website config for index file name +// - notFound: the static website config for notFound file name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) SimplePutBucketStaticWebsite(bucket, index, notFound string) error { confObj := &api.PutBucketStaticWebsiteArgs{index, notFound} return c.PutBucketStaticWebsiteFromStruct(bucket, confObj) @@ -691,10 +730,11 @@ func (c *Client) SimplePutBucketStaticWebsite(bucket, index, notFound string) er // GetBucketStaticWebsite - get the bucket static website config // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - result: the static website config result object -// - error: nil if success otherwise the specific error +// - result: the static website config result object +// - error: nil if success otherwise the specific error func (c *Client) GetBucketStaticWebsite(bucket string) ( *api.GetBucketStaticWebsiteResult, error) { return api.GetBucketStaticWebsite(c, bucket, c.BosContext) @@ -703,9 +743,10 @@ func (c *Client) GetBucketStaticWebsite(bucket string) ( // DeleteBucketStaticWebsite - delete the bucket static website config of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) DeleteBucketStaticWebsite(bucket string) error { return api.DeleteBucketStaticWebsite(c, bucket, c.BosContext) } @@ -713,10 +754,11 @@ func (c *Client) DeleteBucketStaticWebsite(bucket string) error { // PutBucketCors - set the bucket CORS config // // PARAMS: -// - bucket: the bucket name -// - config: the bucket CORS config body stream +// - bucket: the bucket name +// - config: the bucket CORS config body stream +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketCors(bucket string, config *bce.Body) error { return api.PutBucketCors(c, bucket, config, c.BosContext) } @@ -724,10 +766,11 @@ func (c *Client) PutBucketCors(bucket string, config *bce.Body) error { // PutBucketCorsFromFile - set the bucket CORS config from json config file // // PARAMS: -// - bucket: the bucket name -// - filename: the bucket CORS json config file name +// - bucket: the bucket name +// - filename: the bucket CORS json config file name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketCorsFromFile(bucket, filename string) error { body, err := bce.NewBodyFromFile(filename) if err != nil { @@ -739,10 +782,11 @@ func (c *Client) PutBucketCorsFromFile(bucket, filename string) error { // PutBucketCorsFromString - set the bucket CORS config from json config string // // PARAMS: -// - bucket: the bucket name -// - filename: the bucket CORS json config string +// - bucket: the bucket name +// - filename: the bucket CORS json config string +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketCorsFromString(bucket, jsonConfig string) error { body, err := bce.NewBodyFromString(jsonConfig) if err != nil { @@ -754,10 +798,11 @@ func (c *Client) PutBucketCorsFromString(bucket, jsonConfig string) error { // PutBucketCorsFromStruct - set the bucket CORS config from json config object // // PARAMS: -// - bucket: the bucket name -// - filename: the bucket CORS json config object +// - bucket: the bucket name +// - filename: the bucket CORS json config object +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketCorsFromStruct(bucket string, confObj *api.PutBucketCorsArgs) error { jsonBytes, jsonErr := json.Marshal(confObj) if jsonErr != nil { @@ -773,10 +818,11 @@ func (c *Client) PutBucketCorsFromStruct(bucket string, confObj *api.PutBucketCo // GetBucketCors - get the bucket CORS config // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - result: the bucket CORS config result object -// - error: nil if success otherwise the specific error +// - result: the bucket CORS config result object +// - error: nil if success otherwise the specific error func (c *Client) GetBucketCors(bucket string) (*api.GetBucketCorsResult, error) { return api.GetBucketCors(c, bucket, c.BosContext) } @@ -784,9 +830,10 @@ func (c *Client) GetBucketCors(bucket string) (*api.GetBucketCorsResult, error) // DeleteBucketCors - delete the bucket CORS config of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) DeleteBucketCors(bucket string) error { return api.DeleteBucketCors(c, bucket, c.BosContext) } @@ -794,11 +841,12 @@ func (c *Client) DeleteBucketCors(bucket string) error { // PutBucketCopyrightProtection - set the copyright protection config of the given bucket // // PARAMS: -// - cli: the client agent which can perform sending request -// - bucket: the bucket name -// - resources: the resource items in the bucket to be protected +// - cli: the client agent which can perform sending request +// - bucket: the bucket name +// - resources: the resource items in the bucket to be protected +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketCopyrightProtection(bucket string, resources ...string) error { return api.PutBucketCopyrightProtection(c, c.BosContext, bucket, resources...) } @@ -806,10 +854,11 @@ func (c *Client) PutBucketCopyrightProtection(bucket string, resources ...string // GetBucketCopyrightProtection - get the bucket copyright protection config // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - result: the bucket copyright protection config resources -// - error: nil if success otherwise the specific error +// - result: the bucket copyright protection config resources +// - error: nil if success otherwise the specific error func (c *Client) GetBucketCopyrightProtection(bucket string) ([]string, error) { return api.GetBucketCopyrightProtection(c, bucket, c.BosContext) } @@ -817,9 +866,10 @@ func (c *Client) GetBucketCopyrightProtection(bucket string) ([]string, error) { // DeleteBucketCopyrightProtection - delete the bucket copyright protection config // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) DeleteBucketCopyrightProtection(bucket string) error { return api.DeleteBucketCopyrightProtection(c, bucket, c.BosContext) } @@ -827,13 +877,14 @@ func (c *Client) DeleteBucketCopyrightProtection(bucket string) error { // PutObject - upload a new object or rewrite the existed object with raw stream // // PARAMS: -// - bucket: the name of the bucket to store the object -// - object: the name of the object -// - body: the object content body -// - args: the optional arguments +// - bucket: the name of the bucket to store the object +// - object: the name of the object +// - body: the object content body +// - args: the optional arguments +// // RETURNS: -// - string: etag of the uploaded object -// - error: the uploaded error if any occurs +// - string: etag of the uploaded object +// - error: the uploaded error if any occurs func (c *Client) PutObject(bucket, object string, body *bce.Body, args *api.PutObjectArgs) (string, error) { etag, _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) @@ -843,27 +894,29 @@ func (c *Client) PutObject(bucket, object string, body *bce.Body, // BasicPutObject - the basic interface of uploading an object // // PARAMS: -// - bucket: the name of the bucket to store the object -// - object: the name of the object -// - body: the object content body +// - bucket: the name of the bucket to store the object +// - object: the name of the object +// - body: the object content body +// // RETURNS: -// - string: etag of the uploaded object -// - error: the uploaded error if any occurs +// - string: etag of the uploaded object +// - error: the uploaded error if any occurs func (c *Client) BasicPutObject(bucket, object string, body *bce.Body) (string, error) { - etag , _, err := api.PutObject(c, bucket, object, body, nil, c.BosContext) + etag, _, err := api.PutObject(c, bucket, object, body, nil, c.BosContext) return etag, err } // PutObjectFromBytes - upload a new object or rewrite the existed object from a byte array // // PARAMS: -// - bucket: the name of the bucket to store the object -// - object: the name of the object -// - bytesArr: the content byte array -// - args: the optional arguments +// - bucket: the name of the bucket to store the object +// - object: the name of the object +// - bytesArr: the content byte array +// - args: the optional arguments +// // RETURNS: -// - string: etag of the uploaded object -// - error: the uploaded error if any occurs +// - string: etag of the uploaded object +// - error: the uploaded error if any occurs func (c *Client) PutObjectFromBytes(bucket, object string, bytesArr []byte, args *api.PutObjectArgs) (string, error) { body, err := bce.NewBodyFromBytes(bytesArr) @@ -878,20 +931,21 @@ func (c *Client) PutObjectFromBytes(bucket, object string, bytesArr []byte, // PutObjectFromString - upload a new object or rewrite the existed object from a string // // PARAMS: -// - bucket: the name of the bucket to store the object -// - object: the name of the object -// - content: the content string -// - args: the optional arguments +// - bucket: the name of the bucket to store the object +// - object: the name of the object +// - content: the content string +// - args: the optional arguments +// // RETURNS: -// - string: etag of the uploaded object -// - error: the uploaded error if any occurs +// - string: etag of the uploaded object +// - error: the uploaded error if any occurs func (c *Client) PutObjectFromString(bucket, object, content string, args *api.PutObjectArgs) (string, error) { body, err := bce.NewBodyFromString(content) if err != nil { return "", err } - etag , _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) + etag, _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) return etag, err } @@ -899,40 +953,42 @@ func (c *Client) PutObjectFromString(bucket, object, content string, // PutObjectFromFile - upload a new object or rewrite the existed object from a local file // // PARAMS: -// - bucket: the name of the bucket to store the object -// - object: the name of the object -// - fileName: the local file full path name -// - args: the optional arguments +// - bucket: the name of the bucket to store the object +// - object: the name of the object +// - fileName: the local file full path name +// - args: the optional arguments +// // RETURNS: -// - string: etag of the uploaded object -// - error: the uploaded error if any occurs +// - string: etag of the uploaded object +// - error: the uploaded error if any occurs func (c *Client) PutObjectFromFile(bucket, object, fileName string, args *api.PutObjectArgs) (string, error) { body, err := bce.NewBodyFromFile(fileName) if err != nil { return "", err } - etag , _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) + etag, _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) return etag, err } // PutObjectFromStream - upload a new object or rewrite the existed object from stream // // PARAMS: -// - bucket: the name of the bucket to store the object -// - object: the name of the object -// - fileName: the local file full path name -// - args: the optional arguments +// - bucket: the name of the bucket to store the object +// - object: the name of the object +// - fileName: the local file full path name +// - args: the optional arguments +// // RETURNS: -// - string: etag of the uploaded object -// - error: the uploaded error if any occurs +// - string: etag of the uploaded object +// - error: the uploaded error if any occurs func (c *Client) PutObjectFromStream(bucket, object string, reader io.Reader, args *api.PutObjectArgs) (string, error) { body, err := bce.NewBodyFromSizedReader(reader, -1) if err != nil { return "", err } - etag , _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) + etag, _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) return etag, err } @@ -955,15 +1011,16 @@ func (c *Client) PutObjectWithCallback(bucket, object string, body *bce.Body, // CopyObject - copy a remote object to another one // // PARAMS: -// - bucket: the name of the destination bucket -// - object: the name of the destination object -// - srcBucket: the name of the source bucket -// - srcObject: the name of the source object -// - args: the optional arguments for copying object which are MetadataDirective, StorageClass, -// IfMatch, IfNoneMatch, ifModifiedSince, IfUnmodifiedSince +// - bucket: the name of the destination bucket +// - object: the name of the destination object +// - srcBucket: the name of the source bucket +// - srcObject: the name of the source object +// - args: the optional arguments for copying object which are MetadataDirective, StorageClass, +// IfMatch, IfNoneMatch, ifModifiedSince, IfUnmodifiedSince +// // RETURNS: -// - *api.CopyObjectResult: result struct which contains "ETag" and "LastModified" fields -// - error: any error if it occurs +// - *api.CopyObjectResult: result struct which contains "ETag" and "LastModified" fields +// - error: any error if it occurs func (c *Client) CopyObject(bucket, object, srcBucket, srcObject string, args *api.CopyObjectArgs) (*api.CopyObjectResult, error) { source := fmt.Sprintf("/%s/%s", srcBucket, srcObject) @@ -973,13 +1030,14 @@ func (c *Client) CopyObject(bucket, object, srcBucket, srcObject string, // BasicCopyObject - the basic interface of copying a object to another one // // PARAMS: -// - bucket: the name of the destination bucket -// - object: the name of the destination object -// - srcBucket: the name of the source bucket -// - srcObject: the name of the source object +// - bucket: the name of the destination bucket +// - object: the name of the destination object +// - srcBucket: the name of the source bucket +// - srcObject: the name of the source object +// // RETURNS: -// - *api.CopyObjectResult: result struct which contains "ETag" and "LastModified" fields -// - error: any error if it occurs +// - *api.CopyObjectResult: result struct which contains "ETag" and "LastModified" fields +// - error: any error if it occurs func (c *Client) BasicCopyObject(bucket, object, srcBucket, srcObject string) (*api.CopyObjectResult, error) { source := fmt.Sprintf("/%s/%s", srcBucket, srcObject) @@ -989,14 +1047,15 @@ func (c *Client) BasicCopyObject(bucket, object, srcBucket, // GetObject - get the given object with raw stream return // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the object -// - args: the optional args in querysring -// - ranges: the optional range start and end to get the given object +// - bucket: the name of the bucket +// - object: the name of the object +// - args: the optional args in querysring +// - ranges: the optional range start and end to get the given object +// // RETURNS: -// - *api.GetObjectResult: result struct which contains "Body" and header fields -// for details reference https://cloud.baidu.com/doc/BOS/API.html#GetObject.E6.8E.A5.E5.8F.A3 -// - error: any error if it occurs +// - *api.GetObjectResult: result struct which contains "Body" and header fields +// for details reference https://cloud.baidu.com/doc/BOS/API.html#GetObject.E6.8E.A5.E5.8F.A3 +// - error: any error if it occurs func (c *Client) GetObject(bucket, object string, args map[string]string, ranges ...int64) (*api.GetObjectResult, error) { return api.GetObject(c, bucket, object, c.BosContext, args, ranges...) @@ -1005,12 +1064,13 @@ func (c *Client) GetObject(bucket, object string, args map[string]string, // BasicGetObject - the basic interface of geting the given object // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the object +// - bucket: the name of the bucket +// - object: the name of the object +// // RETURNS: -// - *api.GetObjectResult: result struct which contains "Body" and header fields -// for details reference https://cloud.baidu.com/doc/BOS/API.html#GetObject.E6.8E.A5.E5.8F.A3 -// - error: any error if it occurs +// - *api.GetObjectResult: result struct which contains "Body" and header fields +// for details reference https://cloud.baidu.com/doc/BOS/API.html#GetObject.E6.8E.A5.E5.8F.A3 +// - error: any error if it occurs func (c *Client) BasicGetObject(bucket, object string) (*api.GetObjectResult, error) { return api.GetObject(c, bucket, object, c.BosContext, nil) } @@ -1018,11 +1078,12 @@ func (c *Client) BasicGetObject(bucket, object string) (*api.GetObjectResult, er // BasicGetObjectToFile - use basic interface to get the given object to the given file path // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the object -// - filePath: the file path to store the object content +// - bucket: the name of the bucket +// - object: the name of the object +// - filePath: the file path to store the object content +// // RETURNS: -// - error: any error if it occurs +// - error: any error if it occurs func (c *Client) BasicGetObjectToFile(bucket, object, filePath string) error { res, err := api.GetObject(c, bucket, object, c.BosContext, nil) if err != nil { @@ -1049,12 +1110,13 @@ func (c *Client) BasicGetObjectToFile(bucket, object, filePath string) error { // GetObjectMeta - get the given object metadata // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the object +// - bucket: the name of the bucket +// - object: the name of the object +// // RETURNS: -// - *api.GetObjectMetaResult: metadata result, for details reference -// https://cloud.baidu.com/doc/BOS/API.html#GetObjectMeta.E6.8E.A5.E5.8F.A3 -// - error: any error if it occurs +// - *api.GetObjectMetaResult: metadata result, for details reference +// https://cloud.baidu.com/doc/BOS/API.html#GetObjectMeta.E6.8E.A5.E5.8F.A3 +// - error: any error if it occurs func (c *Client) GetObjectMeta(bucket, object string) (*api.GetObjectMetaResult, error) { return api.GetObjectMeta(c, bucket, object, c.BosContext) } @@ -1062,12 +1124,13 @@ func (c *Client) GetObjectMeta(bucket, object string) (*api.GetObjectMetaResult, // SelectObject - select the object content // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the object -// - args: the optional arguments to select the object +// - bucket: the name of the bucket +// - object: the name of the object +// - args: the optional arguments to select the object +// // RETURNS: -// - *api.SelectObjectResult: select object result -// - error: any error if it occurs +// - *api.SelectObjectResult: select object result +// - error: any error if it occurs func (c *Client) SelectObject(bucket, object string, args *api.SelectObjectArgs) (*api.SelectObjectResult, error) { return api.SelectObject(c, bucket, object, args, c.BosContext) } @@ -1075,13 +1138,14 @@ func (c *Client) SelectObject(bucket, object string, args *api.SelectObjectArgs) // FetchObject - fetch the object content from the given source and store // // PARAMS: -// - bucket: the name of the bucket to store -// - object: the name of the object to store -// - source: fetch source url -// - args: the optional arguments to fetch the object +// - bucket: the name of the bucket to store +// - object: the name of the object to store +// - source: fetch source url +// - args: the optional arguments to fetch the object +// // RETURNS: -// - *api.FetchObjectResult: result struct with Code, Message, RequestId and JobId fields -// - error: any error if it occurs +// - *api.FetchObjectResult: result struct with Code, Message, RequestId and JobId fields +// - error: any error if it occurs func (c *Client) FetchObject(bucket, object, source string, args *api.FetchObjectArgs) (*api.FetchObjectResult, error) { return api.FetchObject(c, bucket, object, source, args, c.BosContext) @@ -1090,12 +1154,13 @@ func (c *Client) FetchObject(bucket, object, source string, // BasicFetchObject - the basic interface of the fetch object api // // PARAMS: -// - bucket: the name of the bucket to store -// - object: the name of the object to store -// - source: fetch source url +// - bucket: the name of the bucket to store +// - object: the name of the object to store +// - source: fetch source url +// // RETURNS: -// - *api.FetchObjectResult: result struct with Code, Message, RequestId and JobId fields -// - error: any error if it occurs +// - *api.FetchObjectResult: result struct with Code, Message, RequestId and JobId fields +// - error: any error if it occurs func (c *Client) BasicFetchObject(bucket, object, source string) (*api.FetchObjectResult, error) { return api.FetchObject(c, bucket, object, source, nil, c.BosContext) } @@ -1103,30 +1168,37 @@ func (c *Client) BasicFetchObject(bucket, object, source string) (*api.FetchObje // SimpleFetchObject - fetch object with simple arguments interface // // PARAMS: -// - bucket: the name of the bucket to store -// - object: the name of the object to store -// - source: fetch source url -// - mode: fetch mode which supports sync and async -// - storageClass: the storage class of the fetched object +// - bucket: the name of the bucket to store +// - object: the name of the object to store +// - source: fetch source url +// - mode: fetch mode which supports sync and async +// - storageClass: the storage class of the fetched object +// // RETURNS: -// - *api.FetchObjectResult: result struct with Code, Message, RequestId and JobId fields -// - error: any error if it occurs +// - *api.FetchObjectResult: result struct with Code, Message, RequestId and JobId fields +// - error: any error if it occurs func (c *Client) SimpleFetchObject(bucket, object, source, mode, storageClass string) (*api.FetchObjectResult, error) { - args := &api.FetchObjectArgs{mode, storageClass} + + args := &api.FetchObjectArgs{ + FetchMode: mode, + StorageClass: storageClass, + } + return api.FetchObject(c, bucket, object, source, args, c.BosContext) } // AppendObject - append the given content to a new or existed object which is appendable // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the object -// - content: the append object stream -// - args: the optional arguments to append object +// - bucket: the name of the bucket +// - object: the name of the object +// - content: the append object stream +// - args: the optional arguments to append object +// // RETURNS: -// - *api.AppendObjectResult: the result of the appended object -// - error: any error if it occurs +// - *api.AppendObjectResult: the result of the appended object +// - error: any error if it occurs func (c *Client) AppendObject(bucket, object string, content *bce.Body, args *api.AppendObjectArgs) (*api.AppendObjectResult, error) { return api.AppendObject(c, bucket, object, content, args, c.BosContext) @@ -1135,13 +1207,14 @@ func (c *Client) AppendObject(bucket, object string, content *bce.Body, // SimpleAppendObject - the interface to append object with simple offset argument // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the object -// - content: the append object stream -// - offset: the offset of where to append +// - bucket: the name of the bucket +// - object: the name of the object +// - content: the append object stream +// - offset: the offset of where to append +// // RETURNS: -// - *api.AppendObjectResult: the result of the appended object -// - error: any error if it occurs +// - *api.AppendObjectResult: the result of the appended object +// - error: any error if it occurs func (c *Client) SimpleAppendObject(bucket, object string, content *bce.Body, offset int64) (*api.AppendObjectResult, error) { return api.AppendObject(c, bucket, object, content, &api.AppendObjectArgs{Offset: offset}, c.BosContext) @@ -1150,13 +1223,14 @@ func (c *Client) SimpleAppendObject(bucket, object string, content *bce.Body, // SimpleAppendObjectFromString - the simple interface of appending an object from a string // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the object -// - content: the object string to append -// - offset: the offset of where to append +// - bucket: the name of the bucket +// - object: the name of the object +// - content: the object string to append +// - offset: the offset of where to append +// // RETURNS: -// - *api.AppendObjectResult: the result of the appended object -// - error: any error if it occurs +// - *api.AppendObjectResult: the result of the appended object +// - error: any error if it occurs func (c *Client) SimpleAppendObjectFromString(bucket, object, content string, offset int64) (*api.AppendObjectResult, error) { body, err := bce.NewBodyFromString(content) @@ -1169,13 +1243,14 @@ func (c *Client) SimpleAppendObjectFromString(bucket, object, content string, // SimpleAppendObjectFromFile - the simple interface of appending an object from a file // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the object -// - filePath: the full file path -// - offset: the offset of where to append +// - bucket: the name of the bucket +// - object: the name of the object +// - filePath: the full file path +// - offset: the offset of where to append +// // RETURNS: -// - *api.AppendObjectResult: the result of the appended object -// - error: any error if it occurs +// - *api.AppendObjectResult: the result of the appended object +// - error: any error if it occurs func (c *Client) SimpleAppendObjectFromFile(bucket, object, filePath string, offset int64) (*api.AppendObjectResult, error) { body, err := bce.NewBodyFromFile(filePath) @@ -1188,10 +1263,11 @@ func (c *Client) SimpleAppendObjectFromFile(bucket, object, filePath string, // DeleteObject - delete the given object // // PARAMS: -// - bucket: the name of the bucket to delete -// - object: the name of the object to delete +// - bucket: the name of the bucket to delete +// - object: the name of the object to delete +// // RETURNS: -// - error: any error if it occurs +// - error: any error if it occurs func (c *Client) DeleteObject(bucket, object string) error { return api.DeleteObject(c, bucket, object, c.BosContext) } @@ -1199,11 +1275,12 @@ func (c *Client) DeleteObject(bucket, object string) error { // DeleteMultipleObjects - delete a list of objects // // PARAMS: -// - bucket: the name of the bucket to delete -// - objectListStream: the object list stream to be deleted +// - bucket: the name of the bucket to delete +// - objectListStream: the object list stream to be deleted +// // RETURNS: -// - *api.DeleteMultipleObjectsResult: the delete information -// - error: any error if it occurs +// - *api.DeleteMultipleObjectsResult: the delete information +// - error: any error if it occurs func (c *Client) DeleteMultipleObjects(bucket string, objectListStream *bce.Body) (*api.DeleteMultipleObjectsResult, error) { return api.DeleteMultipleObjects(c, bucket, objectListStream, c.BosContext) @@ -1212,11 +1289,12 @@ func (c *Client) DeleteMultipleObjects(bucket string, // DeleteMultipleObjectsFromString - delete a list of objects with json format string // // PARAMS: -// - bucket: the name of the bucket to delete -// - objectListString: the object list string to be deleted +// - bucket: the name of the bucket to delete +// - objectListString: the object list string to be deleted +// // RETURNS: -// - *api.DeleteMultipleObjectsResult: the delete information -// - error: any error if it occurs +// - *api.DeleteMultipleObjectsResult: the delete information +// - error: any error if it occurs func (c *Client) DeleteMultipleObjectsFromString(bucket, objectListString string) (*api.DeleteMultipleObjectsResult, error) { body, err := bce.NewBodyFromString(objectListString) @@ -1229,11 +1307,12 @@ func (c *Client) DeleteMultipleObjectsFromString(bucket, // DeleteMultipleObjectsFromStruct - delete a list of objects with object list struct // // PARAMS: -// - bucket: the name of the bucket to delete -// - objectListStruct: the object list struct to be deleted +// - bucket: the name of the bucket to delete +// - objectListStruct: the object list struct to be deleted +// // RETURNS: -// - *api.DeleteMultipleObjectsResult: the delete information -// - error: any error if it occurs +// - *api.DeleteMultipleObjectsResult: the delete information +// - error: any error if it occurs func (c *Client) DeleteMultipleObjectsFromStruct(bucket string, objectListStruct *api.DeleteMultipleObjectsArgs) (*api.DeleteMultipleObjectsResult, error) { jsonBytes, jsonErr := json.Marshal(objectListStruct) @@ -1250,11 +1329,12 @@ func (c *Client) DeleteMultipleObjectsFromStruct(bucket string, // DeleteMultipleObjectsFromKeyList - delete a list of objects with given key string array // // PARAMS: -// - bucket: the name of the bucket to delete -// - keyList: the key string list to be deleted +// - bucket: the name of the bucket to delete +// - keyList: the key string list to be deleted +// // RETURNS: -// - *api.DeleteMultipleObjectsResult: the delete information -// - error: any error if it occurs +// - *api.DeleteMultipleObjectsResult: the delete information +// - error: any error if it occurs func (c *Client) DeleteMultipleObjectsFromKeyList(bucket string, keyList []string) (*api.DeleteMultipleObjectsResult, error) { if len(keyList) == 0 { @@ -1280,14 +1360,15 @@ func (c *Client) DeleteMultipleObjectsFromKeyList(bucket string, // InitiateMultipartUpload - initiate a multipart upload to get a upload ID // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - contentType: the content type of the object to be uploaded which should be specified, -// otherwise use the default(application/octet-stream) -// - args: the optional arguments +// - bucket: the bucket name +// - object: the object name +// - contentType: the content type of the object to be uploaded which should be specified, +// otherwise use the default(application/octet-stream) +// - args: the optional arguments +// // RETURNS: -// - *InitiateMultipartUploadResult: the result data structure -// - error: nil if ok otherwise the specific error +// - *InitiateMultipartUploadResult: the result data structure +// - error: nil if ok otherwise the specific error func (c *Client) InitiateMultipartUpload(bucket, object, contentType string, args *api.InitiateMultipartUploadArgs) (*api.InitiateMultipartUploadResult, error) { return api.InitiateMultipartUpload(c, bucket, object, contentType, args, c.BosContext) @@ -1296,11 +1377,12 @@ func (c *Client) InitiateMultipartUpload(bucket, object, contentType string, // BasicInitiateMultipartUpload - basic interface to initiate a multipart upload // // PARAMS: -// - bucket: the bucket name -// - object: the object name +// - bucket: the bucket name +// - object: the object name +// // RETURNS: -// - *InitiateMultipartUploadResult: the result data structure -// - error: nil if ok otherwise the specific error +// - *InitiateMultipartUploadResult: the result data structure +// - error: nil if ok otherwise the specific error func (c *Client) BasicInitiateMultipartUpload(bucket, object string) (*api.InitiateMultipartUploadResult, error) { return api.InitiateMultipartUpload(c, bucket, object, "", nil, c.BosContext) @@ -1309,15 +1391,16 @@ func (c *Client) BasicInitiateMultipartUpload(bucket, // UploadPart - upload the single part in the multipart upload process // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - uploadId: the multipart upload id -// - partNumber: the current part number -// - content: the uploaded part content -// - args: the optional arguments +// - bucket: the bucket name +// - object: the object name +// - uploadId: the multipart upload id +// - partNumber: the current part number +// - content: the uploaded part content +// - args: the optional arguments +// // RETURNS: -// - string: the etag of the uploaded part -// - error: nil if ok otherwise the specific error +// - string: the etag of the uploaded part +// - error: nil if ok otherwise the specific error func (c *Client) UploadPart(bucket, object, uploadId string, partNumber int, content *bce.Body, args *api.UploadPartArgs) (string, error) { return api.UploadPart(c, bucket, object, uploadId, partNumber, content, args, c.BosContext) @@ -1326,14 +1409,15 @@ func (c *Client) UploadPart(bucket, object, uploadId string, partNumber int, // BasicUploadPart - basic interface to upload the single part in the multipart upload process // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - uploadId: the multipart upload id -// - partNumber: the current part number -// - content: the uploaded part content +// - bucket: the bucket name +// - object: the object name +// - uploadId: the multipart upload id +// - partNumber: the current part number +// - content: the uploaded part content +// // RETURNS: -// - string: the etag of the uploaded part -// - error: nil if ok otherwise the specific error +// - string: the etag of the uploaded part +// - error: nil if ok otherwise the specific error func (c *Client) BasicUploadPart(bucket, object, uploadId string, partNumber int, content *bce.Body) (string, error) { return api.UploadPart(c, bucket, object, uploadId, partNumber, content, nil, c.BosContext) @@ -1342,15 +1426,16 @@ func (c *Client) BasicUploadPart(bucket, object, uploadId string, partNumber int // UploadPartFromBytes - upload the single part in the multipart upload process // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - uploadId: the multipart upload id -// - partNumber: the current part number -// - content: the uploaded part content -// - args: the optional arguments +// - bucket: the bucket name +// - object: the object name +// - uploadId: the multipart upload id +// - partNumber: the current part number +// - content: the uploaded part content +// - args: the optional arguments +// // RETURNS: -// - string: the etag of the uploaded part -// - error: nil if ok otherwise the specific error +// - string: the etag of the uploaded part +// - error: nil if ok otherwise the specific error func (c *Client) UploadPartFromBytes(bucket, object, uploadId string, partNumber int, content []byte, args *api.UploadPartArgs) (string, error) { return api.UploadPartFromBytes(c, bucket, object, uploadId, partNumber, content, args, c.BosContext) @@ -1359,16 +1444,17 @@ func (c *Client) UploadPartFromBytes(bucket, object, uploadId string, partNumber // UploadPartCopy - copy the multipart object // // PARAMS: -// - bucket: the destination bucket name -// - object: the destination object name -// - srcBucket: the source bucket -// - srcObject: the source object -// - uploadId: the multipart upload id -// - partNumber: the current part number -// - args: the optional arguments +// - bucket: the destination bucket name +// - object: the destination object name +// - srcBucket: the source bucket +// - srcObject: the source object +// - uploadId: the multipart upload id +// - partNumber: the current part number +// - args: the optional arguments +// // RETURNS: -// - *CopyObjectResult: the lastModified and eTag of the part -// - error: nil if ok otherwise the specific error +// - *CopyObjectResult: the lastModified and eTag of the part +// - error: nil if ok otherwise the specific error func (c *Client) UploadPartCopy(bucket, object, srcBucket, srcObject, uploadId string, partNumber int, args *api.UploadPartCopyArgs) (*api.CopyObjectResult, error) { source := fmt.Sprintf("/%s/%s", srcBucket, srcObject) @@ -1378,15 +1464,16 @@ func (c *Client) UploadPartCopy(bucket, object, srcBucket, srcObject, uploadId s // BasicUploadPartCopy - basic interface to copy the multipart object // // PARAMS: -// - bucket: the destination bucket name -// - object: the destination object name -// - srcBucket: the source bucket -// - srcObject: the source object -// - uploadId: the multipart upload id -// - partNumber: the current part number +// - bucket: the destination bucket name +// - object: the destination object name +// - srcBucket: the source bucket +// - srcObject: the source object +// - uploadId: the multipart upload id +// - partNumber: the current part number +// // RETURNS: -// - *CopyObjectResult: the lastModified and eTag of the part -// - error: nil if ok otherwise the specific error +// - *CopyObjectResult: the lastModified and eTag of the part +// - error: nil if ok otherwise the specific error func (c *Client) BasicUploadPartCopy(bucket, object, srcBucket, srcObject, uploadId string, partNumber int) (*api.CopyObjectResult, error) { source := fmt.Sprintf("/%s/%s", srcBucket, srcObject) @@ -1396,14 +1483,15 @@ func (c *Client) BasicUploadPartCopy(bucket, object, srcBucket, srcObject, uploa // CompleteMultipartUpload - finish a multipart upload operation with parts stream // // PARAMS: -// - bucket: the destination bucket name -// - object: the destination object name -// - uploadId: the multipart upload id -// - parts: all parts info stream -// - meta: user defined meta data +// - bucket: the destination bucket name +// - object: the destination object name +// - uploadId: the multipart upload id +// - parts: all parts info stream +// - meta: user defined meta data +// // RETURNS: -// - *CompleteMultipartUploadResult: the result data -// - error: nil if ok otherwise the specific error +// - *CompleteMultipartUploadResult: the result data +// - error: nil if ok otherwise the specific error func (c *Client) CompleteMultipartUpload(bucket, object, uploadId string, body *bce.Body, args *api.CompleteMultipartUploadArgs) (*api.CompleteMultipartUploadResult, error) { return api.CompleteMultipartUpload(c, bucket, object, uploadId, body, args, c.BosContext) @@ -1412,13 +1500,14 @@ func (c *Client) CompleteMultipartUpload(bucket, object, uploadId string, // CompleteMultipartUploadFromStruct - finish a multipart upload operation with parts struct // // PARAMS: -// - bucket: the destination bucket name -// - object: the destination object name -// - uploadId: the multipart upload id -// - args: args info struct object +// - bucket: the destination bucket name +// - object: the destination object name +// - uploadId: the multipart upload id +// - args: args info struct object +// // RETURNS: -// - *CompleteMultipartUploadResult: the result data -// - error: nil if ok otherwise the specific error +// - *CompleteMultipartUploadResult: the result data +// - error: nil if ok otherwise the specific error func (c *Client) CompleteMultipartUploadFromStruct(bucket, object, uploadId string, args *api.CompleteMultipartUploadArgs) (*api.CompleteMultipartUploadResult, error) { jsonBytes, jsonErr := json.Marshal(args) @@ -1435,11 +1524,12 @@ func (c *Client) CompleteMultipartUploadFromStruct(bucket, object, uploadId stri // AbortMultipartUpload - abort a multipart upload operation // // PARAMS: -// - bucket: the destination bucket name -// - object: the destination object name -// - uploadId: the multipart upload id +// - bucket: the destination bucket name +// - object: the destination object name +// - uploadId: the multipart upload id +// // RETURNS: -// - error: nil if ok otherwise the specific error +// - error: nil if ok otherwise the specific error func (c *Client) AbortMultipartUpload(bucket, object, uploadId string) error { return api.AbortMultipartUpload(c, bucket, object, uploadId, c.BosContext) } @@ -1447,13 +1537,14 @@ func (c *Client) AbortMultipartUpload(bucket, object, uploadId string) error { // ListParts - list the successfully uploaded parts info by upload id // // PARAMS: -// - bucket: the destination bucket name -// - object: the destination object name -// - uploadId: the multipart upload id -// - args: the optional arguments +// - bucket: the destination bucket name +// - object: the destination object name +// - uploadId: the multipart upload id +// - args: the optional arguments +// // RETURNS: -// - *ListPartsResult: the uploaded parts info result -// - error: nil if ok otherwise the specific error +// - *ListPartsResult: the uploaded parts info result +// - error: nil if ok otherwise the specific error func (c *Client) ListParts(bucket, object, uploadId string, args *api.ListPartsArgs) (*api.ListPartsResult, error) { return api.ListParts(c, bucket, object, uploadId, args, c.BosContext) @@ -1462,12 +1553,13 @@ func (c *Client) ListParts(bucket, object, uploadId string, // BasicListParts - basic interface to list the successfully uploaded parts info by upload id // // PARAMS: -// - bucket: the destination bucket name -// - object: the destination object name -// - uploadId: the multipart upload id +// - bucket: the destination bucket name +// - object: the destination object name +// - uploadId: the multipart upload id +// // RETURNS: -// - *ListPartsResult: the uploaded parts info result -// - error: nil if ok otherwise the specific error +// - *ListPartsResult: the uploaded parts info result +// - error: nil if ok otherwise the specific error func (c *Client) BasicListParts(bucket, object, uploadId string) (*api.ListPartsResult, error) { return api.ListParts(c, bucket, object, uploadId, nil, c.BosContext) } @@ -1475,11 +1567,12 @@ func (c *Client) BasicListParts(bucket, object, uploadId string) (*api.ListParts // ListMultipartUploads - list the unfinished uploaded parts of the given bucket // // PARAMS: -// - bucket: the destination bucket name -// - args: the optional arguments +// - bucket: the destination bucket name +// - args: the optional arguments +// // RETURNS: -// - *ListMultipartUploadsResult: the unfinished uploaded parts info result -// - error: nil if ok otherwise the specific error +// - *ListMultipartUploadsResult: the unfinished uploaded parts info result +// - error: nil if ok otherwise the specific error func (c *Client) ListMultipartUploads(bucket string, args *api.ListMultipartUploadsArgs) (*api.ListMultipartUploadsResult, error) { return api.ListMultipartUploads(c, bucket, args, c.BosContext) @@ -1488,10 +1581,11 @@ func (c *Client) ListMultipartUploads(bucket string, // BasicListMultipartUploads - basic interface to list the unfinished uploaded parts // // PARAMS: -// - bucket: the destination bucket name +// - bucket: the destination bucket name +// // RETURNS: -// - *ListMultipartUploadsResult: the unfinished uploaded parts info result -// - error: nil if ok otherwise the specific error +// - *ListMultipartUploadsResult: the unfinished uploaded parts info result +// - error: nil if ok otherwise the specific error func (c *Client) BasicListMultipartUploads(bucket string) ( *api.ListMultipartUploadsResult, error) { return api.ListMultipartUploads(c, bucket, nil, c.BosContext) @@ -1500,12 +1594,13 @@ func (c *Client) BasicListMultipartUploads(bucket string) ( // UploadSuperFile - parallel upload the super file by using the multipart upload interface // // PARAMS: -// - bucket: the destination bucket name -// - object: the destination object name -// - fileName: the local full path filename of the super file -// - storageClass: the storage class to be set to the uploaded file +// - bucket: the destination bucket name +// - object: the destination object name +// - fileName: the local full path filename of the super file +// - storageClass: the storage class to be set to the uploaded file +// // RETURNS: -// - error: nil if ok otherwise the specific error +// - error: nil if ok otherwise the specific error func (c *Client) UploadSuperFile(bucket, object, fileName, storageClass string) error { // Get the file size and check the size for multipart upload file, fileErr := os.Open(fileName) @@ -1605,11 +1700,12 @@ func (c *Client) UploadSuperFile(bucket, object, fileName, storageClass string) // DownloadSuperFile - parallel download the super file using the get object with range // // PARAMS: -// - bucket: the destination bucket name -// - object: the destination object name -// - fileName: the local full path filename to store the object +// - bucket: the destination bucket name +// - object: the destination object name +// - fileName: the local full path filename to store the object +// // RETURNS: -// - error: nil if ok otherwise the specific error +// - error: nil if ok otherwise the specific error func (c *Client) DownloadSuperFile(bucket, object, fileName string) (err error) { file, err := os.OpenFile(fileName, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644) if err != nil { @@ -1700,14 +1796,15 @@ func (c *Client) DownloadSuperFile(bucket, object, fileName string) (err error) // GeneratePresignedUrl - generate an authorization url with expire time and optional arguments // // PARAMS: -// - bucket: the target bucket name -// - object: the target object name -// - expireInSeconds: the expire time in seconds of the signed url -// - method: optional sign method, default is GET -// - headers: optional sign headers, default just set the Host -// - params: optional sign params, default is empty +// - bucket: the target bucket name +// - object: the target object name +// - expireInSeconds: the expire time in seconds of the signed url +// - method: optional sign method, default is GET +// - headers: optional sign headers, default just set the Host +// - params: optional sign params, default is empty +// // RETURNS: -// - string: the presigned url with authorization string +// - string: the presigned url with authorization string func (c *Client) GeneratePresignedUrl(bucket, object string, expireInSeconds int, method string, headers, params map[string]string) string { return api.GeneratePresignedUrl(c.Config, c.Signer, bucket, object, @@ -1723,11 +1820,12 @@ func (c *Client) GeneratePresignedUrlPathStyle(bucket, object string, expireInSe // BasicGeneratePresignedUrl - basic interface to generate an authorization url with expire time // // PARAMS: -// - bucket: the target bucket name -// - object: the target object name -// - expireInSeconds: the expire time in seconds of the signed url +// - bucket: the target bucket name +// - object: the target object name +// - expireInSeconds: the expire time in seconds of the signed url +// // RETURNS: -// - string: the presigned url with authorization string +// - string: the presigned url with authorization string func (c *Client) BasicGeneratePresignedUrl(bucket, object string, expireInSeconds int) string { return api.GeneratePresignedUrl(c.Config, c.Signer, bucket, object, expireInSeconds, "", nil, nil) @@ -1736,11 +1834,12 @@ func (c *Client) BasicGeneratePresignedUrl(bucket, object string, expireInSecond // PutObjectAcl - set the ACL of the given object // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - aclBody: the acl json body stream +// - bucket: the bucket name +// - object: the object name +// - aclBody: the acl json body stream +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutObjectAcl(bucket, object string, aclBody *bce.Body) error { return api.PutObjectAcl(c, bucket, object, "", nil, nil, aclBody, c.BosContext) } @@ -1748,11 +1847,12 @@ func (c *Client) PutObjectAcl(bucket, object string, aclBody *bce.Body) error { // PutObjectAclFromCanned - set the canned acl of the given object // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - cannedAcl: the cannedAcl string +// - bucket: the bucket name +// - object: the object name +// - cannedAcl: the cannedAcl string +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutObjectAclFromCanned(bucket, object, cannedAcl string) error { return api.PutObjectAcl(c, bucket, object, cannedAcl, nil, nil, nil, c.BosContext) } @@ -1760,11 +1860,12 @@ func (c *Client) PutObjectAclFromCanned(bucket, object, cannedAcl string) error // PutObjectAclGrantRead - set the canned grant read acl of the given object // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - ids: the user id list to grant read for this object +// - bucket: the bucket name +// - object: the object name +// - ids: the user id list to grant read for this object +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutObjectAclGrantRead(bucket, object string, ids ...string) error { return api.PutObjectAcl(c, bucket, object, "", ids, nil, nil, c.BosContext) } @@ -1772,11 +1873,12 @@ func (c *Client) PutObjectAclGrantRead(bucket, object string, ids ...string) err // PutObjectAclGrantFullControl - set the canned grant full-control acl of the given object // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - ids: the user id list to grant full-control for this object +// - bucket: the bucket name +// - object: the object name +// - ids: the user id list to grant full-control for this object +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutObjectAclGrantFullControl(bucket, object string, ids ...string) error { return api.PutObjectAcl(c, bucket, object, "", nil, ids, nil, c.BosContext) } @@ -1784,11 +1886,12 @@ func (c *Client) PutObjectAclGrantFullControl(bucket, object string, ids ...stri // PutObjectAclFromFile - set the acl of the given object with acl json file name // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - aclFile: the acl file name +// - bucket: the bucket name +// - object: the object name +// - aclFile: the acl file name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutObjectAclFromFile(bucket, object, aclFile string) error { body, err := bce.NewBodyFromFile(aclFile) if err != nil { @@ -1800,11 +1903,12 @@ func (c *Client) PutObjectAclFromFile(bucket, object, aclFile string) error { // PutObjectAclFromString - set the acl of the given object with acl json string // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - aclString: the acl string with json format +// - bucket: the bucket name +// - object: the object name +// - aclString: the acl string with json format +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutObjectAclFromString(bucket, object, aclString string) error { body, err := bce.NewBodyFromString(aclString) if err != nil { @@ -1816,10 +1920,11 @@ func (c *Client) PutObjectAclFromString(bucket, object, aclString string) error // PutObjectAclFromStruct - set the acl of the given object with acl data structure // // PARAMS: -// - bucket: the bucket name -// - aclObj: the acl struct object +// - bucket: the bucket name +// - aclObj: the acl struct object +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutObjectAclFromStruct(bucket, object string, aclObj *api.PutObjectAclArgs) error { jsonBytes, jsonErr := json.Marshal(aclObj) if jsonErr != nil { @@ -1835,11 +1940,12 @@ func (c *Client) PutObjectAclFromStruct(bucket, object string, aclObj *api.PutOb // GetObjectAcl - get the acl of the given object // // PARAMS: -// - bucket: the bucket name -// - object: the object name +// - bucket: the bucket name +// - object: the object name +// // RETURNS: -// - *api.GetObjectAclResult: the result of the object acl -// - error: nil if success otherwise the specific error +// - *api.GetObjectAclResult: the result of the object acl +// - error: nil if success otherwise the specific error func (c *Client) GetObjectAcl(bucket, object string) (*api.GetObjectAclResult, error) { return api.GetObjectAcl(c, bucket, object, c.BosContext) } @@ -1847,10 +1953,11 @@ func (c *Client) GetObjectAcl(bucket, object string) (*api.GetObjectAclResult, e // DeleteObjectAcl - delete the acl of the given object // // PARAMS: -// - bucket: the bucket name -// - object: the object name +// - bucket: the bucket name +// - object: the object name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) DeleteObjectAcl(bucket, object string) error { return api.DeleteObjectAcl(c, bucket, object, c.BosContext) } @@ -1858,12 +1965,13 @@ func (c *Client) DeleteObjectAcl(bucket, object string) error { // RestoreObject - restore the archive object // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - restoreDays: the effective time of restore -// - restoreTier: the tier of restore +// - bucket: the bucket name +// - object: the object name +// - restoreDays: the effective time of restore +// - restoreTier: the tier of restore +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) RestoreObject(bucket string, object string, restoreDays int, restoreTier string) error { if _, ok := api.VALID_RESTORE_TIER[restoreTier]; !ok { return errors.New("invalid restore tier") @@ -1883,10 +1991,11 @@ func (c *Client) RestoreObject(bucket string, object string, restoreDays int, re // PutBucketTrash - put the bucket trash // // PARAMS: -// - bucket: the bucket name -// - trashReq: the trash request +// - bucket: the bucket name +// - trashReq: the trash request +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketTrash(bucket string, trashReq api.PutBucketTrashReq) error { return api.PutBucketTrash(c, bucket, trashReq, c.BosContext) } @@ -1894,10 +2003,11 @@ func (c *Client) PutBucketTrash(bucket string, trashReq api.PutBucketTrashReq) e // GetBucketTrash - get the bucket trash // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - *api.GetBucketTrashResult,: the result of the bucket trash -// - error: nil if success otherwise the specific error +// - *api.GetBucketTrashResult,: the result of the bucket trash +// - error: nil if success otherwise the specific error func (c *Client) GetBucketTrash(bucket string) (*api.GetBucketTrashResult, error) { return api.GetBucketTrash(c, bucket, c.BosContext) } @@ -1905,9 +2015,10 @@ func (c *Client) GetBucketTrash(bucket string) (*api.GetBucketTrashResult, error // DeleteBucketTrash - delete the trash of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) DeleteBucketTrash(bucket string) error { return api.DeleteBucketTrash(c, bucket, c.BosContext) } @@ -1915,10 +2026,11 @@ func (c *Client) DeleteBucketTrash(bucket string) error { // PutBucketNotification - put the bucket notification // // PARAMS: -// - bucket: the bucket name -// - putBucketNotificationReq: the bucket notification request +// - bucket: the bucket name +// - putBucketNotificationReq: the bucket notification request +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) PutBucketNotification(bucket string, putBucketNotificationReq api.PutBucketNotificationReq) error { return api.PutBucketNotification(c, bucket, putBucketNotificationReq, c.BosContext) } @@ -1926,10 +2038,11 @@ func (c *Client) PutBucketNotification(bucket string, putBucketNotificationReq a // GetBucketNotification - get the bucket notification // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - *api.PutBucketNotificationReq,: the result of the bucket notification -// - error: nil if success otherwise the specific error +// - *api.PutBucketNotificationReq,: the result of the bucket notification +// - error: nil if success otherwise the specific error func (c *Client) GetBucketNotification(bucket string) (*api.PutBucketNotificationReq, error) { return api.GetBucketNotification(c, bucket, c.BosContext) } @@ -1937,9 +2050,10 @@ func (c *Client) GetBucketNotification(bucket string) (*api.PutBucketNotificatio // DeleteBucketNotification - delete the notification of the given bucket // // PARAMS: -// - bucket: the bucket name +// - bucket: the bucket name +// // RETURNS: -// - error: nil if success otherwise the specific error +// - error: nil if success otherwise the specific error func (c *Client) DeleteBucketNotification(bucket string) error { return api.DeleteBucketNotification(c, bucket, c.BosContext) } @@ -1947,14 +2061,15 @@ func (c *Client) DeleteBucketNotification(bucket string) error { // ParallelUpload - auto multipart upload object // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - filename: the filename -// - contentType: the content type default(application/octet-stream) -// - args: the bucket name nil using default +// - bucket: the bucket name +// - object: the object name +// - filename: the filename +// - contentType: the content type default(application/octet-stream) +// - args: the bucket name nil using default +// // RETURNS: -// - *api.CompleteMultipartUploadResult: multipart upload result -// - error: nil if success otherwise the specific error +// - *api.CompleteMultipartUploadResult: multipart upload result +// - error: nil if success otherwise the specific error func (c *Client) ParallelUpload(bucket string, object string, filename string, contentType string, args *api.InitiateMultipartUploadArgs) (*api.CompleteMultipartUploadResult, error) { initiateMultipartUploadResult, err := api.InitiateMultipartUpload(c, bucket, object, contentType, args, c.BosContext) @@ -1979,13 +2094,14 @@ func (c *Client) ParallelUpload(bucket string, object string, filename string, c // parallelPartUpload - single part upload // // PARAMS: -// - bucket: the bucket name -// - object: the object name -// - filename: the uploadId -// - uploadId: the uploadId +// - bucket: the bucket name +// - object: the object name +// - filename: the uploadId +// - uploadId: the uploadId +// // RETURNS: -// - []api.UploadInfoType: multipart upload result -// - error: nil if success otherwise the specific error +// - []api.UploadInfoType: multipart upload result +// - error: nil if success otherwise the specific error func (c *Client) parallelPartUpload(bucket string, object string, filename string, uploadId string) ([]api.UploadInfoType, error) { file, err := os.Open(filename) if err != nil { @@ -2055,14 +2171,14 @@ func (c *Client) parallelPartUpload(bucket string, object string, filename strin // singlePartUpload - single part upload // // PARAMS: -// - pararelChan: the pararelChan -// - errChan: the error chan -// - result: the upload result chan -// - bucket: the bucket name -// - object: the object name -// - uploadId: the uploadId -// - partNumber: the part number of the object -// - content: the content of current part +// - pararelChan: the pararelChan +// - errChan: the error chan +// - result: the upload result chan +// - bucket: the bucket name +// - object: the object name +// - uploadId: the uploadId +// - partNumber: the part number of the object +// - content: the content of current part func (c *Client) singlePartUpload( bucket string, object string, uploadId string, partNumber int, content *bce.Body, @@ -2092,15 +2208,16 @@ func (c *Client) singlePartUpload( // ParallelCopy - auto multipart copy object // // PARAMS: -// - srcBucketName: the src bucket name -// - srcObjectName: the src object name -// - destBucketName: the dest bucket name -// - destObjectName: the dest object name -// - args: the copy args -// - srcClient: the src region client +// - srcBucketName: the src bucket name +// - srcObjectName: the src object name +// - destBucketName: the dest bucket name +// - destObjectName: the dest object name +// - args: the copy args +// - srcClient: the src region client +// // RETURNS: -// - *api.CompleteMultipartUploadResult: multipart upload result -// - error: nil if success otherwise the specific error +// - *api.CompleteMultipartUploadResult: multipart upload result +// - error: nil if success otherwise the specific error func (c *Client) ParallelCopy(srcBucketName string, srcObjectName string, destBucketName string, destObjectName string, args *api.MultiCopyObjectArgs, srcClient *Client) (*api.CompleteMultipartUploadResult, error) { @@ -2149,14 +2266,15 @@ func (c *Client) ParallelCopy(srcBucketName string, srcObjectName string, // parallelPartCopy - parallel part copy // // PARAMS: -// - srcMeta: the copy source object meta -// - source: the copy source -// - bucket: the dest bucket name -// - object: the dest object name -// - uploadId: the uploadId +// - srcMeta: the copy source object meta +// - source: the copy source +// - bucket: the dest bucket name +// - object: the dest object name +// - uploadId: the uploadId +// // RETURNS: -// - []api.UploadInfoType: multipart upload result -// - error: nil if success otherwise the specific error +// - []api.UploadInfoType: multipart upload result +// - error: nil if success otherwise the specific error func (c *Client) parallelPartCopy(srcMeta api.GetObjectMetaResult, source string, bucket string, object string, uploadId string) ([]api.UploadInfoType, error) { var err error size := srcMeta.ContentLength @@ -2217,15 +2335,15 @@ func (c *Client) parallelPartCopy(srcMeta api.GetObjectMetaResult, source string // singlePartCopy - single part copy // // PARAMS: -// - pararelChan: the pararelChan -// - errChan: the error chan -// - result: the upload result chan -// - source: the copy source -// - bucket: the bucket name -// - object: the object name -// - uploadId: the uploadId -// - partNumber: the part number of the object -// - args: the copy args +// - pararelChan: the pararelChan +// - errChan: the error chan +// - result: the upload result chan +// - source: the copy source +// - bucket: the bucket name +// - object: the object name +// - uploadId: the uploadId +// - partNumber: the part number of the object +// - args: the copy args func (c *Client) singlePartCopy(source string, bucket string, object string, uploadId string, partNumber int, args *api.UploadPartCopyArgs, parallelChan chan int, errChan chan error, result chan api.UploadInfoType) { @@ -2251,12 +2369,13 @@ func (c *Client) singlePartCopy(source string, bucket string, object string, upl // PutSymlink - create symlink for exist target object // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the object -// - symlinkKey: the name of the symlink -// - symlinkArgs: the optional arguments +// - bucket: the name of the bucket +// - object: the name of the object +// - symlinkKey: the name of the symlink +// - symlinkArgs: the optional arguments +// // RETURNS: -// - error: the put error if any occurs +// - error: the put error if any occurs func (c *Client) PutSymlink(bucket string, object string, symlinkKey string, symlinkArgs *api.PutSymlinkArgs) error { return api.PutObjectSymlink(c, bucket, object, symlinkKey, symlinkArgs, c.BosContext) } @@ -2264,11 +2383,12 @@ func (c *Client) PutSymlink(bucket string, object string, symlinkKey string, sym // PutSymlink - create symlink for exist target object // // PARAMS: -// - bucket: the name of the bucket -// - object: the name of the symlink +// - bucket: the name of the bucket +// - object: the name of the symlink +// // RETURNS: -// - string: the target of the symlink -// - error: the put error if any occurs +// - string: the target of the symlink +// - error: the put error if any occurs func (c *Client) GetSymlink(bucket string, object string) (string, error) { return api.GetObjectSymlink(c, bucket, object, c.BosContext) }