forked from longhorn/longhorn-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- generated_event and generated_instance_process have been stripped due to errors in the generated code. Signed-off-by: Michael William Le Nguyen <michael@mail.ttp.codes>
- Loading branch information
Showing
8 changed files
with
305 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package client | ||
|
||
const ( | ||
BACKUP_LIST_OUTPUT_TYPE = "backupListOutput" | ||
) | ||
|
||
type BackupListOutput struct { | ||
Resource `yaml:"-"` | ||
|
||
Data []Backup `json:"data,omitempty" yaml:"data,omitempty"` | ||
} | ||
|
||
type BackupListOutputCollection struct { | ||
Collection | ||
Data []BackupListOutput `json:"data,omitempty"` | ||
client *BackupListOutputClient | ||
} | ||
|
||
type BackupListOutputClient struct { | ||
rancherClient *RancherClient | ||
} | ||
|
||
type BackupListOutputOperations interface { | ||
List(opts *ListOpts) (*BackupListOutputCollection, error) | ||
Create(opts *BackupListOutput) (*BackupListOutput, error) | ||
Update(existing *BackupListOutput, updates interface{}) (*BackupListOutput, error) | ||
ById(id string) (*BackupListOutput, error) | ||
Delete(container *BackupListOutput) error | ||
} | ||
|
||
func newBackupListOutputClient(rancherClient *RancherClient) *BackupListOutputClient { | ||
return &BackupListOutputClient{ | ||
rancherClient: rancherClient, | ||
} | ||
} | ||
|
||
func (c *BackupListOutputClient) Create(container *BackupListOutput) (*BackupListOutput, error) { | ||
resp := &BackupListOutput{} | ||
err := c.rancherClient.doCreate(BACKUP_LIST_OUTPUT_TYPE, container, resp) | ||
return resp, err | ||
} | ||
|
||
func (c *BackupListOutputClient) Update(existing *BackupListOutput, updates interface{}) (*BackupListOutput, error) { | ||
resp := &BackupListOutput{} | ||
err := c.rancherClient.doUpdate(BACKUP_LIST_OUTPUT_TYPE, &existing.Resource, updates, resp) | ||
return resp, err | ||
} | ||
|
||
func (c *BackupListOutputClient) List(opts *ListOpts) (*BackupListOutputCollection, error) { | ||
resp := &BackupListOutputCollection{} | ||
err := c.rancherClient.doList(BACKUP_LIST_OUTPUT_TYPE, opts, resp) | ||
resp.client = c | ||
return resp, err | ||
} | ||
|
||
func (cc *BackupListOutputCollection) Next() (*BackupListOutputCollection, error) { | ||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { | ||
resp := &BackupListOutputCollection{} | ||
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) | ||
resp.client = cc.client | ||
return resp, err | ||
} | ||
return nil, nil | ||
} | ||
|
||
func (c *BackupListOutputClient) ById(id string) (*BackupListOutput, error) { | ||
resp := &BackupListOutput{} | ||
err := c.rancherClient.doById(BACKUP_LIST_OUTPUT_TYPE, id, resp) | ||
if apiError, ok := err.(*ApiError); ok { | ||
if apiError.StatusCode == 404 { | ||
return nil, nil | ||
} | ||
} | ||
return resp, err | ||
} | ||
|
||
func (c *BackupListOutputClient) Delete(container *BackupListOutput) error { | ||
return c.rancherClient.doResourceDelete(BACKUP_LIST_OUTPUT_TYPE, &container.Resource) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package client | ||
|
||
const ( | ||
INSTANCE_MANAGER_TYPE = "instanceManager" | ||
) | ||
|
||
type InstanceManager struct { | ||
Resource `yaml:"-"` | ||
|
||
CurrentState string `json:"currentState,omitempty" yaml:"current_state,omitempty"` | ||
|
||
Image string `json:"image,omitempty" yaml:"image,omitempty"` | ||
|
||
Instances map[string]string `json:"instances,omitempty" yaml:"instances,omitempty"` | ||
|
||
ManagerType string `json:"managerType,omitempty" yaml:"manager_type,omitempty"` | ||
|
||
Name string `json:"name,omitempty" yaml:"name,omitempty"` | ||
|
||
NodeID string `json:"nodeID,omitempty" yaml:"node_id,omitempty"` | ||
} | ||
|
||
type InstanceManagerCollection struct { | ||
Collection | ||
Data []InstanceManager `json:"data,omitempty"` | ||
client *InstanceManagerClient | ||
} | ||
|
||
type InstanceManagerClient struct { | ||
rancherClient *RancherClient | ||
} | ||
|
||
type InstanceManagerOperations interface { | ||
List(opts *ListOpts) (*InstanceManagerCollection, error) | ||
Create(opts *InstanceManager) (*InstanceManager, error) | ||
Update(existing *InstanceManager, updates interface{}) (*InstanceManager, error) | ||
ById(id string) (*InstanceManager, error) | ||
Delete(container *InstanceManager) error | ||
} | ||
|
||
func newInstanceManagerClient(rancherClient *RancherClient) *InstanceManagerClient { | ||
return &InstanceManagerClient{ | ||
rancherClient: rancherClient, | ||
} | ||
} | ||
|
||
func (c *InstanceManagerClient) Create(container *InstanceManager) (*InstanceManager, error) { | ||
resp := &InstanceManager{} | ||
err := c.rancherClient.doCreate(INSTANCE_MANAGER_TYPE, container, resp) | ||
return resp, err | ||
} | ||
|
||
func (c *InstanceManagerClient) Update(existing *InstanceManager, updates interface{}) (*InstanceManager, error) { | ||
resp := &InstanceManager{} | ||
err := c.rancherClient.doUpdate(INSTANCE_MANAGER_TYPE, &existing.Resource, updates, resp) | ||
return resp, err | ||
} | ||
|
||
func (c *InstanceManagerClient) List(opts *ListOpts) (*InstanceManagerCollection, error) { | ||
resp := &InstanceManagerCollection{} | ||
err := c.rancherClient.doList(INSTANCE_MANAGER_TYPE, opts, resp) | ||
resp.client = c | ||
return resp, err | ||
} | ||
|
||
func (cc *InstanceManagerCollection) Next() (*InstanceManagerCollection, error) { | ||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { | ||
resp := &InstanceManagerCollection{} | ||
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) | ||
resp.client = cc.client | ||
return resp, err | ||
} | ||
return nil, nil | ||
} | ||
|
||
func (c *InstanceManagerClient) ById(id string) (*InstanceManager, error) { | ||
resp := &InstanceManager{} | ||
err := c.rancherClient.doById(INSTANCE_MANAGER_TYPE, id, resp) | ||
if apiError, ok := err.(*ApiError); ok { | ||
if apiError.StatusCode == 404 { | ||
return nil, nil | ||
} | ||
} | ||
return resp, err | ||
} | ||
|
||
func (c *InstanceManagerClient) Delete(container *InstanceManager) error { | ||
return c.rancherClient.doResourceDelete(INSTANCE_MANAGER_TYPE, &container.Resource) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package client | ||
|
||
const ( | ||
SNAPSHOT_LIST_OUTPUT_TYPE = "snapshotListOutput" | ||
) | ||
|
||
type SnapshotListOutput struct { | ||
Resource `yaml:"-"` | ||
|
||
Data []Snapshot `json:"data,omitempty" yaml:"data,omitempty"` | ||
} | ||
|
||
type SnapshotListOutputCollection struct { | ||
Collection | ||
Data []SnapshotListOutput `json:"data,omitempty"` | ||
client *SnapshotListOutputClient | ||
} | ||
|
||
type SnapshotListOutputClient struct { | ||
rancherClient *RancherClient | ||
} | ||
|
||
type SnapshotListOutputOperations interface { | ||
List(opts *ListOpts) (*SnapshotListOutputCollection, error) | ||
Create(opts *SnapshotListOutput) (*SnapshotListOutput, error) | ||
Update(existing *SnapshotListOutput, updates interface{}) (*SnapshotListOutput, error) | ||
ById(id string) (*SnapshotListOutput, error) | ||
Delete(container *SnapshotListOutput) error | ||
} | ||
|
||
func newSnapshotListOutputClient(rancherClient *RancherClient) *SnapshotListOutputClient { | ||
return &SnapshotListOutputClient{ | ||
rancherClient: rancherClient, | ||
} | ||
} | ||
|
||
func (c *SnapshotListOutputClient) Create(container *SnapshotListOutput) (*SnapshotListOutput, error) { | ||
resp := &SnapshotListOutput{} | ||
err := c.rancherClient.doCreate(SNAPSHOT_LIST_OUTPUT_TYPE, container, resp) | ||
return resp, err | ||
} | ||
|
||
func (c *SnapshotListOutputClient) Update(existing *SnapshotListOutput, updates interface{}) (*SnapshotListOutput, error) { | ||
resp := &SnapshotListOutput{} | ||
err := c.rancherClient.doUpdate(SNAPSHOT_LIST_OUTPUT_TYPE, &existing.Resource, updates, resp) | ||
return resp, err | ||
} | ||
|
||
func (c *SnapshotListOutputClient) List(opts *ListOpts) (*SnapshotListOutputCollection, error) { | ||
resp := &SnapshotListOutputCollection{} | ||
err := c.rancherClient.doList(SNAPSHOT_LIST_OUTPUT_TYPE, opts, resp) | ||
resp.client = c | ||
return resp, err | ||
} | ||
|
||
func (cc *SnapshotListOutputCollection) Next() (*SnapshotListOutputCollection, error) { | ||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { | ||
resp := &SnapshotListOutputCollection{} | ||
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) | ||
resp.client = cc.client | ||
return resp, err | ||
} | ||
return nil, nil | ||
} | ||
|
||
func (c *SnapshotListOutputClient) ById(id string) (*SnapshotListOutput, error) { | ||
resp := &SnapshotListOutput{} | ||
err := c.rancherClient.doById(SNAPSHOT_LIST_OUTPUT_TYPE, id, resp) | ||
if apiError, ok := err.(*ApiError); ok { | ||
if apiError.StatusCode == 404 { | ||
return nil, nil | ||
} | ||
} | ||
return resp, err | ||
} | ||
|
||
func (c *SnapshotListOutputClient) Delete(container *SnapshotListOutput) error { | ||
return c.rancherClient.doResourceDelete(SNAPSHOT_LIST_OUTPUT_TYPE, &container.Resource) | ||
} |
Oops, something went wrong.