mirror of
https://github.com/rancher/types.git
synced 2025-08-31 21:00:16 +00:00
Vendor update
This commit is contained in:
committed by
Darren Shepherd
parent
3b07a626ee
commit
19d128e156
27
vendor/github.com/rancher/norman/clientbase/ops.go
generated
vendored
27
vendor/github.com/rancher/norman/clientbase/ops.go
generated
vendored
@@ -247,7 +247,32 @@ func (a *APIOperations) DoAction(schemaType string, action string,
|
||||
return fmt.Errorf("action [%v] not available on [%v]", action, existing)
|
||||
}
|
||||
|
||||
_, ok = a.Types[schemaType]
|
||||
return a.doAction(schemaType, action, actionURL, inputObject, respObject)
|
||||
}
|
||||
|
||||
func (a *APIOperations) DoCollectionAction(schemaType string, action string,
|
||||
existing *types.Collection, inputObject, respObject interface{}) error {
|
||||
|
||||
if existing == nil {
|
||||
return errors.New("Existing object is nil")
|
||||
}
|
||||
|
||||
actionURL, ok := existing.Actions[action]
|
||||
if !ok {
|
||||
return fmt.Errorf("action [%v] not available on [%v]", action, existing)
|
||||
}
|
||||
|
||||
return a.doAction(schemaType, action, actionURL, inputObject, respObject)
|
||||
}
|
||||
|
||||
func (a *APIOperations) doAction(
|
||||
schemaType string,
|
||||
action string,
|
||||
actionURL string,
|
||||
inputObject interface{},
|
||||
respObject interface{},
|
||||
) error {
|
||||
_, ok := a.Types[schemaType]
|
||||
if !ok {
|
||||
return errors.New("Unknown schema type [" + schemaType + "]")
|
||||
}
|
||||
|
24
vendor/github.com/rancher/norman/generator/type_template.go
generated
vendored
24
vendor/github.com/rancher/norman/generator/type_template.go
generated
vendored
@@ -51,13 +51,13 @@ type {{.schema.CodeName}}Operations interface {
|
||||
{{end}}
|
||||
{{range $key, $value := .collectionActions}}
|
||||
{{if (and (eq $value.Input "") (eq $value.Output ""))}}
|
||||
Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}) (error)
|
||||
Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}Collection) (error)
|
||||
{{else if (and (eq $value.Input "") (ne $value.Output ""))}}
|
||||
Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error)
|
||||
Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}Collection) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error)
|
||||
{{else if (and (ne $value.Input "") (eq $value.Output ""))}}
|
||||
Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}, input *{{$value.Input | capitalize}}) (error)
|
||||
Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}Collection, input *{{$value.Input | capitalize}}) (error)
|
||||
{{else}}
|
||||
Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}, input *{{$value.Input | capitalize}}) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error)
|
||||
Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}Collection, input *{{$value.Input | capitalize}}) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error)
|
||||
{{end}}
|
||||
{{end}}
|
||||
}
|
||||
@@ -125,22 +125,22 @@ func (c *{{.schema.CodeName}}Client) Delete(container *{{.schema.CodeName}}) err
|
||||
|
||||
{{range $key, $value := .collectionActions}}
|
||||
{{if (and (eq $value.Input "") (eq $value.Output ""))}}
|
||||
func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}) (error) {
|
||||
err := c.apiClient.Ops.DoAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Resource, nil, nil)
|
||||
func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}Collection) (error) {
|
||||
err := c.apiClient.Ops.DoCollectionAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Collection, nil, nil)
|
||||
return err
|
||||
{{else if (and (eq $value.Input "") (ne $value.Output ""))}}
|
||||
func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error) {
|
||||
func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}Collection) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error) {
|
||||
resp := &{{getCollectionOutput $value.Output $.schema.CodeName}}{}
|
||||
err := c.apiClient.Ops.DoAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Resource, nil, resp)
|
||||
err := c.apiClient.Ops.DoCollectionAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Collection, nil, resp)
|
||||
return resp, err
|
||||
{{else if (and (ne $value.Input "") (eq $value.Output ""))}}
|
||||
func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}, input *{{$value.Input | capitalize}}) (error) {
|
||||
err := c.apiClient.Ops.DoAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Resource, input, nil)
|
||||
func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}Collection, input *{{$value.Input | capitalize}}) (error) {
|
||||
err := c.apiClient.Ops.DoCollectionAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Collection, input, nil)
|
||||
return err
|
||||
{{else}}
|
||||
func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}, input *{{$value.Input | capitalize}}) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error) {
|
||||
func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}Collection, input *{{$value.Input | capitalize}}) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error) {
|
||||
resp := &{{getCollectionOutput $value.Output $.schema.CodeName}}{}
|
||||
err := c.apiClient.Ops.DoAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Resource, input, resp)
|
||||
err := c.apiClient.Ops.DoCollectionAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Collection, input, resp)
|
||||
return resp, err
|
||||
{{end}}
|
||||
}
|
||||
|
Reference in New Issue
Block a user