/
NetworkOfferingApi.go
192 lines (175 loc) · 6.59 KB
/
NetworkOfferingApi.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
package cloudstack
// ListNetworkOfferings represents the paramter of ListNetworkOfferings
type ListNetworkOfferingsParameter struct {
// the availability of network offering. Default value is Required
Availability NullString
// list network offerings by display text
DisplayText NullString
// the network offering can be used only for network creation inside the VPC
ForVpc NullBool
// list network offerings by guest type: Shared or Isolated
GuestIpType NullString
// list network offerings by id
Id ID
// true if need to list only default network offerings. Default value is false
IsDefault NullBool
// true if offering has tags specified
IsTagged NullBool
// List by keyword
Keyword NullString
// list network offerings by name
Name NullString
// the ID of the network. Pass this in if you want to see the available network
// offering that a network can be changed to.
NetworkId ID
Page NullNumber
PageSize NullNumber
// true if need to list only netwok offerings where source nat is supported,
// false otherwise
Sourcenatsupported NullBool
// true if need to list only network offerings which support specifying ip
// ranges
SpecifyIpRanges NullBool
// the tags for the network offering.
SpecifyVlan NullBool
// list network offerings by state
State NullString
// list network offerings supporting certain services
SupportedServices []string
// list network offerings by tags
Tags NullString
// list by traffic type
TrafficType NullString
// list netowrk offerings available for network creation in specific zone
ZoneId ID
}
func NewListNetworkOfferingsParameter() (p *ListNetworkOfferingsParameter) {
p = new(ListNetworkOfferingsParameter)
return p
}
// Lists all available network offerings.
func (c *Client) ListNetworkOfferings(p *ListNetworkOfferingsParameter) ([]*NetworkOffering, error) {
obj, err := c.Request("listNetworkOfferings", convertParamToMap(p))
if err != nil {
return nil, err
}
return obj.([]*NetworkOffering), err
}
// DeleteNetworkOffering represents the paramter of DeleteNetworkOffering
type DeleteNetworkOfferingParameter struct {
// the ID of the network offering
Id ID
}
func NewDeleteNetworkOfferingParameter(id string) (p *DeleteNetworkOfferingParameter) {
p = new(DeleteNetworkOfferingParameter)
p.Id.Set(id)
return p
}
// Deletes a network offering.
func (c *Client) DeleteNetworkOffering(p *DeleteNetworkOfferingParameter) (*Result, error) {
obj, err := c.Request("deleteNetworkOffering", convertParamToMap(p))
if err != nil {
return nil, err
}
return obj.(*Result), err
}
// CreateNetworkOffering represents the paramter of CreateNetworkOffering
type CreateNetworkOfferingParameter struct {
// the availability of network offering. Default value is Optional
Availability NullString
// true if the network offering is IP conserve mode enabled
ConserveMode NullBool
// Network offering details in key/value pairs. Supported keys are
// internallbprovider/publiclbprovider with service provider as a value
Details map[string]string
// the display text of the network offering
DisplayText NullString
// true if guest network default egress policy is allow; false if default egress
// policy is deny
EgressDefaultPolicy NullBool
// guest type of the network offering: Shared or Isolated
GuestIpType NullString
// true if network offering supports persistent networks; defaulted to false if
// not specified
IsPersistent NullBool
// if true keepalive will be turned on in the loadbalancer. At the time of
// writing this has only an effect on haproxy; the mode http and httpclose
// options are unset in the haproxy conf file.
KeepaliveEnabled NullBool
// maximum number of concurrent connections supported by the network offering
MaxConnections NullNumber
// the name of the network offering
Name NullString
// data transfer rate in megabits per second allowed
NetworkRate NullNumber
// desired service capabilities as part of network offering
ServiceCapabilityList map[string]string
// the service offering ID used by virtual router provider
ServiceOfferingId ID
// provider to service mapping. If not specified, the provider for the service
// will be mapped to the default provider on the physical network
ServiceProviderList map[string]string
// true if network offering supports specifying ip ranges; defaulted to false if
// not specified
SpecifyIpRanges NullBool
// true if network offering supports vlans
SpecifyVlan NullBool
// services supported by the network offering
SupportedServices []string
// the tags for the network offering.
Tags NullString
// the traffic type for the network offering. Supported type in current release
// is GUEST only
TrafficType NullString
}
func NewCreateNetworkOfferingParameter(displaytext string, guestiptype string, name string, supportedservices []string, traffictype string) (p *CreateNetworkOfferingParameter) {
p = new(CreateNetworkOfferingParameter)
p.DisplayText.Set(displaytext)
p.GuestIpType.Set(guestiptype)
p.Name.Set(name)
p.SupportedServices = supportedservices
p.TrafficType.Set(traffictype)
return p
}
// Creates a network offering.
func (c *Client) CreateNetworkOffering(p *CreateNetworkOfferingParameter) (*NetworkOffering, error) {
obj, err := c.Request("createNetworkOffering", convertParamToMap(p))
if err != nil {
return nil, err
}
return obj.(*NetworkOffering), err
}
// UpdateNetworkOffering represents the paramter of UpdateNetworkOffering
type UpdateNetworkOfferingParameter struct {
// the availability of network offering. Default value is Required for Guest
// Virtual network offering; Optional for Guest Direct network offering
Availability NullString
// the display text of the network offering
DisplayText NullString
// the id of the network offering
Id ID
// if true keepalive will be turned on in the loadbalancer. At the time of
// writing this has only an effect on haproxy; the mode http and httpclose
// options are unset in the haproxy conf file.
KeepaliveEnabled NullBool
// maximum number of concurrent connections supported by the network offering
MaxConnections NullNumber
// the name of the network offering
Name NullString
// sort key of the network offering, integer
SortKey NullNumber
// update state for the network offering
State NullString
}
func NewUpdateNetworkOfferingParameter() (p *UpdateNetworkOfferingParameter) {
p = new(UpdateNetworkOfferingParameter)
return p
}
// Updates a network offering.
func (c *Client) UpdateNetworkOffering(p *UpdateNetworkOfferingParameter) (*NetworkOffering, error) {
obj, err := c.Request("updateNetworkOffering", convertParamToMap(p))
if err != nil {
return nil, err
}
return obj.(*NetworkOffering), err
}