فهرست منبع

Generated 2016-01-20 for Kms.

sdk-team 6 سال پیش
والد
کامیت
e0a39448c2

+ 4 - 0
ChangeLog.txt

@@ -1,3 +1,7 @@
+2019-12-31 Version: v1.60.310
+- Generated 2016-01-20 for `Kms`.
+- Support asymmetric keys.
+
 2019-12-31 Version: v1.60.309
 - Generated 2019-02-14 for `Ons`.
 - Add request parameter groupType for OnsGroupCreate.

+ 109 - 0
services/kms/asymmetric_decrypt.go

@@ -0,0 +1,109 @@
+package kms
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// AsymmetricDecrypt invokes the kms.AsymmetricDecrypt API synchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricdecrypt.html
+func (client *Client) AsymmetricDecrypt(request *AsymmetricDecryptRequest) (response *AsymmetricDecryptResponse, err error) {
+	response = CreateAsymmetricDecryptResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// AsymmetricDecryptWithChan invokes the kms.AsymmetricDecrypt API asynchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricdecrypt.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) AsymmetricDecryptWithChan(request *AsymmetricDecryptRequest) (<-chan *AsymmetricDecryptResponse, <-chan error) {
+	responseChan := make(chan *AsymmetricDecryptResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.AsymmetricDecrypt(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// AsymmetricDecryptWithCallback invokes the kms.AsymmetricDecrypt API asynchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricdecrypt.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) AsymmetricDecryptWithCallback(request *AsymmetricDecryptRequest, callback func(response *AsymmetricDecryptResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *AsymmetricDecryptResponse
+		var err error
+		defer close(result)
+		response, err = client.AsymmetricDecrypt(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// AsymmetricDecryptRequest is the request struct for api AsymmetricDecrypt
+type AsymmetricDecryptRequest struct {
+	*requests.RpcRequest
+	KeyVersionId   string `position:"Query" name:"KeyVersionId"`
+	KeyId          string `position:"Query" name:"KeyId"`
+	CiphertextBlob string `position:"Query" name:"CiphertextBlob"`
+	Algorithm      string `position:"Query" name:"Algorithm"`
+}
+
+// AsymmetricDecryptResponse is the response struct for api AsymmetricDecrypt
+type AsymmetricDecryptResponse struct {
+	*responses.BaseResponse
+	Plaintext    string `json:"Plaintext" xml:"Plaintext"`
+	KeyId        string `json:"KeyId" xml:"KeyId"`
+	RequestId    string `json:"RequestId" xml:"RequestId"`
+	KeyVersionId string `json:"KeyVersionId" xml:"KeyVersionId"`
+}
+
+// CreateAsymmetricDecryptRequest creates a request to invoke AsymmetricDecrypt API
+func CreateAsymmetricDecryptRequest() (request *AsymmetricDecryptRequest) {
+	request = &AsymmetricDecryptRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("Kms", "2016-01-20", "AsymmetricDecrypt", "kms", "openAPI")
+	return
+}
+
+// CreateAsymmetricDecryptResponse creates a response to parse from AsymmetricDecrypt response
+func CreateAsymmetricDecryptResponse() (response *AsymmetricDecryptResponse) {
+	response = &AsymmetricDecryptResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 109 - 0
services/kms/asymmetric_encrypt.go

@@ -0,0 +1,109 @@
+package kms
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// AsymmetricEncrypt invokes the kms.AsymmetricEncrypt API synchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricencrypt.html
+func (client *Client) AsymmetricEncrypt(request *AsymmetricEncryptRequest) (response *AsymmetricEncryptResponse, err error) {
+	response = CreateAsymmetricEncryptResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// AsymmetricEncryptWithChan invokes the kms.AsymmetricEncrypt API asynchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricencrypt.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) AsymmetricEncryptWithChan(request *AsymmetricEncryptRequest) (<-chan *AsymmetricEncryptResponse, <-chan error) {
+	responseChan := make(chan *AsymmetricEncryptResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.AsymmetricEncrypt(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// AsymmetricEncryptWithCallback invokes the kms.AsymmetricEncrypt API asynchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricencrypt.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) AsymmetricEncryptWithCallback(request *AsymmetricEncryptRequest, callback func(response *AsymmetricEncryptResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *AsymmetricEncryptResponse
+		var err error
+		defer close(result)
+		response, err = client.AsymmetricEncrypt(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// AsymmetricEncryptRequest is the request struct for api AsymmetricEncrypt
+type AsymmetricEncryptRequest struct {
+	*requests.RpcRequest
+	KeyVersionId string `position:"Query" name:"KeyVersionId"`
+	KeyId        string `position:"Query" name:"KeyId"`
+	Plaintext    string `position:"Query" name:"Plaintext"`
+	Algorithm    string `position:"Query" name:"Algorithm"`
+}
+
+// AsymmetricEncryptResponse is the response struct for api AsymmetricEncrypt
+type AsymmetricEncryptResponse struct {
+	*responses.BaseResponse
+	CiphertextBlob string `json:"CiphertextBlob" xml:"CiphertextBlob"`
+	KeyId          string `json:"KeyId" xml:"KeyId"`
+	RequestId      string `json:"RequestId" xml:"RequestId"`
+	KeyVersionId   string `json:"KeyVersionId" xml:"KeyVersionId"`
+}
+
+// CreateAsymmetricEncryptRequest creates a request to invoke AsymmetricEncrypt API
+func CreateAsymmetricEncryptRequest() (request *AsymmetricEncryptRequest) {
+	request = &AsymmetricEncryptRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("Kms", "2016-01-20", "AsymmetricEncrypt", "kms", "openAPI")
+	return
+}
+
+// CreateAsymmetricEncryptResponse creates a response to parse from AsymmetricEncrypt response
+func CreateAsymmetricEncryptResponse() (response *AsymmetricEncryptResponse) {
+	response = &AsymmetricEncryptResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 109 - 0
services/kms/asymmetric_sign.go

@@ -0,0 +1,109 @@
+package kms
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// AsymmetricSign invokes the kms.AsymmetricSign API synchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricsign.html
+func (client *Client) AsymmetricSign(request *AsymmetricSignRequest) (response *AsymmetricSignResponse, err error) {
+	response = CreateAsymmetricSignResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// AsymmetricSignWithChan invokes the kms.AsymmetricSign API asynchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricsign.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) AsymmetricSignWithChan(request *AsymmetricSignRequest) (<-chan *AsymmetricSignResponse, <-chan error) {
+	responseChan := make(chan *AsymmetricSignResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.AsymmetricSign(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// AsymmetricSignWithCallback invokes the kms.AsymmetricSign API asynchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricsign.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) AsymmetricSignWithCallback(request *AsymmetricSignRequest, callback func(response *AsymmetricSignResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *AsymmetricSignResponse
+		var err error
+		defer close(result)
+		response, err = client.AsymmetricSign(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// AsymmetricSignRequest is the request struct for api AsymmetricSign
+type AsymmetricSignRequest struct {
+	*requests.RpcRequest
+	KeyVersionId string `position:"Query" name:"KeyVersionId"`
+	Digest       string `position:"Query" name:"Digest"`
+	KeyId        string `position:"Query" name:"KeyId"`
+	Algorithm    string `position:"Query" name:"Algorithm"`
+}
+
+// AsymmetricSignResponse is the response struct for api AsymmetricSign
+type AsymmetricSignResponse struct {
+	*responses.BaseResponse
+	Value        string `json:"Value" xml:"Value"`
+	KeyId        string `json:"KeyId" xml:"KeyId"`
+	RequestId    string `json:"RequestId" xml:"RequestId"`
+	KeyVersionId string `json:"KeyVersionId" xml:"KeyVersionId"`
+}
+
+// CreateAsymmetricSignRequest creates a request to invoke AsymmetricSign API
+func CreateAsymmetricSignRequest() (request *AsymmetricSignRequest) {
+	request = &AsymmetricSignRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("Kms", "2016-01-20", "AsymmetricSign", "kms", "openAPI")
+	return
+}
+
+// CreateAsymmetricSignResponse creates a response to parse from AsymmetricSign response
+func CreateAsymmetricSignResponse() (response *AsymmetricSignResponse) {
+	response = &AsymmetricSignResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 110 - 0
services/kms/asymmetric_verify.go

@@ -0,0 +1,110 @@
+package kms
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// AsymmetricVerify invokes the kms.AsymmetricVerify API synchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricverify.html
+func (client *Client) AsymmetricVerify(request *AsymmetricVerifyRequest) (response *AsymmetricVerifyResponse, err error) {
+	response = CreateAsymmetricVerifyResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// AsymmetricVerifyWithChan invokes the kms.AsymmetricVerify API asynchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricverify.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) AsymmetricVerifyWithChan(request *AsymmetricVerifyRequest) (<-chan *AsymmetricVerifyResponse, <-chan error) {
+	responseChan := make(chan *AsymmetricVerifyResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.AsymmetricVerify(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// AsymmetricVerifyWithCallback invokes the kms.AsymmetricVerify API asynchronously
+// api document: https://help.aliyun.com/api/kms/asymmetricverify.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) AsymmetricVerifyWithCallback(request *AsymmetricVerifyRequest, callback func(response *AsymmetricVerifyResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *AsymmetricVerifyResponse
+		var err error
+		defer close(result)
+		response, err = client.AsymmetricVerify(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// AsymmetricVerifyRequest is the request struct for api AsymmetricVerify
+type AsymmetricVerifyRequest struct {
+	*requests.RpcRequest
+	KeyVersionId string `position:"Query" name:"KeyVersionId"`
+	Digest       string `position:"Query" name:"Digest"`
+	KeyId        string `position:"Query" name:"KeyId"`
+	Value        string `position:"Query" name:"Value"`
+	Algorithm    string `position:"Query" name:"Algorithm"`
+}
+
+// AsymmetricVerifyResponse is the response struct for api AsymmetricVerify
+type AsymmetricVerifyResponse struct {
+	*responses.BaseResponse
+	Value        bool   `json:"Value" xml:"Value"`
+	KeyId        string `json:"KeyId" xml:"KeyId"`
+	RequestId    string `json:"RequestId" xml:"RequestId"`
+	KeyVersionId string `json:"KeyVersionId" xml:"KeyVersionId"`
+}
+
+// CreateAsymmetricVerifyRequest creates a request to invoke AsymmetricVerify API
+func CreateAsymmetricVerifyRequest() (request *AsymmetricVerifyRequest) {
+	request = &AsymmetricVerifyRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("Kms", "2016-01-20", "AsymmetricVerify", "kms", "openAPI")
+	return
+}
+
+// CreateAsymmetricVerifyResponse creates a response to parse from AsymmetricVerify response
+func CreateAsymmetricVerifyResponse() (response *AsymmetricVerifyResponse) {
+	response = &AsymmetricVerifyResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 1 - 0
services/kms/create_key.go

@@ -80,6 +80,7 @@ type CreateKeyRequest struct {
 	KeyUsage                string           `position:"Query" name:"KeyUsage"`
 	Origin                  string           `position:"Query" name:"Origin"`
 	Description             string           `position:"Query" name:"Description"`
+	KeySpec                 string           `position:"Query" name:"KeySpec"`
 	RotationInterval        string           `position:"Query" name:"RotationInterval"`
 	EnableAutomaticRotation requests.Boolean `position:"Query" name:"EnableAutomaticRotation"`
 }

+ 104 - 0
services/kms/create_key_version.go

@@ -0,0 +1,104 @@
+package kms
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// CreateKeyVersion invokes the kms.CreateKeyVersion API synchronously
+// api document: https://help.aliyun.com/api/kms/createkeyversion.html
+func (client *Client) CreateKeyVersion(request *CreateKeyVersionRequest) (response *CreateKeyVersionResponse, err error) {
+	response = CreateCreateKeyVersionResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// CreateKeyVersionWithChan invokes the kms.CreateKeyVersion API asynchronously
+// api document: https://help.aliyun.com/api/kms/createkeyversion.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) CreateKeyVersionWithChan(request *CreateKeyVersionRequest) (<-chan *CreateKeyVersionResponse, <-chan error) {
+	responseChan := make(chan *CreateKeyVersionResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.CreateKeyVersion(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// CreateKeyVersionWithCallback invokes the kms.CreateKeyVersion API asynchronously
+// api document: https://help.aliyun.com/api/kms/createkeyversion.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) CreateKeyVersionWithCallback(request *CreateKeyVersionRequest, callback func(response *CreateKeyVersionResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *CreateKeyVersionResponse
+		var err error
+		defer close(result)
+		response, err = client.CreateKeyVersion(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// CreateKeyVersionRequest is the request struct for api CreateKeyVersion
+type CreateKeyVersionRequest struct {
+	*requests.RpcRequest
+	KeyId string `position:"Query" name:"KeyId"`
+}
+
+// CreateKeyVersionResponse is the response struct for api CreateKeyVersion
+type CreateKeyVersionResponse struct {
+	*responses.BaseResponse
+	RequestId  string     `json:"RequestId" xml:"RequestId"`
+	KeyVersion KeyVersion `json:"KeyVersion" xml:"KeyVersion"`
+}
+
+// CreateCreateKeyVersionRequest creates a request to invoke CreateKeyVersion API
+func CreateCreateKeyVersionRequest() (request *CreateKeyVersionRequest) {
+	request = &CreateKeyVersionRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("Kms", "2016-01-20", "CreateKeyVersion", "kms", "openAPI")
+	return
+}
+
+// CreateCreateKeyVersionResponse creates a response to parse from CreateKeyVersion response
+func CreateCreateKeyVersionResponse() (response *CreateKeyVersionResponse) {
+	response = &CreateKeyVersionResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 107 - 0
services/kms/get_public_key.go

@@ -0,0 +1,107 @@
+package kms
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// GetPublicKey invokes the kms.GetPublicKey API synchronously
+// api document: https://help.aliyun.com/api/kms/getpublickey.html
+func (client *Client) GetPublicKey(request *GetPublicKeyRequest) (response *GetPublicKeyResponse, err error) {
+	response = CreateGetPublicKeyResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// GetPublicKeyWithChan invokes the kms.GetPublicKey API asynchronously
+// api document: https://help.aliyun.com/api/kms/getpublickey.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) GetPublicKeyWithChan(request *GetPublicKeyRequest) (<-chan *GetPublicKeyResponse, <-chan error) {
+	responseChan := make(chan *GetPublicKeyResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.GetPublicKey(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// GetPublicKeyWithCallback invokes the kms.GetPublicKey API asynchronously
+// api document: https://help.aliyun.com/api/kms/getpublickey.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) GetPublicKeyWithCallback(request *GetPublicKeyRequest, callback func(response *GetPublicKeyResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *GetPublicKeyResponse
+		var err error
+		defer close(result)
+		response, err = client.GetPublicKey(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// GetPublicKeyRequest is the request struct for api GetPublicKey
+type GetPublicKeyRequest struct {
+	*requests.RpcRequest
+	KeyVersionId string `position:"Query" name:"KeyVersionId"`
+	KeyId        string `position:"Query" name:"KeyId"`
+}
+
+// GetPublicKeyResponse is the response struct for api GetPublicKey
+type GetPublicKeyResponse struct {
+	*responses.BaseResponse
+	PublicKey    string `json:"PublicKey" xml:"PublicKey"`
+	KeyId        string `json:"KeyId" xml:"KeyId"`
+	RequestId    string `json:"RequestId" xml:"RequestId"`
+	KeyVersionId string `json:"KeyVersionId" xml:"KeyVersionId"`
+}
+
+// CreateGetPublicKeyRequest creates a request to invoke GetPublicKey API
+func CreateGetPublicKeyRequest() (request *GetPublicKeyRequest) {
+	request = &GetPublicKeyRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("Kms", "2016-01-20", "GetPublicKey", "kms", "openAPI")
+	return
+}
+
+// CreateGetPublicKeyResponse creates a response to parse from GetPublicKey response
+func CreateGetPublicKeyResponse() (response *GetPublicKeyResponse) {
+	response = &GetPublicKeyResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 1 - 0
services/kms/struct_key_metadata.go

@@ -19,6 +19,7 @@ package kms
 type KeyMetadata struct {
 	NextRotationDate   string `json:"NextRotationDate" xml:"NextRotationDate"`
 	ProtectionLevel    string `json:"ProtectionLevel" xml:"ProtectionLevel"`
+	KeySpec            string `json:"KeySpec" xml:"KeySpec"`
 	KeyUsage           string `json:"KeyUsage" xml:"KeyUsage"`
 	DeleteDate         string `json:"DeleteDate" xml:"DeleteDate"`
 	AutomaticRotation  string `json:"AutomaticRotation" xml:"AutomaticRotation"`