Browse Source

Generated 2015-04-01 for Sts.

sdk-team 5 years ago
parent
commit
5a5ed41534
3 changed files with 84 additions and 0 deletions
  1. 4 0
      ChangeLog.txt
  2. 25 0
      services/sts/client.go
  3. 55 0
      services/sts/endpoint.go

+ 4 - 0
ChangeLog.txt

@@ -1,3 +1,7 @@
+2020-02-14 Version: v1.60.377
+- Generated 2015-04-01 for `Sts`.
+- Use standard endpoints.
+
 2020-02-14 Version: v1.60.376
 2020-02-14 Version: v1.60.376
 - Generated 2018-01-01 for `pvtz`.
 - Generated 2018-01-01 for `pvtz`.
 - Update default endpoints.
 - Update default endpoints.

+ 25 - 0
services/sts/client.go

@@ -16,6 +16,8 @@ package sts
 // Changes may cause incorrect behavior and will be lost if the code is regenerated.
 // Changes may cause incorrect behavior and will be lost if the code is regenerated.
 
 
 import (
 import (
+	"reflect"
+
 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth"
 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth"
 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider"
 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider"
@@ -26,10 +28,25 @@ type Client struct {
 	sdk.Client
 	sdk.Client
 }
 }
 
 
+// SetClientProperty Set Property by Reflect
+func SetClientProperty(client *Client, propertyName string, propertyValue interface{}) {
+	v := reflect.ValueOf(client).Elem()
+	if v.FieldByName(propertyName).IsValid() && v.FieldByName(propertyName).CanSet() {
+		v.FieldByName(propertyName).Set(reflect.ValueOf(propertyValue))
+	}
+}
+
+// SetEndpointDataToClient Set EndpointMap and ENdpointType
+func SetEndpointDataToClient(client *Client) {
+	SetClientProperty(client, "EndpointMap", GetEndpointMap())
+	SetClientProperty(client, "EndpointType", GetEndpointType())
+}
+
 // NewClient creates a sdk client with environment variables
 // NewClient creates a sdk client with environment variables
 func NewClient() (client *Client, err error) {
 func NewClient() (client *Client, err error) {
 	client = &Client{}
 	client = &Client{}
 	err = client.Init()
 	err = client.Init()
+	SetEndpointDataToClient(client)
 	return
 	return
 }
 }
 
 
@@ -44,6 +61,7 @@ func NewClientWithProvider(regionId string, providers ...provider.Provider) (cli
 		pc = provider.NewProviderChain(providers)
 		pc = provider.NewProviderChain(providers)
 	}
 	}
 	err = client.InitWithProviderChain(regionId, pc)
 	err = client.InitWithProviderChain(regionId, pc)
+	SetEndpointDataToClient(client)
 	return
 	return
 }
 }
 
 
@@ -52,6 +70,7 @@ func NewClientWithProvider(regionId string, providers ...provider.Provider) (cli
 func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) {
 func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) {
 	client = &Client{}
 	client = &Client{}
 	err = client.InitWithOptions(regionId, config, credential)
 	err = client.InitWithOptions(regionId, config, credential)
+	SetEndpointDataToClient(client)
 	return
 	return
 }
 }
 
 
@@ -60,6 +79,7 @@ func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.C
 func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) {
 func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) {
 	client = &Client{}
 	client = &Client{}
 	err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret)
 	err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret)
+	SetEndpointDataToClient(client)
 	return
 	return
 }
 }
 
 
@@ -68,6 +88,7 @@ func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (clie
 func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) {
 func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) {
 	client = &Client{}
 	client = &Client{}
 	err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken)
 	err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken)
+	SetEndpointDataToClient(client)
 	return
 	return
 }
 }
 
 
@@ -76,6 +97,7 @@ func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToke
 func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) {
 func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) {
 	client = &Client{}
 	client = &Client{}
 	err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName)
 	err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName)
+	SetEndpointDataToClient(client)
 	return
 	return
 }
 }
 
 
@@ -84,6 +106,7 @@ func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, role
 func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) {
 func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) {
 	client = &Client{}
 	client = &Client{}
 	err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy)
 	err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy)
+	SetEndpointDataToClient(client)
 	return
 	return
 }
 }
 
 
@@ -92,6 +115,7 @@ func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySec
 func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) {
 func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) {
 	client = &Client{}
 	client = &Client{}
 	err = client.InitWithEcsRamRole(regionId, roleName)
 	err = client.InitWithEcsRamRole(regionId, roleName)
+	SetEndpointDataToClient(client)
 	return
 	return
 }
 }
 
 
@@ -100,5 +124,6 @@ func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client,
 func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) {
 func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) {
 	client = &Client{}
 	client = &Client{}
 	err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration)
 	err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration)
+	SetEndpointDataToClient(client)
 	return
 	return
 }
 }

+ 55 - 0
services/sts/endpoint.go

@@ -0,0 +1,55 @@
+package sts
+
+// EndpointMap Endpoint Data
+var EndpointMap map[string]string
+
+// EndpointType regional or central
+var EndpointType = "regional"
+
+// GetEndpointMap Get Endpoint Data Map
+func GetEndpointMap() map[string]string {
+	if EndpointMap == nil {
+		EndpointMap = map[string]string{
+			"cn-shanghai-internal-test-1": "sts.aliyuncs.com",
+			"cn-beijing-gov-1":            "sts.aliyuncs.com",
+			"cn-shenzhen-su18-b01":        "sts.aliyuncs.com",
+			"cn-shanghai-inner":           "sts.aliyuncs.com",
+			"cn-shenzhen-st4-d01":         "sts.aliyuncs.com",
+			"cn-haidian-cm12-c01":         "sts.aliyuncs.com",
+			"cn-hangzhou-internal-prod-1": "sts.aliyuncs.com",
+			"cn-north-2-gov-1":            "sts.aliyuncs.com",
+			"cn-yushanfang":               "sts.aliyuncs.com",
+			"cn-hongkong-finance-pop":     "sts.aliyuncs.com",
+			"cn-qingdao-nebula":           "sts.aliyuncs.com",
+			"cn-shanghai-finance-1":       "sts.aliyuncs.com",
+			"cn-beijing-finance-pop":      "sts.aliyuncs.com",
+			"cn-wuhan":                    "sts.aliyuncs.com",
+			"cn-zhengzhou-nebula-1":       "sts.aliyuncs.com",
+			"rus-west-1-pop":              "sts.ap-northeast-1.aliyuncs.com",
+			"cn-shanghai-et15-b01":        "sts.aliyuncs.com",
+			"cn-hangzhou-bj-b01":          "sts.aliyuncs.com",
+			"cn-hangzhou-internal-test-1": "sts.aliyuncs.com",
+			"eu-west-1-oxs":               "sts.ap-northeast-1.aliyuncs.com",
+			"cn-zhangbei-na61-b01":        "sts.aliyuncs.com",
+			"cn-beijing-finance-1":        "sts.aliyuncs.com",
+			"cn-hangzhou-internal-test-3": "sts.aliyuncs.com",
+			"cn-hangzhou-internal-test-2": "sts.aliyuncs.com",
+			"cn-shenzhen-finance-1":       "sts.aliyuncs.com",
+			"cn-hangzhou-test-306":        "sts.aliyuncs.com",
+			"cn-shanghai-et2-b01":         "sts.aliyuncs.com",
+			"cn-hangzhou-finance":         "sts.aliyuncs.com",
+			"cn-beijing-nu16-b01":         "sts.aliyuncs.com",
+			"cn-edge-1":                   "sts.aliyuncs.com",
+			"cn-fujian":                   "sts.aliyuncs.com",
+			"ap-northeast-2-pop":          "sts.ap-northeast-1.aliyuncs.com",
+			"cn-shenzhen-inner":           "sts.aliyuncs.com",
+			"cn-zhangjiakou-na62-a01":     "sts.aliyuncs.com",
+		}
+	}
+	return EndpointMap
+}
+
+// GetEndpointType Get Endpoint Type Value
+func GetEndpointType() string {
+	return EndpointType
+}