forked from rancher/convoy
/
generated_rolling_restart_strategy.go
69 lines (56 loc) · 2.29 KB
/
generated_rolling_restart_strategy.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
package client
const (
ROLLING_RESTART_STRATEGY_TYPE = "rollingRestartStrategy"
)
type RollingRestartStrategy struct {
Resource
BatchSize int64 `json:"batchSize,omitempty" yaml:"batch_size,omitempty"`
IntervalMillis int64 `json:"intervalMillis,omitempty" yaml:"interval_millis,omitempty"`
}
type RollingRestartStrategyCollection struct {
Collection
Data []RollingRestartStrategy `json:"data,omitempty"`
}
type RollingRestartStrategyClient struct {
rancherClient *RancherClient
}
type RollingRestartStrategyOperations interface {
List(opts *ListOpts) (*RollingRestartStrategyCollection, error)
Create(opts *RollingRestartStrategy) (*RollingRestartStrategy, error)
Update(existing *RollingRestartStrategy, updates interface{}) (*RollingRestartStrategy, error)
ById(id string) (*RollingRestartStrategy, error)
Delete(container *RollingRestartStrategy) error
}
func newRollingRestartStrategyClient(rancherClient *RancherClient) *RollingRestartStrategyClient {
return &RollingRestartStrategyClient{
rancherClient: rancherClient,
}
}
func (c *RollingRestartStrategyClient) Create(container *RollingRestartStrategy) (*RollingRestartStrategy, error) {
resp := &RollingRestartStrategy{}
err := c.rancherClient.doCreate(ROLLING_RESTART_STRATEGY_TYPE, container, resp)
return resp, err
}
func (c *RollingRestartStrategyClient) Update(existing *RollingRestartStrategy, updates interface{}) (*RollingRestartStrategy, error) {
resp := &RollingRestartStrategy{}
err := c.rancherClient.doUpdate(ROLLING_RESTART_STRATEGY_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *RollingRestartStrategyClient) List(opts *ListOpts) (*RollingRestartStrategyCollection, error) {
resp := &RollingRestartStrategyCollection{}
err := c.rancherClient.doList(ROLLING_RESTART_STRATEGY_TYPE, opts, resp)
return resp, err
}
func (c *RollingRestartStrategyClient) ById(id string) (*RollingRestartStrategy, error) {
resp := &RollingRestartStrategy{}
err := c.rancherClient.doById(ROLLING_RESTART_STRATEGY_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *RollingRestartStrategyClient) Delete(container *RollingRestartStrategy) error {
return c.rancherClient.doResourceDelete(ROLLING_RESTART_STRATEGY_TYPE, &container.Resource)
}