From e848f6307d7c08a4e233c329a474e322a06f7053 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 13:26:27 +0000 Subject: [PATCH] build(deps): bump github.com/alibabacloud-go/darabonba-openapi/v2 Bumps [github.com/alibabacloud-go/darabonba-openapi/v2](https://github.com/alibabacloud-go/darabonba-openapi) from 2.0.2 to 2.0.5. - [Release notes](https://github.com/alibabacloud-go/darabonba-openapi/releases) - [Changelog](https://github.com/alibabacloud-go/darabonba-openapi/blob/master/ChangeLog.txt) - [Commits](https://github.com/alibabacloud-go/darabonba-openapi/compare/v2.0.2...v2.0.5) --- updated-dependencies: - dependency-name: github.com/alibabacloud-go/darabonba-openapi/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 8 +- go.sum | 13 +- .../darabonba-openapi/v2/client/client.go | 96 ++++++--- .../tea-utils/v2/service/service.go | 55 ++++- .../tea-utils/v2/service/util.go | 52 ----- .../alibabacloud-go/tea-xml/LICENSE | 201 ++++++++++++++++++ .../credentials/access_key_credential.go | 9 + .../credentials/bearer_token_credential.go | 8 + .../credentials-go/credentials/credential.go | 1 + .../credentials/credential_model.go | 50 +++++ .../credentials/ecs_ram_role.go | 16 ++ .../credentials/oidc_credential.go | 16 ++ .../credentials/rsa_key_pair_credential.go | 16 ++ .../credentials/sts_credential.go | 10 + .../credentials/sts_role_arn_credential.go | 16 ++ .../credentials/uri_credential.go | 16 ++ vendor/modules.txt | 8 +- 17 files changed, 490 insertions(+), 101 deletions(-) delete mode 100644 vendor/github.com/alibabacloud-go/tea-utils/v2/service/util.go create mode 100644 vendor/github.com/alibabacloud-go/tea-xml/LICENSE create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/credential_model.go diff --git a/go.mod b/go.mod index 2b2aedd5..41cd8c00 100644 --- a/go.mod +++ b/go.mod @@ -7,12 +7,12 @@ require ( github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/provider v0.0.0 github.com/alibabacloud-go/cs-20151215/v3 v3.0.35 github.com/alibabacloud-go/darabonba-openapi v0.2.1 - github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.2 + github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.5 github.com/alibabacloud-go/ram-20150501 v1.0.2 github.com/alibabacloud-go/sts-20150401 v1.1.0 github.com/alibabacloud-go/tea v1.2.1 github.com/aliyun/alibaba-cloud-sdk-go v1.62.156 - github.com/aliyun/credentials-go v1.3.0 + github.com/aliyun/credentials-go v1.3.1 github.com/briandowns/spinner v1.23.0 github.com/fatih/color v1.15.0 github.com/json-iterator/go v1.1.12 // indirect @@ -38,8 +38,8 @@ require ( github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect - github.com/alibabacloud-go/tea-utils/v2 v2.0.1 // indirect - github.com/alibabacloud-go/tea-xml v1.1.2 // indirect + github.com/alibabacloud-go/tea-utils/v2 v2.0.4 // indirect + github.com/alibabacloud-go/tea-xml v1.1.3 // indirect github.com/clbanning/mxj/v2 v2.5.6 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect diff --git a/go.sum b/go.sum index a63d801c..e6935398 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,9 @@ github.com/alibabacloud-go/darabonba-openapi v0.1.7/go.mod h1:6FV1Bt1AItYIlC2rVo github.com/alibabacloud-go/darabonba-openapi v0.1.18/go.mod h1:PB4HffMhJVmAgNKNq3wYbTUlFvPgxJpTzd1F5pTuUsc= github.com/alibabacloud-go/darabonba-openapi v0.2.1 h1:WyzxxKvhdVDlwpAMOHgAiCJ+NXa6g5ZWPFEzaK/ewwY= github.com/alibabacloud-go/darabonba-openapi v0.2.1/go.mod h1:zXOqLbpIqq543oioL9IuuZYOQgHQ5B8/n5OPrnko8aY= -github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.2 h1:2kR1YkvQloHUstmPcG0Sjk24zTKbza7izzJfJNwBFSs= github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.2/go.mod h1:5JHVmnHvGzR2wNdgaW1zDLQG8kOC4Uec8ubkMogW7OQ= +github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.5 h1:yyolbgHfV2Tp91vMjO/CF5aOxKG+UgdVAeUoloEQI3E= +github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.5/go.mod h1:kUe8JqFmoVU7lfBauaDD5taFaW7mBI+xVsyHutYtabg= github.com/alibabacloud-go/darabonba-string v1.0.0/go.mod h1:93cTfV3vuPhhEwGGpKKqhVW4jLe7tDpo3LUM0i0g6mA= github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 h1:NqugFkGxx1TXSh/pBcU00Y6bljgDPaFdh5MUSeJ7e50= github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY= @@ -40,15 +41,17 @@ github.com/alibabacloud-go/tea-utils v1.4.3/go.mod h1:KNcT0oXlZZxOXINnZBs6YvgOd5 github.com/alibabacloud-go/tea-utils v1.4.5 h1:h0/6Xd2f3bPE4XHTvkpjwxowIwRCJAJOqY6Eq8f3zfA= github.com/alibabacloud-go/tea-utils v1.4.5/go.mod h1:KNcT0oXlZZxOXINnZBs6YvgOd5aYp9U67G+E3R8fcQw= github.com/alibabacloud-go/tea-utils/v2 v2.0.0/go.mod h1:U5MTY10WwlquGPS34DOeomUGBB0gXbLueiq5Trwu0C4= -github.com/alibabacloud-go/tea-utils/v2 v2.0.1 h1:K6kwgo+UiYx+/kr6CO0PN5ACZDzE3nnn9d77215AkTs= github.com/alibabacloud-go/tea-utils/v2 v2.0.1/go.mod h1:U5MTY10WwlquGPS34DOeomUGBB0gXbLueiq5Trwu0C4= -github.com/alibabacloud-go/tea-xml v1.1.2 h1:oLxa7JUXm2EDFzMg+7oRsYc+kutgCVwm+bZlhhmvW5M= +github.com/alibabacloud-go/tea-utils/v2 v2.0.4 h1:SoFgjJuO7pze88j9RBJNbKb7AgTS52O+J5ITxc00lCs= +github.com/alibabacloud-go/tea-utils/v2 v2.0.4/go.mod h1:sj1PbjPodAVTqGTA3olprfeeqqmwD0A5OQz94o9EuXQ= github.com/alibabacloud-go/tea-xml v1.1.2/go.mod h1:Rq08vgCcCAjHyRi/M7xlHKUykZCEtyBy9+DPF6GgEu8= +github.com/alibabacloud-go/tea-xml v1.1.3 h1:7LYnm+JbOq2B+T/B0fHC4Ies4/FofC4zHzYtqw7dgt0= +github.com/alibabacloud-go/tea-xml v1.1.3/go.mod h1:Rq08vgCcCAjHyRi/M7xlHKUykZCEtyBy9+DPF6GgEu8= github.com/aliyun/alibaba-cloud-sdk-go v1.62.156 h1:K4N91T1+RlSlx+t2dujeDviy4ehSGVjEltluDgmeHS4= github.com/aliyun/alibaba-cloud-sdk-go v1.62.156/go.mod h1:Api2AkmMgGaSUAhmk76oaFObkoeCPc/bKAqcyplPODs= github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw= -github.com/aliyun/credentials-go v1.3.0 h1:wfBNojfNJJyuHK3YUIIjRPwnlQIdmy/YMkia1XOnPtY= -github.com/aliyun/credentials-go v1.3.0/go.mod h1:8jKYhQuDawt8x2+fusqa1Y6mPxemTsBEN04dgcAcYz0= +github.com/aliyun/credentials-go v1.3.1 h1:uq/0v7kWrxmoLGpqjx7vtQ/s03f0zR//0br/xWDTE28= +github.com/aliyun/credentials-go v1.3.1/go.mod h1:8jKYhQuDawt8x2+fusqa1Y6mPxemTsBEN04dgcAcYz0= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/briandowns/spinner v1.23.0 h1:alDF2guRWqa/FOZZYWjlMIx2L6H0wyewPxo/CH4Pt2A= github.com/briandowns/spinner v1.23.0/go.mod h1:rPG4gmXeN3wQV/TsAY4w8lPdIM6RX3yqeBQJSrbXjuE= diff --git a/vendor/github.com/alibabacloud-go/darabonba-openapi/v2/client/client.go b/vendor/github.com/alibabacloud-go/darabonba-openapi/v2/client/client.go index e4b1a22e..7879dbd6 100644 --- a/vendor/github.com/alibabacloud-go/darabonba-openapi/v2/client/client.go +++ b/vendor/github.com/alibabacloud-go/darabonba-openapi/v2/client/client.go @@ -5,14 +5,13 @@ package client import ( - "io" - spi "github.com/alibabacloud-go/alibabacloud-gateway-spi/client" openapiutil "github.com/alibabacloud-go/openapi-util/service" util "github.com/alibabacloud-go/tea-utils/v2/service" xml "github.com/alibabacloud-go/tea-xml/service" "github.com/alibabacloud-go/tea/tea" credential "github.com/aliyun/credentials-go/credentials" + "io" ) type GlobalParameters struct { @@ -93,6 +92,12 @@ type Config struct { SignatureAlgorithm *string `json:"signatureAlgorithm,omitempty" xml:"signatureAlgorithm,omitempty"` // Global Parameters GlobalParameters *GlobalParameters `json:"globalParameters,omitempty" xml:"globalParameters,omitempty"` + // privite key for client certificate + Key *string `json:"key,omitempty" xml:"key,omitempty"` + // client certificate + Cert *string `json:"cert,omitempty" xml:"cert,omitempty"` + // server certificate + Ca *string `json:"ca,omitempty" xml:"ca,omitempty"` } func (s Config) String() string { @@ -228,6 +233,21 @@ func (s *Config) SetGlobalParameters(v *GlobalParameters) *Config { return s } +func (s *Config) SetKey(v string) *Config { + s.Key = &v + return s +} + +func (s *Config) SetCert(v string) *Config { + s.Cert = &v + return s +} + +func (s *Config) SetCa(v string) *Config { + s.Ca = &v + return s +} + type OpenApiRequest struct { Headers map[string]*string `json:"headers,omitempty" xml:"headers,omitempty"` Query map[string]*string `json:"query,omitempty" xml:"query,omitempty"` @@ -367,6 +387,9 @@ type Client struct { Headers map[string]*string Spi spi.ClientInterface GlobalParameters *GlobalParameters + Key *string + Cert *string + Ca *string } /** @@ -429,6 +452,9 @@ func (client *Client) Init(config *Config) (_err error) { client.SignatureVersion = config.SignatureVersion client.SignatureAlgorithm = config.SignatureAlgorithm client.GlobalParameters = config.GlobalParameters + client.Key = config.Key + client.Cert = config.Cert + client.Ca = config.Ca return nil } @@ -455,6 +481,9 @@ func (client *Client) DoRPCRequest(action *string, version *string, protocol *st } _runtime := map[string]interface{}{ "timeouted": "retry", + "key": tea.StringValue(util.DefaultString(runtime.Key, client.Key)), + "cert": tea.StringValue(util.DefaultString(runtime.Cert, client.Cert)), + "ca": tea.StringValue(util.DefaultString(runtime.Ca, client.Ca)), "readTimeout": tea.IntValue(util.DefaultNumber(runtime.ReadTimeout, client.ReadTimeout)), "connectTimeout": tea.IntValue(util.DefaultNumber(runtime.ConnectTimeout, client.ConnectTimeout)), "httpProxy": tea.StringValue(util.DefaultString(runtime.HttpProxy, client.HttpProxy)), @@ -603,7 +632,7 @@ func (client *Client) DoRPCRequest(action *string, version *string, protocol *st "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(err["Message"], err["message"])) + " request id: " + tea.ToString(requestId), "data": err, "description": tea.ToString(DefaultAny(err["Description"], err["description"])), - "accessDeniedDetail": err["AccessDeniedDetail"], + "accessDeniedDetail": DefaultAny(err["AccessDeniedDetail"], err["accessDeniedDetail"]), }) return _result, _err } @@ -715,6 +744,9 @@ func (client *Client) DoROARequest(action *string, version *string, protocol *st } _runtime := map[string]interface{}{ "timeouted": "retry", + "key": tea.StringValue(util.DefaultString(runtime.Key, client.Key)), + "cert": tea.StringValue(util.DefaultString(runtime.Cert, client.Cert)), + "ca": tea.StringValue(util.DefaultString(runtime.Ca, client.Ca)), "readTimeout": tea.IntValue(util.DefaultNumber(runtime.ReadTimeout, client.ReadTimeout)), "connectTimeout": tea.IntValue(util.DefaultNumber(runtime.ConnectTimeout, client.ConnectTimeout)), "httpProxy": tea.StringValue(util.DefaultString(runtime.HttpProxy, client.HttpProxy)), @@ -841,7 +873,7 @@ func (client *Client) DoROARequest(action *string, version *string, protocol *st "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(err["Message"], err["message"])) + " request id: " + tea.ToString(requestId), "data": err, "description": tea.ToString(DefaultAny(err["Description"], err["description"])), - "accessDeniedDetail": err["AccessDeniedDetail"], + "accessDeniedDetail": DefaultAny(err["AccessDeniedDetail"], err["accessDeniedDetail"]), }) return _result, _err } @@ -953,6 +985,9 @@ func (client *Client) DoROARequestWithForm(action *string, version *string, prot } _runtime := map[string]interface{}{ "timeouted": "retry", + "key": tea.StringValue(util.DefaultString(runtime.Key, client.Key)), + "cert": tea.StringValue(util.DefaultString(runtime.Cert, client.Cert)), + "ca": tea.StringValue(util.DefaultString(runtime.Ca, client.Ca)), "readTimeout": tea.IntValue(util.DefaultNumber(runtime.ReadTimeout, client.ReadTimeout)), "connectTimeout": tea.IntValue(util.DefaultNumber(runtime.ConnectTimeout, client.ConnectTimeout)), "httpProxy": tea.StringValue(util.DefaultString(runtime.HttpProxy, client.HttpProxy)), @@ -1082,7 +1117,7 @@ func (client *Client) DoROARequestWithForm(action *string, version *string, prot "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(err["Message"], err["message"])) + " request id: " + tea.ToString(DefaultAny(err["RequestId"], err["requestId"])), "data": err, "description": tea.ToString(DefaultAny(err["Description"], err["description"])), - "accessDeniedDetail": err["AccessDeniedDetail"], + "accessDeniedDetail": DefaultAny(err["AccessDeniedDetail"], err["accessDeniedDetail"]), }) return _result, _err } @@ -1197,6 +1232,9 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime } _runtime := map[string]interface{}{ "timeouted": "retry", + "key": tea.StringValue(util.DefaultString(runtime.Key, client.Key)), + "cert": tea.StringValue(util.DefaultString(runtime.Cert, client.Cert)), + "ca": tea.StringValue(util.DefaultString(runtime.Ca, client.Ca)), "readTimeout": tea.IntValue(util.DefaultNumber(runtime.ReadTimeout, client.ReadTimeout)), "connectTimeout": tea.IntValue(util.DefaultNumber(runtime.ConnectTimeout, client.ConnectTimeout)), "httpProxy": tea.StringValue(util.DefaultString(runtime.HttpProxy, client.HttpProxy)), @@ -1283,7 +1321,15 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime request_.Headers["content-type"] = tea.String("application/octet-stream") } else { if !tea.BoolValue(util.IsUnset(request.Body)) { - if tea.BoolValue(util.EqualString(params.ReqBodyType, tea.String("json"))) { + if tea.BoolValue(util.EqualString(params.ReqBodyType, tea.String("byte"))) { + byteObj, _err := util.AssertAsBytes(request.Body) + if _err != nil { + return _result, _err + } + + hashedRequestPayload = openapiutil.HexEncode(openapiutil.Hash(byteObj, signatureAlgorithm)) + request_.Body = tea.ToReader(byteObj) + } else if tea.BoolValue(util.EqualString(params.ReqBodyType, tea.String("json"))) { jsonObj := util.ToJSONString(request.Body) hashedRequestPayload = openapiutil.HexEncode(openapiutil.Hash(util.ToBytes(jsonObj), signatureAlgorithm)) request_.Body = tea.ToReader(jsonObj) @@ -1306,34 +1352,19 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime request_.Headers["x-acs-content-sha256"] = hashedRequestPayload if !tea.BoolValue(util.EqualString(params.AuthType, tea.String("Anonymous"))) { - authType, _err := client.GetType() + credentialModel, _err := client.Credential.GetCredential() if _err != nil { return _result, _err } + authType := credentialModel.Type if tea.BoolValue(util.EqualString(authType, tea.String("bearer"))) { - bearerToken, _err := client.GetBearerToken() - if _err != nil { - return _result, _err - } - + bearerToken := credentialModel.BearerToken request_.Headers["x-acs-bearer-token"] = bearerToken } else { - accessKeyId, _err := client.GetAccessKeyId() - if _err != nil { - return _result, _err - } - - accessKeySecret, _err := client.GetAccessKeySecret() - if _err != nil { - return _result, _err - } - - securityToken, _err := client.GetSecurityToken() - if _err != nil { - return _result, _err - } - + accessKeyId := credentialModel.AccessKeyId + accessKeySecret := credentialModel.AccessKeySecret + securityToken := credentialModel.SecurityToken if !tea.BoolValue(util.Empty(securityToken)) { request_.Headers["x-acs-accesskey-id"] = accessKeyId request_.Headers["x-acs-security-token"] = securityToken @@ -1381,7 +1412,7 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime "message": "code: " + tea.ToString(tea.IntValue(response_.StatusCode)) + ", " + tea.ToString(DefaultAny(err["Message"], err["message"])) + " request id: " + tea.ToString(DefaultAny(err["RequestId"], err["requestId"])), "data": err, "description": tea.ToString(DefaultAny(err["Description"], err["description"])), - "accessDeniedDetail": err["AccessDeniedDetail"], + "accessDeniedDetail": DefaultAny(err["AccessDeniedDetail"], err["accessDeniedDetail"]), }) return _result, _err } @@ -1452,8 +1483,14 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime }, &_result) return _result, _err } else { + anything, _err := util.ReadAsString(response_.Body) + if _err != nil { + return _result, _err + } + _result = make(map[string]interface{}) _err = tea.Convert(map[string]interface{}{ + "body": tea.StringValue(anything), "headers": response_.Headers, "statusCode": tea.IntValue(response_.StatusCode), }, &_result) @@ -1496,6 +1533,9 @@ func (client *Client) Execute(params *Params, request *OpenApiRequest, runtime * } _runtime := map[string]interface{}{ "timeouted": "retry", + "key": tea.StringValue(util.DefaultString(runtime.Key, client.Key)), + "cert": tea.StringValue(util.DefaultString(runtime.Cert, client.Cert)), + "ca": tea.StringValue(util.DefaultString(runtime.Ca, client.Ca)), "readTimeout": tea.IntValue(util.DefaultNumber(runtime.ReadTimeout, client.ReadTimeout)), "connectTimeout": tea.IntValue(util.DefaultNumber(runtime.ConnectTimeout, client.ConnectTimeout)), "httpProxy": tea.StringValue(util.DefaultString(runtime.HttpProxy, client.HttpProxy)), diff --git a/vendor/github.com/alibabacloud-go/tea-utils/v2/service/service.go b/vendor/github.com/alibabacloud-go/tea-utils/v2/service/service.go index 1362cbd2..3e3337b4 100644 --- a/vendor/github.com/alibabacloud-go/tea-utils/v2/service/service.go +++ b/vendor/github.com/alibabacloud-go/tea-utils/v2/service/service.go @@ -2,17 +2,21 @@ package service import ( "bytes" + "crypto/md5" + "encoding/hex" "encoding/json" "errors" "fmt" "io" "io/ioutil" + "math/rand" "net/http" "net/url" "reflect" "runtime" "strconv" "strings" + "sync/atomic" "time" "github.com/alibabacloud-go/tea/tea" @@ -41,6 +45,19 @@ type RuntimeOptions struct { KeepAlive *bool `json:"keepAlive" xml:"keepAlive"` } +var processStartTime int64 = time.Now().UnixNano() / 1e6 +var seqId int64 = 0 + +func getGID() uint64 { + // https://blog.sgmansfield.com/2015/12/goroutine-ids/ + b := make([]byte, 64) + b = b[:runtime.Stack(b, false)] + b = bytes.TrimPrefix(b, []byte("goroutine ")) + b = b[:bytes.IndexByte(b, ' ')] + n, _ := strconv.ParseUint(string(b), 10, 64) + return n +} + func (s RuntimeOptions) String() string { return tea.Prettify(s) } @@ -155,13 +172,7 @@ func StringifyMapValue(a map[string]interface{}) map[string]*string { res := make(map[string]*string) for key, value := range a { if value != nil { - switch value.(type) { - case string: - res[key] = tea.String(value.(string)) - default: - byt, _ := json.Marshal(value) - res[key] = tea.String(string(byt)) - } + res[key] = ToJSONString(value) } } return res @@ -242,7 +253,15 @@ func ReadAsJSON(body io.Reader) (result interface{}, err error) { } func GetNonce() *string { - return tea.String(getUUID()) + routineId := getGID() + currentTime := time.Now().UnixNano() / 1e6 + seq := atomic.AddInt64(&seqId, 1) + randNum := rand.Int63() + msg := fmt.Sprintf("%d-%d-%d-%d-%d", processStartTime, routineId, currentTime, seq, randNum) + h := md5.New() + h.Write([]byte(msg)) + ret := hex.EncodeToString(h.Sum(nil)) + return &ret } func Empty(val *string) *bool { @@ -315,6 +334,26 @@ func AssertAsNumber(a interface{}) (_result *int, _err error) { return tea.Int(res), nil } +/** + * Assert a value, if it is a integer, return it, otherwise throws + * @return the integer value + */ +func AssertAsInteger(value interface{}) (_result *int, _err error) { + res := 0 + switch value.(type) { + case int: + tmp := value.(int) + res = tmp + case *int: + tmp := value.(*int) + res = tea.IntValue(tmp) + default: + return nil, errors.New(fmt.Sprintf("%v is not a int", value)) + } + + return tea.Int(res), nil +} + func AssertAsBoolean(a interface{}) (_result *bool, _err error) { res := false switch a.(type) { diff --git a/vendor/github.com/alibabacloud-go/tea-utils/v2/service/util.go b/vendor/github.com/alibabacloud-go/tea-utils/v2/service/util.go deleted file mode 100644 index a73cb560..00000000 --- a/vendor/github.com/alibabacloud-go/tea-utils/v2/service/util.go +++ /dev/null @@ -1,52 +0,0 @@ -package service - -import ( - "crypto/md5" - "crypto/rand" - "encoding/hex" - "hash" - rand2 "math/rand" -) - -type UUID [16]byte - -const numBytes = "1234567890" - -func getUUID() (uuidHex string) { - uuid := newUUID() - uuidHex = hex.EncodeToString(uuid[:]) - return -} - -func randStringBytes(n int) string { - b := make([]byte, n) - for i := range b { - b[i] = numBytes[rand2.Intn(len(numBytes))] - } - return string(b) -} - -func newUUID() UUID { - ns := UUID{} - safeRandom(ns[:]) - u := newFromHash(md5.New(), ns, randStringBytes(16)) - u[6] = (u[6] & 0x0f) | (byte(2) << 4) - u[8] = (u[8]&(0xff>>2) | (0x02 << 6)) - - return u -} - -func newFromHash(h hash.Hash, ns UUID, name string) UUID { - u := UUID{} - h.Write(ns[:]) - h.Write([]byte(name)) - copy(u[:], h.Sum(nil)) - - return u -} - -func safeRandom(dest []byte) { - if _, err := rand.Read(dest); err != nil { - panic(err) - } -} diff --git a/vendor/github.com/alibabacloud-go/tea-xml/LICENSE b/vendor/github.com/alibabacloud-go/tea-xml/LICENSE new file mode 100644 index 00000000..0c44dcef --- /dev/null +++ b/vendor/github.com/alibabacloud-go/tea-xml/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2009-present, Alibaba Cloud All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/aliyun/credentials-go/credentials/access_key_credential.go b/vendor/github.com/aliyun/credentials-go/credentials/access_key_credential.go index 7bcaa974..78530e68 100644 --- a/vendor/github.com/aliyun/credentials-go/credentials/access_key_credential.go +++ b/vendor/github.com/aliyun/credentials-go/credentials/access_key_credential.go @@ -15,6 +15,15 @@ func newAccessKeyCredential(accessKeyId, accessKeySecret string) *AccessKeyCrede } } +func (s *AccessKeyCredential) GetCredential() (*CredentialModel, error) { + credential := &CredentialModel{ + AccessKeyId: tea.String(s.AccessKeyId), + AccessKeySecret: tea.String(s.AccessKeySecret), + Type: tea.String("access_key"), + } + return credential, nil +} + // GetAccessKeyId reutrns AccessKeyCreential's AccessKeyId func (a *AccessKeyCredential) GetAccessKeyId() (*string, error) { return tea.String(a.AccessKeyId), nil diff --git a/vendor/github.com/aliyun/credentials-go/credentials/bearer_token_credential.go b/vendor/github.com/aliyun/credentials-go/credentials/bearer_token_credential.go index cca29162..9df4d320 100644 --- a/vendor/github.com/aliyun/credentials-go/credentials/bearer_token_credential.go +++ b/vendor/github.com/aliyun/credentials-go/credentials/bearer_token_credential.go @@ -14,6 +14,14 @@ func newBearerTokenCredential(token string) *BearerTokenCredential { } } +func (s *BearerTokenCredential) GetCredential() (*CredentialModel, error) { + credential := &CredentialModel{ + BearerToken: tea.String(s.BearerToken), + Type: tea.String("bearer"), + } + return credential, nil +} + // GetAccessKeyId is useless for BearerTokenCredential func (b *BearerTokenCredential) GetAccessKeyId() (*string, error) { return tea.String(""), nil diff --git a/vendor/github.com/aliyun/credentials-go/credentials/credential.go b/vendor/github.com/aliyun/credentials-go/credentials/credential.go index 63ee7ce4..2603dc0c 100644 --- a/vendor/github.com/aliyun/credentials-go/credentials/credential.go +++ b/vendor/github.com/aliyun/credentials-go/credentials/credential.go @@ -30,6 +30,7 @@ type Credential interface { GetSecurityToken() (*string, error) GetBearerToken() *string GetType() *string + GetCredential() (*CredentialModel, error) } // Config is important when call NewCredential diff --git a/vendor/github.com/aliyun/credentials-go/credentials/credential_model.go b/vendor/github.com/aliyun/credentials-go/credentials/credential_model.go new file mode 100644 index 00000000..7b46c308 --- /dev/null +++ b/vendor/github.com/aliyun/credentials-go/credentials/credential_model.go @@ -0,0 +1,50 @@ +package credentials + +import "github.com/alibabacloud-go/tea/tea" + +// CredentialModel is a model +type CredentialModel struct { + // accesskey id + AccessKeyId *string `json:"accessKeyId,omitempty" xml:"accessKeyId,omitempty"` + // accesskey secret + AccessKeySecret *string `json:"accessKeySecret,omitempty" xml:"accessKeySecret,omitempty"` + // security token + SecurityToken *string `json:"securityToken,omitempty" xml:"securityToken,omitempty"` + // bearer token + BearerToken *string `json:"bearerToken,omitempty" xml:"bearerToken,omitempty"` + // type + Type *string `json:"type,omitempty" xml:"type,omitempty"` +} + +func (s CredentialModel) String() string { + return tea.Prettify(s) +} + +func (s CredentialModel) GoString() string { + return s.String() +} + +func (s *CredentialModel) SetAccessKeyId(v string) *CredentialModel { + s.AccessKeyId = &v + return s +} + +func (s *CredentialModel) SetAccessKeySecret(v string) *CredentialModel { + s.AccessKeySecret = &v + return s +} + +func (s *CredentialModel) SetSecurityToken(v string) *CredentialModel { + s.SecurityToken = &v + return s +} + +func (s *CredentialModel) SetBearerToken(v string) *CredentialModel { + s.BearerToken = &v + return s +} + +func (s *CredentialModel) SetType(v string) *CredentialModel { + s.Type = &v + return s +} diff --git a/vendor/github.com/aliyun/credentials-go/credentials/ecs_ram_role.go b/vendor/github.com/aliyun/credentials-go/credentials/ecs_ram_role.go index 5e7ddf4d..d86360fc 100644 --- a/vendor/github.com/aliyun/credentials-go/credentials/ecs_ram_role.go +++ b/vendor/github.com/aliyun/credentials-go/credentials/ecs_ram_role.go @@ -40,6 +40,22 @@ func newEcsRAMRoleCredential(roleName string, inAdvanceScale float64, runtime *u } } +func (e *EcsRAMRoleCredential) GetCredential() (*CredentialModel, error) { + if e.sessionCredential == nil || e.needUpdateCredential() { + err := e.updateCredential() + if err != nil { + return nil, err + } + } + credential := &CredentialModel{ + AccessKeyId: tea.String(e.sessionCredential.AccessKeyId), + AccessKeySecret: tea.String(e.sessionCredential.AccessKeySecret), + SecurityToken: tea.String(e.sessionCredential.SecurityToken), + Type: tea.String("ecs_ram_role"), + } + return credential, nil +} + // GetAccessKeyId reutrns EcsRAMRoleCredential's AccessKeyId // if AccessKeyId is not exist or out of date, the function will update it. func (e *EcsRAMRoleCredential) GetAccessKeyId() (*string, error) { diff --git a/vendor/github.com/aliyun/credentials-go/credentials/oidc_credential.go b/vendor/github.com/aliyun/credentials-go/credentials/oidc_credential.go index 7267383c..7d960aba 100644 --- a/vendor/github.com/aliyun/credentials-go/credentials/oidc_credential.go +++ b/vendor/github.com/aliyun/credentials-go/credentials/oidc_credential.go @@ -55,6 +55,22 @@ func newOIDCRoleArnCredential(accessKeyId, accessKeySecret, roleArn, OIDCProvide } } +func (e *OIDCCredential) GetCredential() (*CredentialModel, error) { + if e.sessionCredential == nil || e.needUpdateCredential() { + err := e.updateCredential() + if err != nil { + return nil, err + } + } + credential := &CredentialModel{ + AccessKeyId: tea.String(e.sessionCredential.AccessKeyId), + AccessKeySecret: tea.String(e.sessionCredential.AccessKeySecret), + SecurityToken: tea.String(e.sessionCredential.SecurityToken), + Type: tea.String("oidc_role_arn"), + } + return credential, nil +} + // GetAccessKeyId reutrns OIDCCredential's AccessKeyId // if AccessKeyId is not exist or out of date, the function will update it. func (r *OIDCCredential) GetAccessKeyId() (*string, error) { diff --git a/vendor/github.com/aliyun/credentials-go/credentials/rsa_key_pair_credential.go b/vendor/github.com/aliyun/credentials-go/credentials/rsa_key_pair_credential.go index de251568..82988eca 100644 --- a/vendor/github.com/aliyun/credentials-go/credentials/rsa_key_pair_credential.go +++ b/vendor/github.com/aliyun/credentials-go/credentials/rsa_key_pair_credential.go @@ -42,6 +42,22 @@ func newRsaKeyPairCredential(privateKey, publicKeyId string, sessionExpiration i } } +func (e *RsaKeyPairCredential) GetCredential() (*CredentialModel, error) { + if e.sessionCredential == nil || e.needUpdateCredential() { + err := e.updateCredential() + if err != nil { + return nil, err + } + } + credential := &CredentialModel{ + AccessKeyId: tea.String(e.sessionCredential.AccessKeyId), + AccessKeySecret: tea.String(e.sessionCredential.AccessKeySecret), + SecurityToken: tea.String(e.sessionCredential.SecurityToken), + Type: tea.String("rsa_key_pair"), + } + return credential, nil +} + // GetAccessKeyId reutrns RsaKeyPairCredential's AccessKeyId // if AccessKeyId is not exist or out of date, the function will update it. func (r *RsaKeyPairCredential) GetAccessKeyId() (*string, error) { diff --git a/vendor/github.com/aliyun/credentials-go/credentials/sts_credential.go b/vendor/github.com/aliyun/credentials-go/credentials/sts_credential.go index ba07dab4..5a9973f2 100644 --- a/vendor/github.com/aliyun/credentials-go/credentials/sts_credential.go +++ b/vendor/github.com/aliyun/credentials-go/credentials/sts_credential.go @@ -17,6 +17,16 @@ func newStsTokenCredential(accessKeyId, accessKeySecret, securityToken string) * } } +func (s *StsTokenCredential) GetCredential() (*CredentialModel, error) { + credential := &CredentialModel{ + AccessKeyId: tea.String(s.AccessKeyId), + AccessKeySecret: tea.String(s.AccessKeySecret), + SecurityToken: tea.String(s.SecurityToken), + Type: tea.String("sts"), + } + return credential, nil +} + // GetAccessKeyId reutrns StsTokenCredential's AccessKeyId func (s *StsTokenCredential) GetAccessKeyId() (*string, error) { return tea.String(s.AccessKeyId), nil diff --git a/vendor/github.com/aliyun/credentials-go/credentials/sts_role_arn_credential.go b/vendor/github.com/aliyun/credentials-go/credentials/sts_role_arn_credential.go index 77fa3da2..3ddf32fa 100644 --- a/vendor/github.com/aliyun/credentials-go/credentials/sts_role_arn_credential.go +++ b/vendor/github.com/aliyun/credentials-go/credentials/sts_role_arn_credential.go @@ -66,6 +66,22 @@ func newRAMRoleArnWithExternalIdCredential(accessKeyId, accessKeySecret, roleArn } } +func (e *RAMRoleArnCredential) GetCredential() (*CredentialModel, error) { + if e.sessionCredential == nil || e.needUpdateCredential() { + err := e.updateCredential() + if err != nil { + return nil, err + } + } + credential := &CredentialModel{ + AccessKeyId: tea.String(e.sessionCredential.AccessKeyId), + AccessKeySecret: tea.String(e.sessionCredential.AccessKeySecret), + SecurityToken: tea.String(e.sessionCredential.SecurityToken), + Type: tea.String("ram_role_arn"), + } + return credential, nil +} + // GetAccessKeyId reutrns RamRoleArnCredential's AccessKeyId // if AccessKeyId is not exist or out of date, the function will update it. func (r *RAMRoleArnCredential) GetAccessKeyId() (*string, error) { diff --git a/vendor/github.com/aliyun/credentials-go/credentials/uri_credential.go b/vendor/github.com/aliyun/credentials-go/credentials/uri_credential.go index e8f303fc..d03006c9 100644 --- a/vendor/github.com/aliyun/credentials-go/credentials/uri_credential.go +++ b/vendor/github.com/aliyun/credentials-go/credentials/uri_credential.go @@ -37,6 +37,22 @@ func newURLCredential(URL string) *URLCredential { } } +func (e *URLCredential) GetCredential() (*CredentialModel, error) { + if e.sessionCredential == nil || e.needUpdateCredential() { + err := e.updateCredential() + if err != nil { + return nil, err + } + } + credential := &CredentialModel{ + AccessKeyId: tea.String(e.sessionCredential.AccessKeyId), + AccessKeySecret: tea.String(e.sessionCredential.AccessKeySecret), + SecurityToken: tea.String(e.sessionCredential.SecurityToken), + Type: tea.String("credential_uri"), + } + return credential, nil +} + // GetAccessKeyId reutrns URLCredential's AccessKeyId // if AccessKeyId is not exist or out of date, the function will update it. func (e *URLCredential) GetAccessKeyId() (*string, error) { diff --git a/vendor/modules.txt b/vendor/modules.txt index 0823253f..7f30088d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -15,7 +15,7 @@ github.com/alibabacloud-go/cs-20151215/v3/client # github.com/alibabacloud-go/darabonba-openapi v0.2.1 ## explicit; go 1.14 github.com/alibabacloud-go/darabonba-openapi/client -# github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.2 +# github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.5 ## explicit; go 1.14 github.com/alibabacloud-go/darabonba-openapi/v2/client # github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 @@ -40,10 +40,10 @@ github.com/alibabacloud-go/tea/utils # github.com/alibabacloud-go/tea-utils v1.4.5 ## explicit; go 1.14 github.com/alibabacloud-go/tea-utils/service -# github.com/alibabacloud-go/tea-utils/v2 v2.0.1 +# github.com/alibabacloud-go/tea-utils/v2 v2.0.4 ## explicit; go 1.14 github.com/alibabacloud-go/tea-utils/v2/service -# github.com/alibabacloud-go/tea-xml v1.1.2 +# github.com/alibabacloud-go/tea-xml v1.1.3 ## explicit; go 1.14 github.com/alibabacloud-go/tea-xml/service # github.com/aliyun/alibaba-cloud-sdk-go v1.62.156 @@ -54,7 +54,7 @@ github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils -# github.com/aliyun/credentials-go v1.3.0 +# github.com/aliyun/credentials-go v1.3.1 ## explicit; go 1.14 github.com/aliyun/credentials-go/credentials github.com/aliyun/credentials-go/credentials/request