-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
126 lines (106 loc) · 4.81 KB
/
types.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
package viettelidc
import (
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/subnetpools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/vpnaas/endpointgroups"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/vpnaas/ikepolicies"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/vpnaas/ipsecpolicies"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/vpnaas/services"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/vpnaas/siteconnections"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/openstack/networking/v2/ports"
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
)
// FloatingIPCreateOpts represents the attributes used when creating a new floating ip.
type FloatingIPCreateOpts struct {
*floatingips.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// ToFloatingIPCreateMap casts a CreateOpts struct to a map.
// It overrides floatingips.ToFloatingIPCreateMap to add the ValueSpecs field.
func (opts FloatingIPCreateOpts) ToFloatingIPCreateMap() (map[string]interface{}, error) {
return BuildRequest(opts, "floatingip")
}
// NetworkCreateOpts represents the attributes used when creating a new network.
type NetworkCreateOpts struct {
networks.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// ToNetworkCreateMap casts a CreateOpts struct to a map.
// It overrides networks.ToNetworkCreateMap to add the ValueSpecs field.
func (opts NetworkCreateOpts) ToNetworkCreateMap() (map[string]interface{}, error) {
return BuildRequest(opts, "network")
}
// IKEPolicyCreateOpts represents the attributes used when creating a new IKE policy.
type IKEPolicyCreateOpts struct {
ikepolicies.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// IKEPolicyLifetimeCreateOpts represents the attributes used when creating a new lifetime for an IKE policy.
type IKEPolicyLifetimeCreateOpts struct {
ikepolicies.LifetimeCreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// PortCreateOpts represents the attributes used when creating a new port.
type PortCreateOpts struct {
ports.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// ToPortCreateMap casts a CreateOpts struct to a map.
// It overrides ports.ToPortCreateMap to add the ValueSpecs field.
func (opts PortCreateOpts) ToPortCreateMap() (map[string]interface{}, error) {
return BuildRequest(opts, "port")
}
// RouterCreateOpts represents the attributes used when creating a new router.
type RouterCreateOpts struct {
routers.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// ToRouterCreateMap casts a CreateOpts struct to a map.
// It overrides routers.ToRouterCreateMap to add the ValueSpecs field.
func (opts RouterCreateOpts) ToRouterCreateMap() (map[string]interface{}, error) {
return BuildRequest(opts, "router")
}
// SubnetCreateOpts represents the attributes used when creating a new subnet.
type SubnetCreateOpts struct {
subnets.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// ToSubnetCreateMap casts a CreateOpts struct to a map.
// It overrides subnets.ToSubnetCreateMap to add the ValueSpecs field.
func (opts SubnetCreateOpts) ToSubnetCreateMap() (map[string]interface{}, error) {
b, err := BuildRequest(opts, "subnet")
if err != nil {
return nil, err
}
if m := b["subnet"].(map[string]interface{}); m["gateway_ip"] == "" {
m["gateway_ip"] = nil
}
return b, nil
}
// SubnetPoolCreateOpts represents the attributes used when creating a new subnet pool.
type SubnetPoolCreateOpts struct {
subnetpools.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// IPSecPolicyCreateOpts represents the attributes used when creating a new IPSec policy.
type IPSecPolicyCreateOpts struct {
ipsecpolicies.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// ServiceCreateOpts represents the attributes used when creating a new VPN service.
type ServiceCreateOpts struct {
services.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// EndpointGroupCreateOpts represents the attributes used when creating a new endpoint group.
type EndpointGroupCreateOpts struct {
endpointgroups.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}
// SiteConnectionCreateOpts represents the attributes used when creating a new IPSec site connection.
type SiteConnectionCreateOpts struct {
siteconnections.CreateOpts
ValueSpecs map[string]string `json:"value_specs,omitempty"`
}