mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #17699 from ioito/automated-cherry-pick-of-#17698-upstream-release-3.10
Automated cherry pick of #17698: fix(region): vendor update
This commit is contained in:
@@ -85,7 +85,7 @@ require (
|
||||
k8s.io/client-go v0.19.3
|
||||
k8s.io/cluster-bootstrap v0.19.3
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230731090149-af425f9dba9e
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230803034922-470e942e3aba
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
|
||||
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19
|
||||
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361
|
||||
|
||||
@@ -1184,8 +1184,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230731090149-af425f9dba9e h1:v9zSgGSLIlWZm3sqrif4lPHsX3NqfmHtjD5oo+OC8fo=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230731090149-af425f9dba9e/go.mod h1:2sgCN7nRPQL3woLfdgqLDd92vwAHqtlz3KKiHxC5BAw=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230803034922-470e942e3aba h1:yjJKCNtNqLFE6GSDDa3EDJIt/7QFbXvLsC1rssd6E9k=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230803034922-470e942e3aba/go.mod h1:2sgCN7nRPQL3woLfdgqLDd92vwAHqtlz3KKiHxC5BAw=
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
|
||||
Vendored
+1
-1
@@ -1457,7 +1457,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
|
||||
# sigs.k8s.io/yaml v1.2.0
|
||||
## explicit; go 1.12
|
||||
sigs.k8s.io/yaml
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230731090149-af425f9dba9e
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230803034922-470e942e3aba
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
|
||||
+15
@@ -17,6 +17,7 @@ package apsara
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -322,6 +323,20 @@ func (self *SApsaraClient) ecsRequest(apiName string, params map[string]string)
|
||||
return productRequest(cli, APSARA_PRODUCT_ECS, domain, APSARA_API_VERSION, apiName, params, self.debug)
|
||||
}
|
||||
|
||||
func (self *SApsaraClient) getAccountInfo() string {
|
||||
account := map[string]string{
|
||||
"aliyunPk": "",
|
||||
"accountStructure": "",
|
||||
"parentPk": "26842",
|
||||
"accessKeyId": self.accessKey,
|
||||
"accessKeySecret": self.accessSecret,
|
||||
"partnerPk": "",
|
||||
"sourceIp": "",
|
||||
"securityToken": "",
|
||||
}
|
||||
return base64.StdEncoding.EncodeToString([]byte(jsonutils.Marshal(account).String()))
|
||||
}
|
||||
|
||||
func (self *SApsaraClient) ossRequest(apiName string, params map[string]string) (jsonutils.JSONObject, error) {
|
||||
cli, err := self.getDefaultClient("")
|
||||
if err != nil {
|
||||
|
||||
+2
-2
@@ -67,7 +67,7 @@ func (b *SBucket) GetAcl() cloudprovider.TBucketACLType {
|
||||
|
||||
func (self *SRegion) GetBucketAcl(bucket string) string {
|
||||
params := map[string]string{
|
||||
"AccountInfo": "aaa",
|
||||
"AccountInfo": self.GetClient().getAccountInfo(),
|
||||
"x-acs-instanceid": bucket,
|
||||
"Params": jsonutils.Marshal(map[string]string{"BucketName": bucket, "acl": "acl"}).String(),
|
||||
}
|
||||
@@ -160,7 +160,7 @@ func (self *SRegion) GetBucketCapacity(bucket string, department int) (int64, er
|
||||
"region": self.RegionId,
|
||||
}).String(),
|
||||
// 此参数必传,可以设任意值
|
||||
"AccountInfo": "aaa",
|
||||
"AccountInfo": self.GetClient().getAccountInfo(),
|
||||
"Department": fmt.Sprintf("%d", department),
|
||||
}
|
||||
resp, err := self.ossRequest("GetBucketStorageCapacity", params)
|
||||
|
||||
+6
-2
@@ -948,7 +948,11 @@ func (region *SRegion) CreateILoadBalancerAcl(acl *cloudprovider.SLoadbalancerAc
|
||||
}
|
||||
|
||||
func (self *SRegion) GetBuckets() ([]SBucket, error) {
|
||||
resp, err := self.ossRequest("GetService", map[string]string{})
|
||||
params := map[string]string{
|
||||
"AccountInfo": self.client.getAccountInfo(),
|
||||
}
|
||||
|
||||
resp, err := self.ossRequest("GetService", params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1053,7 +1057,7 @@ func (self *SRegion) DeleteIBucket(name string) error {
|
||||
|
||||
func (self *SRegion) GetBucket(name string) (*SBucket, error) {
|
||||
params := map[string]string{
|
||||
"AccountInfo": "aaa",
|
||||
"AccountInfo": self.client.getAccountInfo(),
|
||||
"x-acs-instanceid": name,
|
||||
"Params": jsonutils.Marshal(map[string]string{"BucketName": name}).String(),
|
||||
}
|
||||
|
||||
+23
@@ -45,6 +45,7 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/gotypes"
|
||||
"yunion.io/x/pkg/util/httputils"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
@@ -331,6 +332,9 @@ func (self *SAzureClient) _get(resourceId string, params url.Values, retVal inte
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if gotypes.IsNil(body) {
|
||||
return fmt.Errorf("empty response")
|
||||
}
|
||||
err = body.Unmarshal(retVal)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -348,6 +352,9 @@ func (self *SAzureClient) gcreate(resource string, body jsonutils.JSONObject, re
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "msGraphRequest")
|
||||
}
|
||||
if gotypes.IsNil(result) {
|
||||
return fmt.Errorf("empty response")
|
||||
}
|
||||
if retVal != nil {
|
||||
return result.Unmarshal(retVal)
|
||||
}
|
||||
@@ -378,6 +385,9 @@ func (self *SAzureClient) _glist(resource string, params url.Values, retVal inte
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if gotypes.IsNil(body) {
|
||||
return fmt.Errorf("empty response")
|
||||
}
|
||||
err = body.Unmarshal(retVal, "value")
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "body.Unmarshal")
|
||||
@@ -682,6 +692,11 @@ func (self *SAzureClient) create(resourceGroup, resourceType, name string, body
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "jsonRequest")
|
||||
}
|
||||
|
||||
if gotypes.IsNil(resp) {
|
||||
return fmt.Errorf("empty response")
|
||||
}
|
||||
|
||||
if retVal != nil {
|
||||
return resp.Unmarshal(retVal)
|
||||
}
|
||||
@@ -698,6 +713,10 @@ func (self *SAzureClient) CheckNameAvailability(resourceType, name string) (bool
|
||||
if err != nil {
|
||||
return false, errors.Wrapf(err, "post(%s)", path)
|
||||
}
|
||||
if gotypes.IsNil(resp) {
|
||||
return false, fmt.Errorf("empty response")
|
||||
}
|
||||
|
||||
output := sNameAvailableOutput{}
|
||||
err = resp.Unmarshal(&output)
|
||||
if err != nil {
|
||||
@@ -723,6 +742,10 @@ func (self *SAzureClient) update(body jsonutils.JSONObject, retVal interface{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if gotypes.IsNil(resp) {
|
||||
return fmt.Errorf("empty response")
|
||||
}
|
||||
|
||||
if retVal != nil {
|
||||
return resp.Unmarshal(retVal)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user