-
Notifications
You must be signed in to change notification settings - Fork 51
/
model_privateip.go
139 lines (111 loc) · 3.21 KB
/
model_privateip.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
package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"errors"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
"strings"
)
// Privateip
type Privateip struct {
// 私有IP的状态 - ACTIVE:活动的 - DOWN:不可用
Status PrivateipStatus `json:"status"`
// 私有IP ID
Id string `json:"id"`
// 分配IP的子网标识
SubnetId string `json:"subnet_id"`
// 项目ID
TenantId string `json:"tenant_id"`
// 私有IP的使用者,空表示未使用 取值范围:network:dhcp,network:router_interface_distributed,compute:xxx(xxx对应具体的az名称,例如compute:aa-bb-cc表示是被aa-bb-cc上的虚拟机使用) 约束:此处的取值范围只是本服务支持的类型,其他类型未做标注
DeviceOwner PrivateipDeviceOwner `json:"device_owner"`
// 申请到的私有IP
IpAddress string `json:"ip_address"`
}
func (o Privateip) String() string {
data, err := utils.Marshal(o)
if err != nil {
return "Privateip struct{}"
}
return strings.Join([]string{"Privateip", string(data)}, " ")
}
type PrivateipStatus struct {
value string
}
type PrivateipStatusEnum struct {
ACTIVE PrivateipStatus
DOWN PrivateipStatus
}
func GetPrivateipStatusEnum() PrivateipStatusEnum {
return PrivateipStatusEnum{
ACTIVE: PrivateipStatus{
value: "ACTIVE",
},
DOWN: PrivateipStatus{
value: "DOWN",
},
}
}
func (c PrivateipStatus) Value() string {
return c.value
}
func (c PrivateipStatus) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *PrivateipStatus) 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 PrivateipDeviceOwner struct {
value string
}
type PrivateipDeviceOwnerEnum struct {
NETWORKDHCP PrivateipDeviceOwner
NETWORKROUTER_INTERFACE_DISTRIBUTED PrivateipDeviceOwner
COMPUTEXXX PrivateipDeviceOwner
}
func GetPrivateipDeviceOwnerEnum() PrivateipDeviceOwnerEnum {
return PrivateipDeviceOwnerEnum{
NETWORKDHCP: PrivateipDeviceOwner{
value: "network:dhcp",
},
NETWORKROUTER_INTERFACE_DISTRIBUTED: PrivateipDeviceOwner{
value: "network:router_interface_distributed",
},
COMPUTEXXX: PrivateipDeviceOwner{
value: "compute:xxx",
},
}
}
func (c PrivateipDeviceOwner) Value() string {
return c.value
}
func (c PrivateipDeviceOwner) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *PrivateipDeviceOwner) 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")
}
}