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

package unet

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

// DescribeBandwidthUsageRequest is request schema for DescribeBandwidthUsage action
type DescribeBandwidthUsageRequest struct {
	request.CommonBase

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

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

	// 返回数据分页值, 取值范围为 [0,10000000] 之间的整数, 默认为20
	Limit *int `required:"false"`

	// 返回数据偏移量, 默认为0
	OffSet *int `required:"false"`

	// 弹性IP的资源Id. 如果为空, 则返回当前 Region中符合条件的所有EIP的带宽用量, n为自然数
	EIPIds []string `required:"false"`
}

// DescribeBandwidthUsageResponse is response schema for DescribeBandwidthUsage action
type DescribeBandwidthUsageResponse struct {
	response.CommonBase

	// EIPSet中的元素个数
	TotalCount int

	// 单个弹性IP的带宽用量详细信息, 详见 UnetBandwidthUsageEIPSet, 如没有弹性IP资源则没有该返回值。
	EIPSet []UnetBandwidthUsageEIPSet
}

// NewDescribeBandwidthUsageRequest will create request of DescribeBandwidthUsage action.
func (c *UNetClient) NewDescribeBandwidthUsageRequest() *DescribeBandwidthUsageRequest {
	req := &DescribeBandwidthUsageRequest{}

	// 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
}

// DescribeBandwidthUsage - 获取带宽用量信息
func (c *UNetClient) DescribeBandwidthUsage(req *DescribeBandwidthUsageRequest) (*DescribeBandwidthUsageResponse, error) {
	var err error
	var res DescribeBandwidthUsageResponse

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

	return &res, nil
}
