Просмотр исходного кода

CLOUDAUTH SDK Auto Released By gongpei.gp,Version:1.60.31

Signed-off-by: sdk-team <sdk-team@alibabacloud.com>
sdk-team 6 лет назад
Родитель
Сommit
1680989851
3 измененных файлов с 42 добавлено и 15 удалено
  1. 3 0
      ChangeLog.txt
  2. 28 5
      services/cloudauth/client.go
  3. 11 10
      services/cloudauth/struct_data.go

+ 3 - 0
ChangeLog.txt

@@ -1,3 +1,6 @@
+2019-05-31 Version: 1.60.31
+1, Add authority in GetMaterials API.
+
 2019-05-30 Version: 1.60.30
 Fix: Handle the repeatlist parameter correctly
 

+ 28 - 5
services/cloudauth/client.go

@@ -18,6 +18,7 @@ package cloudauth
 import (
 	"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/credentials/provider"
 )
 
 // Client is the sdk client struct, each func corresponds to an OpenAPI
@@ -32,6 +33,20 @@ func NewClient() (client *Client, err error) {
 	return
 }
 
+// NewClientWithProvider creates a sdk client with providers
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) {
+	client = &Client{}
+	var pc provider.Provider
+	if len(providers) == 0 {
+		pc = provider.DefaultChain
+	} else {
+		pc = provider.NewProviderChain(providers)
+	}
+	err = client.InitWithProviderChain(regionId, pc)
+	return
+}
+
 // NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential
 // this is the common api to create a sdk client
 func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) {
@@ -41,7 +56,7 @@ func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.C
 }
 
 // NewClientWithAccessKey is a shortcut to create sdk client with accesskey
-// usage: https://help.aliyun.com/document_detail/66217.html
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
 func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) {
 	client = &Client{}
 	err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret)
@@ -49,7 +64,7 @@ func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (clie
 }
 
 // NewClientWithStsToken is a shortcut to create sdk client with sts token
-// usage: https://help.aliyun.com/document_detail/66222.html
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
 func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) {
 	client = &Client{}
 	err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken)
@@ -57,15 +72,23 @@ func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToke
 }
 
 // NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn
-// usage: https://help.aliyun.com/document_detail/66222.html
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
 func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) {
 	client = &Client{}
 	err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName)
 	return
 }
 
+// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn and policy
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy)
+	return
+}
+
 // NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role
-// usage: https://help.aliyun.com/document_detail/66223.html
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
 func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) {
 	client = &Client{}
 	err = client.InitWithEcsRamRole(regionId, roleName)
@@ -73,7 +96,7 @@ func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client,
 }
 
 // NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair
-// attention: rsa key pair auth is only Japan regions available
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
 func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) {
 	client = &Client{}
 	err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration)

+ 11 - 10
services/cloudauth/struct_data.go

@@ -18,27 +18,28 @@ package cloudauth
 // Data is a nested struct in cloudauth response
 type Data struct {
 	Name                     string       `json:"Name" xml:"Name"`
-	IdCardFrontPic           string       `json:"IdCardFrontPic" xml:"IdCardFrontPic"`
 	TrustedScore             float64      `json:"TrustedScore" xml:"TrustedScore"`
-	FacePic                  string       `json:"FacePic" xml:"FacePic"`
-	IdCardExpiry             string       `json:"IdCardExpiry" xml:"IdCardExpiry"`
-	AuditConclusions         string       `json:"AuditConclusions" xml:"AuditConclusions"`
-	AuthorityComparisonScore float64      `json:"AuthorityComparisonScore" xml:"AuthorityComparisonScore"`
-	IdCardStartDate          string       `json:"IdCardStartDate" xml:"IdCardStartDate"`
 	IdCardType               string       `json:"IdCardType" xml:"IdCardType"`
-	SimilarityScore          float64      `json:"SimilarityScore" xml:"SimilarityScore"`
 	IdentificationNumber     string       `json:"IdentificationNumber" xml:"IdentificationNumber"`
-	Address                  string       `json:"Address" xml:"Address"`
-	EthnicGroup              string       `json:"EthnicGroup" xml:"EthnicGroup"`
 	Sex                      string       `json:"Sex" xml:"Sex"`
 	IdCardBackPic            string       `json:"IdCardBackPic" xml:"IdCardBackPic"`
 	ImgWidth                 int          `json:"ImgWidth" xml:"ImgWidth"`
+	Authority                string       `json:"Authority" xml:"Authority"`
 	CloudauthPageUrl         string       `json:"CloudauthPageUrl" xml:"CloudauthPageUrl"`
 	StatusCode               int          `json:"StatusCode" xml:"StatusCode"`
 	ImgHeight                int          `json:"ImgHeight" xml:"ImgHeight"`
+	IdCardFrontPic           string       `json:"IdCardFrontPic" xml:"IdCardFrontPic"`
+	FacePic                  string       `json:"FacePic" xml:"FacePic"`
+	IdCardExpiry             string       `json:"IdCardExpiry" xml:"IdCardExpiry"`
+	AuditConclusions         string       `json:"AuditConclusions" xml:"AuditConclusions"`
+	AuthorityComparisonScore float64      `json:"AuthorityComparisonScore" xml:"AuthorityComparisonScore"`
+	IdCardStartDate          string       `json:"IdCardStartDate" xml:"IdCardStartDate"`
+	SimilarityScore          float64      `json:"SimilarityScore" xml:"SimilarityScore"`
+	Address                  string       `json:"Address" xml:"Address"`
+	EthnicGroup              string       `json:"EthnicGroup" xml:"EthnicGroup"`
 	ConfidenceThresholds     string       `json:"ConfidenceThresholds" xml:"ConfidenceThresholds"`
 	StsToken                 StsToken     `json:"StsToken" xml:"StsToken"`
-	VerifyStatus             VerifyStatus `json:"VerifyStatus" xml:"VerifyStatus"`
 	VerifyToken              VerifyToken  `json:"VerifyToken" xml:"VerifyToken"`
+	VerifyStatus             VerifyStatus `json:"VerifyStatus" xml:"VerifyStatus"`
 	FaceInfos                FaceInfos    `json:"FaceInfos" xml:"FaceInfos"`
 }