package polardb

//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"
)

// DescribeActivationCodeDetails invokes the polardb.DescribeActivationCodeDetails API synchronously
func (client *Client) DescribeActivationCodeDetails(request *DescribeActivationCodeDetailsRequest) (response *DescribeActivationCodeDetailsResponse, err error) {
	response = CreateDescribeActivationCodeDetailsResponse()
	err = client.DoAction(request, response)
	return
}

// DescribeActivationCodeDetailsWithChan invokes the polardb.DescribeActivationCodeDetails API asynchronously
func (client *Client) DescribeActivationCodeDetailsWithChan(request *DescribeActivationCodeDetailsRequest) (<-chan *DescribeActivationCodeDetailsResponse, <-chan error) {
	responseChan := make(chan *DescribeActivationCodeDetailsResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.DescribeActivationCodeDetails(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// DescribeActivationCodeDetailsWithCallback invokes the polardb.DescribeActivationCodeDetails API asynchronously
func (client *Client) DescribeActivationCodeDetailsWithCallback(request *DescribeActivationCodeDetailsRequest, callback func(response *DescribeActivationCodeDetailsResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *DescribeActivationCodeDetailsResponse
		var err error
		defer close(result)
		response, err = client.DescribeActivationCodeDetails(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// DescribeActivationCodeDetailsRequest is the request struct for api DescribeActivationCodeDetails
type DescribeActivationCodeDetailsRequest struct {
	*requests.RpcRequest
	ResourceOwnerId      requests.Integer `position:"Query" name:"ResourceOwnerId"`
	ActivationCodeId     requests.Integer `position:"Query" name:"ActivationCodeId"`
	AliyunOrderId        string           `position:"Query" name:"AliyunOrderId"`
	ResourceOwnerAccount string           `position:"Query" name:"ResourceOwnerAccount"`
	OwnerAccount         string           `position:"Query" name:"OwnerAccount"`
	OwnerId              requests.Integer `position:"Query" name:"OwnerId"`
}

// DescribeActivationCodeDetailsResponse is the response struct for api DescribeActivationCodeDetails
type DescribeActivationCodeDetailsResponse struct {
	*responses.BaseResponse
	ActivateAt       string `json:"ActivateAt" xml:"ActivateAt"`
	CertContentB64   string `json:"CertContentB64" xml:"CertContentB64"`
	Description      string `json:"Description" xml:"Description"`
	ExpireAt         string `json:"ExpireAt" xml:"ExpireAt"`
	GmtCreated       string `json:"GmtCreated" xml:"GmtCreated"`
	GmtModified      string `json:"GmtModified" xml:"GmtModified"`
	Id               int    `json:"Id" xml:"Id"`
	MacAddress       string `json:"MacAddress" xml:"MacAddress"`
	Name             string `json:"Name" xml:"Name"`
	RequestId        string `json:"RequestId" xml:"RequestId"`
	SystemIdentifier string `json:"SystemIdentifier" xml:"SystemIdentifier"`
}

// CreateDescribeActivationCodeDetailsRequest creates a request to invoke DescribeActivationCodeDetails API
func CreateDescribeActivationCodeDetailsRequest() (request *DescribeActivationCodeDetailsRequest) {
	request = &DescribeActivationCodeDetailsRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("polardb", "2017-08-01", "DescribeActivationCodeDetails", "polardb", "openAPI")
	request.Method = requests.POST
	return
}

// CreateDescribeActivationCodeDetailsResponse creates a response to parse from DescribeActivationCodeDetails response
func CreateDescribeActivationCodeDetailsResponse() (response *DescribeActivationCodeDetailsResponse) {
	response = &DescribeActivationCodeDetailsResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}
