forked from rancher/convoy
/
generated_virtualbox_config.go
79 lines (61 loc) · 2.45 KB
/
generated_virtualbox_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
package client
const (
VIRTUALBOX_CONFIG_TYPE = "virtualboxConfig"
)
type VirtualboxConfig struct {
Resource
Boot2dockerUrl string `json:"boot2dockerUrl,omitempty" yaml:"boot2docker_url,omitempty"`
CpuCount string `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"`
DiskSize string `json:"diskSize,omitempty" yaml:"disk_size,omitempty"`
HostonlyCidr string `json:"hostonlyCidr,omitempty" yaml:"hostonly_cidr,omitempty"`
ImportBoot2dockerVm string `json:"importBoot2dockerVm,omitempty" yaml:"import_boot2docker_vm,omitempty"`
Memory string `json:"memory,omitempty" yaml:"memory,omitempty"`
NoShare bool `json:"noShare,omitempty" yaml:"no_share,omitempty"`
}
type VirtualboxConfigCollection struct {
Collection
Data []VirtualboxConfig `json:"data,omitempty"`
}
type VirtualboxConfigClient struct {
rancherClient *RancherClient
}
type VirtualboxConfigOperations interface {
List(opts *ListOpts) (*VirtualboxConfigCollection, error)
Create(opts *VirtualboxConfig) (*VirtualboxConfig, error)
Update(existing *VirtualboxConfig, updates interface{}) (*VirtualboxConfig, error)
ById(id string) (*VirtualboxConfig, error)
Delete(container *VirtualboxConfig) error
}
func newVirtualboxConfigClient(rancherClient *RancherClient) *VirtualboxConfigClient {
return &VirtualboxConfigClient{
rancherClient: rancherClient,
}
}
func (c *VirtualboxConfigClient) Create(container *VirtualboxConfig) (*VirtualboxConfig, error) {
resp := &VirtualboxConfig{}
err := c.rancherClient.doCreate(VIRTUALBOX_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *VirtualboxConfigClient) Update(existing *VirtualboxConfig, updates interface{}) (*VirtualboxConfig, error) {
resp := &VirtualboxConfig{}
err := c.rancherClient.doUpdate(VIRTUALBOX_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *VirtualboxConfigClient) List(opts *ListOpts) (*VirtualboxConfigCollection, error) {
resp := &VirtualboxConfigCollection{}
err := c.rancherClient.doList(VIRTUALBOX_CONFIG_TYPE, opts, resp)
return resp, err
}
func (c *VirtualboxConfigClient) ById(id string) (*VirtualboxConfig, error) {
resp := &VirtualboxConfig{}
err := c.rancherClient.doById(VIRTUALBOX_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *VirtualboxConfigClient) Delete(container *VirtualboxConfig) error {
return c.rancherClient.doResourceDelete(VIRTUALBOX_CONFIG_TYPE, &container.Resource)
}