forked from rancher/go-rancher
/
generated_amazonec2config.go
127 lines (90 loc) · 4.18 KB
/
generated_amazonec2config.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
package client
const (
AMAZONEC2CONFIG_TYPE = "amazonec2Config"
)
type Amazonec2Config struct {
Resource
AccessKey string `json:"accessKey,omitempty" yaml:"access_key,omitempty"`
Ami string `json:"ami,omitempty" yaml:"ami,omitempty"`
DeviceName string `json:"deviceName,omitempty" yaml:"device_name,omitempty"`
IamInstanceProfile string `json:"iamInstanceProfile,omitempty" yaml:"iam_instance_profile,omitempty"`
InstanceType string `json:"instanceType,omitempty" yaml:"instance_type,omitempty"`
KeypairName string `json:"keypairName,omitempty" yaml:"keypair_name,omitempty"`
Monitoring bool `json:"monitoring,omitempty" yaml:"monitoring,omitempty"`
PrivateAddressOnly bool `json:"privateAddressOnly,omitempty" yaml:"private_address_only,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
RequestSpotInstance bool `json:"requestSpotInstance,omitempty" yaml:"request_spot_instance,omitempty"`
Retries string `json:"retries,omitempty" yaml:"retries,omitempty"`
RootSize string `json:"rootSize,omitempty" yaml:"root_size,omitempty"`
SecretKey string `json:"secretKey,omitempty" yaml:"secret_key,omitempty"`
SecurityGroup []string `json:"securityGroup,omitempty" yaml:"security_group,omitempty"`
SessionToken string `json:"sessionToken,omitempty" yaml:"session_token,omitempty"`
SpotPrice string `json:"spotPrice,omitempty" yaml:"spot_price,omitempty"`
SshKeypath string `json:"sshKeypath,omitempty" yaml:"ssh_keypath,omitempty"`
SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"`
SubnetId string `json:"subnetId,omitempty" yaml:"subnet_id,omitempty"`
Tags string `json:"tags,omitempty" yaml:"tags,omitempty"`
UseEbsOptimizedInstance bool `json:"useEbsOptimizedInstance,omitempty" yaml:"use_ebs_optimized_instance,omitempty"`
UsePrivateAddress bool `json:"usePrivateAddress,omitempty" yaml:"use_private_address,omitempty"`
VolumeType string `json:"volumeType,omitempty" yaml:"volume_type,omitempty"`
VpcId string `json:"vpcId,omitempty" yaml:"vpc_id,omitempty"`
Zone string `json:"zone,omitempty" yaml:"zone,omitempty"`
}
type Amazonec2ConfigCollection struct {
Collection
Data []Amazonec2Config `json:"data,omitempty"`
client *Amazonec2ConfigClient
}
type Amazonec2ConfigClient struct {
rancherClient *RancherClient
}
type Amazonec2ConfigOperations interface {
List(opts *ListOpts) (*Amazonec2ConfigCollection, error)
Create(opts *Amazonec2Config) (*Amazonec2Config, error)
Update(existing *Amazonec2Config, updates interface{}) (*Amazonec2Config, error)
ById(id string) (*Amazonec2Config, error)
Delete(container *Amazonec2Config) error
}
func newAmazonec2ConfigClient(rancherClient *RancherClient) *Amazonec2ConfigClient {
return &Amazonec2ConfigClient{
rancherClient: rancherClient,
}
}
func (c *Amazonec2ConfigClient) Create(container *Amazonec2Config) (*Amazonec2Config, error) {
resp := &Amazonec2Config{}
err := c.rancherClient.doCreate(AMAZONEC2CONFIG_TYPE, container, resp)
return resp, err
}
func (c *Amazonec2ConfigClient) Update(existing *Amazonec2Config, updates interface{}) (*Amazonec2Config, error) {
resp := &Amazonec2Config{}
err := c.rancherClient.doUpdate(AMAZONEC2CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *Amazonec2ConfigClient) List(opts *ListOpts) (*Amazonec2ConfigCollection, error) {
resp := &Amazonec2ConfigCollection{}
err := c.rancherClient.doList(AMAZONEC2CONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *Amazonec2ConfigCollection) Next() (*Amazonec2ConfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &Amazonec2ConfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *Amazonec2ConfigClient) ById(id string) (*Amazonec2Config, error) {
resp := &Amazonec2Config{}
err := c.rancherClient.doById(AMAZONEC2CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *Amazonec2ConfigClient) Delete(container *Amazonec2Config) error {
return c.rancherClient.doResourceDelete(AMAZONEC2CONFIG_TYPE, &container.Resource)
}