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

package vpc

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

// UpdateSubnetAttributeRequest is request schema for UpdateSubnetAttribute action
type UpdateSubnetAttributeRequest struct {
	request.CommonBase

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

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

	// 子网ID
	SubnetId *string `required:"true"`

	// 子网名称(如果Name不填写，Tag必须填写)
	Name *string `required:"false"`

	// 业务组名称(如果Tag不填写，Name必须填写)
	Tag *string `required:"false"`
}

// UpdateSubnetAttributeResponse is response schema for UpdateSubnetAttribute action
type UpdateSubnetAttributeResponse struct {
	response.CommonBase
}

// NewUpdateSubnetAttributeRequest will create request of UpdateSubnetAttribute action.
func (c *VPCClient) NewUpdateSubnetAttributeRequest() *UpdateSubnetAttributeRequest {
	req := &UpdateSubnetAttributeRequest{}

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

// UpdateSubnetAttribute - 更新子网信息
func (c *VPCClient) UpdateSubnetAttribute(req *UpdateSubnetAttributeRequest) (*UpdateSubnetAttributeResponse, error) {
	var err error
	var res UpdateSubnetAttributeResponse

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

	return &res, nil
}
