package vpc

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

// DescribeVpcAttribute invokes the vpc.DescribeVpcAttribute API synchronously
func (client *Client) DescribeVpcAttribute(request *DescribeVpcAttributeRequest) (response *DescribeVpcAttributeResponse, err error) {
	response = CreateDescribeVpcAttributeResponse()
	err = client.DoAction(request, response)
	return
}

// DescribeVpcAttributeWithChan invokes the vpc.DescribeVpcAttribute API asynchronously
func (client *Client) DescribeVpcAttributeWithChan(request *DescribeVpcAttributeRequest) (<-chan *DescribeVpcAttributeResponse, <-chan error) {
	responseChan := make(chan *DescribeVpcAttributeResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.DescribeVpcAttribute(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// DescribeVpcAttributeWithCallback invokes the vpc.DescribeVpcAttribute API asynchronously
func (client *Client) DescribeVpcAttributeWithCallback(request *DescribeVpcAttributeRequest, callback func(response *DescribeVpcAttributeResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *DescribeVpcAttributeResponse
		var err error
		defer close(result)
		response, err = client.DescribeVpcAttribute(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// DescribeVpcAttributeRequest is the request struct for api DescribeVpcAttribute
type DescribeVpcAttributeRequest struct {
	*requests.RpcRequest
	ResourceOwnerId      requests.Integer `position:"Query" name:"ResourceOwnerId"`
	IsDefault            requests.Boolean `position:"Query" name:"IsDefault"`
	DryRun               requests.Boolean `position:"Query" name:"DryRun"`
	ResourceOwnerAccount string           `position:"Query" name:"ResourceOwnerAccount"`
	OwnerAccount         string           `position:"Query" name:"OwnerAccount"`
	OwnerId              requests.Integer `position:"Query" name:"OwnerId"`
	VpcId                string           `position:"Query" name:"VpcId"`
}

// DescribeVpcAttributeResponse is the response struct for api DescribeVpcAttribute
type DescribeVpcAttributeResponse struct {
	*responses.BaseResponse
	CreationTime                 string                                    `json:"CreationTime" xml:"CreationTime"`
	Status                       string                                    `json:"Status" xml:"Status"`
	VpcId                        string                                    `json:"VpcId" xml:"VpcId"`
	IsDefault                    bool                                      `json:"IsDefault" xml:"IsDefault"`
	ClassicLinkEnabled           bool                                      `json:"ClassicLinkEnabled" xml:"ClassicLinkEnabled"`
	OwnerId                      int64                                     `json:"OwnerId" xml:"OwnerId"`
	RegionId                     string                                    `json:"RegionId" xml:"RegionId"`
	VpcName                      string                                    `json:"VpcName" xml:"VpcName"`
	VRouterId                    string                                    `json:"VRouterId" xml:"VRouterId"`
	DhcpOptionsSetStatus         string                                    `json:"DhcpOptionsSetStatus" xml:"DhcpOptionsSetStatus"`
	CidrBlock                    string                                    `json:"CidrBlock" xml:"CidrBlock"`
	RequestId                    string                                    `json:"RequestId" xml:"RequestId"`
	Description                  string                                    `json:"Description" xml:"Description"`
	NetworkAclNum                string                                    `json:"NetworkAclNum" xml:"NetworkAclNum"`
	ResourceGroupId              string                                    `json:"ResourceGroupId" xml:"ResourceGroupId"`
	DhcpOptionsSetId             string                                    `json:"DhcpOptionsSetId" xml:"DhcpOptionsSetId"`
	Ipv6CidrBlock                string                                    `json:"Ipv6CidrBlock" xml:"Ipv6CidrBlock"`
	SupportIpv4Gateway           bool                                      `json:"SupportIpv4Gateway" xml:"SupportIpv4Gateway"`
	Ipv4GatewayId                string                                    `json:"Ipv4GatewayId" xml:"Ipv4GatewayId"`
	EnabledIpv6                  bool                                      `json:"EnabledIpv6" xml:"EnabledIpv6"`
	DnsHostnameStatus            string                                    `json:"DnsHostnameStatus" xml:"DnsHostnameStatus"`
	VSwitchIds                   VSwitchIdsInDescribeVpcAttribute          `json:"VSwitchIds" xml:"VSwitchIds"`
	UserCidrs                    UserCidrsInDescribeVpcAttribute           `json:"UserCidrs" xml:"UserCidrs"`
	SecondaryCidrBlocks          SecondaryCidrBlocksInDescribeVpcAttribute `json:"SecondaryCidrBlocks" xml:"SecondaryCidrBlocks"`
	AssociatedCens               AssociatedCensInDescribeVpcAttribute      `json:"AssociatedCens" xml:"AssociatedCens"`
	CloudResources               CloudResourcesInDescribeVpcAttribute      `json:"CloudResources" xml:"CloudResources"`
	Ipv6CidrBlocks               Ipv6CidrBlocksInDescribeVpcAttribute      `json:"Ipv6CidrBlocks" xml:"Ipv6CidrBlocks"`
	Tags                         TagsInDescribeVpcAttribute                `json:"Tags" xml:"Tags"`
	AssociatedPropagationSources AssociatedPropagationSources              `json:"AssociatedPropagationSources" xml:"AssociatedPropagationSources"`
}

// CreateDescribeVpcAttributeRequest creates a request to invoke DescribeVpcAttribute API
func CreateDescribeVpcAttributeRequest() (request *DescribeVpcAttributeRequest) {
	request = &DescribeVpcAttributeRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("Vpc", "2016-04-28", "DescribeVpcAttribute", "vpc", "openAPI")
	request.Method = requests.POST
	return
}

// CreateDescribeVpcAttributeResponse creates a response to parse from DescribeVpcAttribute response
func CreateDescribeVpcAttributeResponse() (response *DescribeVpcAttributeResponse) {
	response = &DescribeVpcAttributeResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}
