-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5ca9de
commit c74b4e8
Showing
7 changed files
with
198 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package sample | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/aliyun/aliyun-oss-go-sdk/oss" | ||
) | ||
|
||
// BucketResourceGroupSample shows how to set and get the bucket's resource group. | ||
func BucketResourceGroupSample() { | ||
// New client | ||
client, err := oss.New(endpoint, accessID, accessKey) | ||
if err != nil { | ||
HandleError(err) | ||
} | ||
|
||
// Create the bucket with default parameters | ||
err = client.CreateBucket(bucketName) | ||
if err != nil { | ||
HandleError(err) | ||
} | ||
|
||
// Get bucket's resource group. | ||
result, err := client.GetBucketResourceGroup(bucketName) | ||
if err != nil { | ||
HandleError(err) | ||
} | ||
|
||
fmt.Printf("Resource Group Id:%s\n", result.ResourceGroupId) | ||
|
||
// Set bucket's resource group. | ||
resourceGroup := oss.PutBucketResourceGroup{ | ||
ResourceGroupId: "rg-aek27tc********", | ||
} | ||
err = client.PutBucketResourceGroup(bucketName, resourceGroup) | ||
if err != nil { | ||
HandleError(err) | ||
} | ||
|
||
fmt.Println("Bucket Resource Group Set Success!") | ||
|
||
fmt.Println("BucketResourceGroupSample completed") | ||
} |