forked from huaweicloud/huaweicloud-sdk-go-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_template_response_body.go
174 lines (135 loc) · 4.24 KB
/
model_template_response_body.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
package model
import (
"github.com/dysodeng/huaweicloud-sdk-go-v3/core/utils"
"errors"
"github.com/dysodeng/huaweicloud-sdk-go-v3/core/converter"
"strings"
)
// TemplateResponseBody 自动创建虚拟机模板
type TemplateResponseBody struct {
// 模板ID
Id *string `json:"id,omitempty"`
// 模板名称
Name string `json:"name"`
// 是否是通用模板,如果模板关联一个任务,则不算通用模板
IsTemplate *string `json:"is_template,omitempty"`
// Region信息
Region string `json:"region"`
// 项目ID
Projectid string `json:"projectid"`
// 目标端服务器名称
TargetServerName string `json:"target_server_name"`
// 可用区
AvailabilityZone string `json:"availability_zone"`
// 数据盘磁盘类型 SAS:串行连接SCSI SSD:固态硬盘 SATA:串口硬盘
Volumetype TemplateResponseBodyVolumetype `json:"volumetype"`
// 虚拟机规格
Flavor string `json:"flavor"`
Vpc *VpcObject `json:"vpc"`
// 网卡信息,支持多个网卡,如果是自动创建,只填一个,ID使用“autoCreate”
Nics []Nics `json:"nics"`
// 安全组,支持多个安全组,如果是自动创建,只填一个,ID使用“autoCreate”
SecurityGroups []SgObject `json:"security_groups"`
Publicip *PublicIp `json:"publicip"`
// 磁盘信息
Disk []TemplateDisk `json:"disk"`
// 数据盘磁盘类型 SAS:串行连接SCSI SSD:固态硬盘 SATA:串口硬盘
DataVolumeType TemplateResponseBodyDataVolumeType `json:"data_volume_type"`
// 目的端密码
TargetPassword string `json:"target_password"`
// 用户选择镜像版本Id值
ImageId *string `json:"image_id,omitempty"`
}
func (o TemplateResponseBody) String() string {
data, err := utils.Marshal(o)
if err != nil {
return "TemplateResponseBody struct{}"
}
return strings.Join([]string{"TemplateResponseBody", string(data)}, " ")
}
type TemplateResponseBodyVolumetype struct {
value string
}
type TemplateResponseBodyVolumetypeEnum struct {
SAS TemplateResponseBodyVolumetype
SSD TemplateResponseBodyVolumetype
SATA TemplateResponseBodyVolumetype
}
func GetTemplateResponseBodyVolumetypeEnum() TemplateResponseBodyVolumetypeEnum {
return TemplateResponseBodyVolumetypeEnum{
SAS: TemplateResponseBodyVolumetype{
value: "SAS",
},
SSD: TemplateResponseBodyVolumetype{
value: "SSD",
},
SATA: TemplateResponseBodyVolumetype{
value: "SATA",
},
}
}
func (c TemplateResponseBodyVolumetype) Value() string {
return c.value
}
func (c TemplateResponseBodyVolumetype) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *TemplateResponseBodyVolumetype) UnmarshalJSON(b []byte) error {
myConverter := converter.StringConverterFactory("string")
if myConverter == nil {
return errors.New("unsupported StringConverter type: string")
}
interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
if err != nil {
return err
}
if val, ok := interf.(string); ok {
c.value = val
return nil
} else {
return errors.New("convert enum data to string error")
}
}
type TemplateResponseBodyDataVolumeType struct {
value string
}
type TemplateResponseBodyDataVolumeTypeEnum struct {
SAS TemplateResponseBodyDataVolumeType
SSD TemplateResponseBodyDataVolumeType
SATA TemplateResponseBodyDataVolumeType
}
func GetTemplateResponseBodyDataVolumeTypeEnum() TemplateResponseBodyDataVolumeTypeEnum {
return TemplateResponseBodyDataVolumeTypeEnum{
SAS: TemplateResponseBodyDataVolumeType{
value: "SAS",
},
SSD: TemplateResponseBodyDataVolumeType{
value: "SSD",
},
SATA: TemplateResponseBodyDataVolumeType{
value: "SATA",
},
}
}
func (c TemplateResponseBodyDataVolumeType) Value() string {
return c.value
}
func (c TemplateResponseBodyDataVolumeType) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *TemplateResponseBodyDataVolumeType) UnmarshalJSON(b []byte) error {
myConverter := converter.StringConverterFactory("string")
if myConverter == nil {
return errors.New("unsupported StringConverter type: string")
}
interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
if err != nil {
return err
}
if val, ok := interf.(string); ok {
c.value = val
return nil
} else {
return errors.New("convert enum data to string error")
}
}