mirror of
https://github.com/rancher/types.git
synced 2025-06-29 23:16:48 +00:00
Vendor update
This commit is contained in:
parent
3b07a626ee
commit
19d128e156
@ -5,4 +5,4 @@ k8s.io/kubernetes v1.8.3
|
||||
bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git
|
||||
golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5
|
||||
|
||||
github.com/rancher/norman 510ed570d2e29a00e6bc1bcd18bdcad6c6860a13
|
||||
github.com/rancher/norman 17c297e703d6988ac126b054ad5795606b31d344
|
||||
|
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}}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user