//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors.
//go:generate ucloud-gen-go-api VPC DescribeVPC

package vpc

import (
	"github.com/ucloud/ucloud-sdk-go/ucloud/request"
	"github.com/ucloud/ucloud-sdk-go/ucloud/response"
)

// DescribeVPCRequest is request schema for DescribeVPC action
type DescribeVPCRequest struct {
	request.CommonBase

	// [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
	// Region *string `required:"true"`

	// [公共参数] 项目ID。不填写为默认项目，子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
	// ProjectId *string `required:"true"`

	// VPCId
	VPCIds []string `required:"false"`

	// 业务组名称
	Tag *string `required:"false"`

	// 偏移量
	Offset *int `required:"false"`

	// 列表长度
	Limit *int `required:"false"`
}

// DescribeVPCResponse is response schema for DescribeVPC action
type DescribeVPCResponse struct {
	response.CommonBase

	// vpc信息，具体结构见下方VPCInfo
	DataSet []VPCInfo
}

// NewDescribeVPCRequest will create request of DescribeVPC action.
func (c *VPCClient) NewDescribeVPCRequest() *DescribeVPCRequest {
	req := &DescribeVPCRequest{}

	// setup request with client config
	c.Client.SetupRequest(req)

	// setup retryable with default retry policy (retry for non-create action and common error)
	req.SetRetryable(true)
	return req
}

// DescribeVPC - 获取VPC信息
func (c *VPCClient) DescribeVPC(req *DescribeVPCRequest) (*DescribeVPCResponse, error) {
	var err error
	var res DescribeVPCResponse

	err = c.Client.InvokeAction("DescribeVPC", req, &res)
	if err != nil {
		return &res, err
	}

	return &res, nil
}
