Update Rancher API integration to go-rancher client v2.
This commit is contained in:
parent
d89b234cad
commit
07c6e33598
188 changed files with 5349 additions and 1969 deletions
81
vendor/github.com/rancher/go-rancher/v2/generated_restart_policy.go
generated
vendored
Normal file
81
vendor/github.com/rancher/go-rancher/v2/generated_restart_policy.go
generated
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
package client
|
||||
|
||||
const (
|
||||
RESTART_POLICY_TYPE = "restartPolicy"
|
||||
)
|
||||
|
||||
type RestartPolicy struct {
|
||||
Resource
|
||||
|
||||
MaximumRetryCount int64 `json:"maximumRetryCount,omitempty" yaml:"maximum_retry_count,omitempty"`
|
||||
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
}
|
||||
|
||||
type RestartPolicyCollection struct {
|
||||
Collection
|
||||
Data []RestartPolicy `json:"data,omitempty"`
|
||||
client *RestartPolicyClient
|
||||
}
|
||||
|
||||
type RestartPolicyClient struct {
|
||||
rancherClient *RancherClient
|
||||
}
|
||||
|
||||
type RestartPolicyOperations interface {
|
||||
List(opts *ListOpts) (*RestartPolicyCollection, error)
|
||||
Create(opts *RestartPolicy) (*RestartPolicy, error)
|
||||
Update(existing *RestartPolicy, updates interface{}) (*RestartPolicy, error)
|
||||
ById(id string) (*RestartPolicy, error)
|
||||
Delete(container *RestartPolicy) error
|
||||
}
|
||||
|
||||
func newRestartPolicyClient(rancherClient *RancherClient) *RestartPolicyClient {
|
||||
return &RestartPolicyClient{
|
||||
rancherClient: rancherClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *RestartPolicyClient) Create(container *RestartPolicy) (*RestartPolicy, error) {
|
||||
resp := &RestartPolicy{}
|
||||
err := c.rancherClient.doCreate(RESTART_POLICY_TYPE, container, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *RestartPolicyClient) Update(existing *RestartPolicy, updates interface{}) (*RestartPolicy, error) {
|
||||
resp := &RestartPolicy{}
|
||||
err := c.rancherClient.doUpdate(RESTART_POLICY_TYPE, &existing.Resource, updates, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *RestartPolicyClient) List(opts *ListOpts) (*RestartPolicyCollection, error) {
|
||||
resp := &RestartPolicyCollection{}
|
||||
err := c.rancherClient.doList(RESTART_POLICY_TYPE, opts, resp)
|
||||
resp.client = c
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (cc *RestartPolicyCollection) Next() (*RestartPolicyCollection, error) {
|
||||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
|
||||
resp := &RestartPolicyCollection{}
|
||||
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
|
||||
resp.client = cc.client
|
||||
return resp, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *RestartPolicyClient) ById(id string) (*RestartPolicy, error) {
|
||||
resp := &RestartPolicy{}
|
||||
err := c.rancherClient.doById(RESTART_POLICY_TYPE, id, resp)
|
||||
if apiError, ok := err.(*ApiError); ok {
|
||||
if apiError.StatusCode == 404 {
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *RestartPolicyClient) Delete(container *RestartPolicy) error {
|
||||
return c.rancherClient.doResourceDelete(RESTART_POLICY_TYPE, &container.Resource)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue