package drds

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

// CheckRdsSuperAccount invokes the drds.CheckRdsSuperAccount API synchronously
// api document: https://help.aliyun.com/api/drds/checkrdssuperaccount.html
func (client *Client) CheckRdsSuperAccount(request *CheckRdsSuperAccountRequest) (response *CheckRdsSuperAccountResponse, err error) {
	response = CreateCheckRdsSuperAccountResponse()
	err = client.DoAction(request, response)
	return
}

// CheckRdsSuperAccountWithChan invokes the drds.CheckRdsSuperAccount API asynchronously
// api document: https://help.aliyun.com/api/drds/checkrdssuperaccount.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) CheckRdsSuperAccountWithChan(request *CheckRdsSuperAccountRequest) (<-chan *CheckRdsSuperAccountResponse, <-chan error) {
	responseChan := make(chan *CheckRdsSuperAccountResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.CheckRdsSuperAccount(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// CheckRdsSuperAccountWithCallback invokes the drds.CheckRdsSuperAccount API asynchronously
// api document: https://help.aliyun.com/api/drds/checkrdssuperaccount.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) CheckRdsSuperAccountWithCallback(request *CheckRdsSuperAccountRequest, callback func(response *CheckRdsSuperAccountResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *CheckRdsSuperAccountResponse
		var err error
		defer close(result)
		response, err = client.CheckRdsSuperAccount(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// CheckRdsSuperAccountRequest is the request struct for api CheckRdsSuperAccount
type CheckRdsSuperAccountRequest struct {
	*requests.RpcRequest
	Password       string `position:"Query" name:"Password"`
	AccountName    string `position:"Query" name:"AccountName"`
	DbInstanceId   string `position:"Query" name:"DbInstanceId"`
	DrdsInstanceId string `position:"Query" name:"DrdsInstanceId"`
}

// CheckRdsSuperAccountResponse is the response struct for api CheckRdsSuperAccount
type CheckRdsSuperAccountResponse struct {
	*responses.BaseResponse
	RequestId string `json:"RequestId" xml:"RequestId"`
	Success   bool   `json:"Success" xml:"Success"`
}

// CreateCheckRdsSuperAccountRequest creates a request to invoke CheckRdsSuperAccount API
func CreateCheckRdsSuperAccountRequest() (request *CheckRdsSuperAccountRequest) {
	request = &CheckRdsSuperAccountRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("Drds", "2019-01-23", "CheckRdsSuperAccount", "drds", "openAPI")
	return
}

// CreateCheckRdsSuperAccountResponse creates a response to parse from CheckRdsSuperAccount response
func CreateCheckRdsSuperAccountResponse() (response *CheckRdsSuperAccountResponse) {
	response = &CheckRdsSuperAccountResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}
