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

package uhost

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

// TerminateCustomImageRequest is request schema for TerminateCustomImage action
type TerminateCustomImageRequest struct {
	request.CommonBase

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

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

	// 自制镜像ID 参见 [DescribeImage](describe_image.html)
	ImageId *string `required:"true"`
}

// TerminateCustomImageResponse is response schema for TerminateCustomImage action
type TerminateCustomImageResponse struct {
	response.CommonBase

	// 自制镜像Id
	ImageId string
}

// NewTerminateCustomImageRequest will create request of TerminateCustomImage action.
func (c *UHostClient) NewTerminateCustomImageRequest() *TerminateCustomImageRequest {
	req := &TerminateCustomImageRequest{}

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

// TerminateCustomImage - 删除用户自定义镜像
func (c *UHostClient) TerminateCustomImage(req *TerminateCustomImageRequest) (*TerminateCustomImageResponse, error) {
	var err error
	var res TerminateCustomImageResponse

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

	return &res, nil
}
