-
Notifications
You must be signed in to change notification settings - Fork 38
/
create_phost.go
95 lines (68 loc) · 2.87 KB
/
create_phost.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors.
//go:generate ucloud-gen-go-api UPHost CreatePHost
package uphost
import (
"github.com/ucloud/ucloud-sdk-go/ucloud/request"
"github.com/ucloud/ucloud-sdk-go/ucloud/response"
)
// CreatePHostRequest is request schema for CreatePHost action
type CreatePHostRequest struct {
request.CommonBase
// 可用区。参见 [可用区列表](../summary/regionlist.html)
// Zone *string `required:"true"`
// 镜像ID。 请通过 [DescribePHostImage]获取
ImageId *string `required:"true"`
// 密码(密码需使用base64进行编码)
Password *string `required:"true"`
// 物理机类型,默认为:db-2(基础型-SAS-V3)
Type *string `required:"false"`
// 物理机名称,默认为phost
Name *string `required:"false"`
// 物理机备注,默认为空
Remark *string `required:"false"`
// 业务组,默认为default
Tag *string `required:"false"`
// 计费模式,枚举值为:year, 按年付费; month,按月付费;dynamic,按需付费,(需开启权限) trial, 试用(需开启权限)。默认为按月付费
ChargeType *string `required:"false"`
// 购买时长,默认为1,范围[1-10]
Quantity *string `required:"false"`
// 购买数量,默认为1,(暂不支持)
Count *int `required:"false"`
// 防火墙Id,默认:Web推荐防火墙。如何查询SecurityGroupId请参见 [DescribeSecurityGroup](../unet-api/describe_security_group.html)
SecurityGroupId *string `required:"false"`
// Raid配置,默认Raid10 支持:Raid0、Raid1、Raid5、Raid10,NoRaid
Raid *string `required:"false"`
// 网络环境,可选千兆:1G ,万兆:10G, 默认1G
Cluster *string `required:"false"`
// VPC ID,不填为默认,VPC2.0下需要填写此字段。
VPCId *string `required:"false"`
// 子网ID,不填为默认,VPC2.0下需要填写此字段。
SubnetId *string `required:"false"`
// 代金券
CouponId *string `required:"false"`
}
// CreatePHostResponse is response schema for CreatePHost action
type CreatePHostResponse struct {
response.CommonBase
// PHost的资源ID数组
PHostId []string
}
// NewCreatePHostRequest will create request of CreatePHost action.
func (c *UPHostClient) NewCreatePHostRequest() *CreatePHostRequest {
req := &CreatePHostRequest{}
// 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
}
// CreatePHost - 指定数据中心,根据资源使用量创建指定数量的UPHost物理云主机实例。
func (c *UPHostClient) CreatePHost(req *CreatePHostRequest) (*CreatePHostResponse, error) {
var err error
var res CreatePHostResponse
err = c.Client.InvokeAction("CreatePHost", req, &res)
if err != nil {
return &res, err
}
return &res, nil
}