forked from rancher/convoy
/
generated_openstack_config.go
107 lines (75 loc) · 3.4 KB
/
generated_openstack_config.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
package client
const (
OPENSTACK_CONFIG_TYPE = "openstackConfig"
)
type OpenstackConfig struct {
Resource
AuthUrl string `json:"authUrl,omitempty" yaml:"auth_url,omitempty"`
AvailabilityZone string `json:"availabilityZone,omitempty" yaml:"availability_zone,omitempty"`
DomainId string `json:"domainId,omitempty" yaml:"domain_id,omitempty"`
DomainName string `json:"domainName,omitempty" yaml:"domain_name,omitempty"`
EndpointType string `json:"endpointType,omitempty" yaml:"endpoint_type,omitempty"`
FlavorId string `json:"flavorId,omitempty" yaml:"flavor_id,omitempty"`
FlavorName string `json:"flavorName,omitempty" yaml:"flavor_name,omitempty"`
FloatingipPool string `json:"floatingipPool,omitempty" yaml:"floatingip_pool,omitempty"`
ImageId string `json:"imageId,omitempty" yaml:"image_id,omitempty"`
ImageName string `json:"imageName,omitempty" yaml:"image_name,omitempty"`
Insecure bool `json:"insecure,omitempty" yaml:"insecure,omitempty"`
NetId string `json:"netId,omitempty" yaml:"net_id,omitempty"`
NetName string `json:"netName,omitempty" yaml:"net_name,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
SecGroups string `json:"secGroups,omitempty" yaml:"sec_groups,omitempty"`
SshPort string `json:"sshPort,omitempty" yaml:"ssh_port,omitempty"`
SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"`
TenantId string `json:"tenantId,omitempty" yaml:"tenant_id,omitempty"`
TenantName string `json:"tenantName,omitempty" yaml:"tenant_name,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
}
type OpenstackConfigCollection struct {
Collection
Data []OpenstackConfig `json:"data,omitempty"`
}
type OpenstackConfigClient struct {
rancherClient *RancherClient
}
type OpenstackConfigOperations interface {
List(opts *ListOpts) (*OpenstackConfigCollection, error)
Create(opts *OpenstackConfig) (*OpenstackConfig, error)
Update(existing *OpenstackConfig, updates interface{}) (*OpenstackConfig, error)
ById(id string) (*OpenstackConfig, error)
Delete(container *OpenstackConfig) error
}
func newOpenstackConfigClient(rancherClient *RancherClient) *OpenstackConfigClient {
return &OpenstackConfigClient{
rancherClient: rancherClient,
}
}
func (c *OpenstackConfigClient) Create(container *OpenstackConfig) (*OpenstackConfig, error) {
resp := &OpenstackConfig{}
err := c.rancherClient.doCreate(OPENSTACK_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *OpenstackConfigClient) Update(existing *OpenstackConfig, updates interface{}) (*OpenstackConfig, error) {
resp := &OpenstackConfig{}
err := c.rancherClient.doUpdate(OPENSTACK_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *OpenstackConfigClient) List(opts *ListOpts) (*OpenstackConfigCollection, error) {
resp := &OpenstackConfigCollection{}
err := c.rancherClient.doList(OPENSTACK_CONFIG_TYPE, opts, resp)
return resp, err
}
func (c *OpenstackConfigClient) ById(id string) (*OpenstackConfig, error) {
resp := &OpenstackConfig{}
err := c.rancherClient.doById(OPENSTACK_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *OpenstackConfigClient) Delete(container *OpenstackConfig) error {
return c.rancherClient.doResourceDelete(OPENSTACK_CONFIG_TYPE, &container.Resource)
}