You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
768 B
30 lines
768 B
package sts_test
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"yunyan/sys/aliyun/sts"
|
|
)
|
|
|
|
// oss: #对象存储
|
|
// Endpoint: https://oss-ap-southeast-1.aliyuncs.com
|
|
// AccessKeyId: xxxxxxxxxxxxx
|
|
// AccessKeySecret: xxxxxxxxxxxxxxxxxxx
|
|
// BucketName: dpmobj
|
|
|
|
func Test_STS(t *testing.T) {
|
|
sys, err := sts.NewSys(
|
|
sts.SetRegionId("cn-shenzhen"),
|
|
sts.SetAccessKeyId("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
|
|
sts.SetAccessKeySecret("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
|
|
)
|
|
if err != nil {
|
|
fmt.Printf("初始化OSS 系统失败 err:%v", err)
|
|
return
|
|
} else {
|
|
fmt.Printf("初始化OSS 系统成功")
|
|
auth, err := sys.AssumeRole("xxxxxxxxxxxxxxxxxxxxxxxxxxx", "SessionTest")
|
|
fmt.Printf("初始化OSS AssumeRole auth:%+v err:%v", auth, err)
|
|
}
|
|
}
|
|
|