mirror of
https://github.com/rancher/norman.git
synced 2025-09-03 16:25:09 +00:00
Change ById to ByID
This commit is contained in:
@@ -258,8 +258,8 @@ func (a *APIBaseClient) Update(schemaType string, existing *types.Resource, upda
|
|||||||
return a.Ops.DoUpdate(schemaType, existing, updates, respObject)
|
return a.Ops.DoUpdate(schemaType, existing, updates, respObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *APIBaseClient) ById(schemaType string, id string, respObject interface{}) error {
|
func (a *APIBaseClient) ByID(schemaType string, id string, respObject interface{}) error {
|
||||||
return a.Ops.DoById(schemaType, id, respObject)
|
return a.Ops.DoByID(schemaType, id, respObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *APIBaseClient) Delete(existing *types.Resource) error {
|
func (a *APIBaseClient) Delete(existing *types.Resource) error {
|
||||||
|
@@ -212,7 +212,7 @@ func (a *APIOperations) DoUpdate(schemaType string, existing *types.Resource, up
|
|||||||
return a.DoModify("PUT", selfUrl, updates, respObject)
|
return a.DoModify("PUT", selfUrl, updates, respObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *APIOperations) DoById(schemaType string, id string, respObject interface{}) error {
|
func (a *APIOperations) DoByID(schemaType string, id string, respObject interface{}) error {
|
||||||
schema, ok := a.Types[schemaType]
|
schema, ok := a.Types[schemaType]
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("Unknown schema type [" + schemaType + "]")
|
return errors.New("Unknown schema type [" + schemaType + "]")
|
||||||
|
@@ -39,7 +39,7 @@ type {{.schema.CodeName}}Operations interface {
|
|||||||
List(opts *types.ListOpts) (*{{.schema.CodeName}}Collection, error)
|
List(opts *types.ListOpts) (*{{.schema.CodeName}}Collection, error)
|
||||||
Create(opts *{{.schema.CodeName}}) (*{{.schema.CodeName}}, error)
|
Create(opts *{{.schema.CodeName}}) (*{{.schema.CodeName}}, error)
|
||||||
Update(existing *{{.schema.CodeName}}, updates interface{}) (*{{.schema.CodeName}}, error)
|
Update(existing *{{.schema.CodeName}}, updates interface{}) (*{{.schema.CodeName}}, error)
|
||||||
ById(id string) (*{{.schema.CodeName}}, error)
|
ByID(id string) (*{{.schema.CodeName}}, error)
|
||||||
Delete(container *{{.schema.CodeName}}) error{{range $key, $value := .resourceActions}}
|
Delete(container *{{.schema.CodeName}}) error{{range $key, $value := .resourceActions}}
|
||||||
{{if eq $value.Input "" }}
|
{{if eq $value.Input "" }}
|
||||||
Action{{$key | capitalize}} (*{{$.schema.CodeName}}) (*{{.Output | capitalize}}, error)
|
Action{{$key | capitalize}} (*{{$.schema.CodeName}}) (*{{.Output | capitalize}}, error)
|
||||||
@@ -83,9 +83,9 @@ func (cc *{{.schema.CodeName}}Collection) Next() (*{{.schema.CodeName}}Collectio
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *{{.schema.CodeName}}Client) ById(id string) (*{{.schema.CodeName}}, error) {
|
func (c *{{.schema.CodeName}}Client) ByID(id string) (*{{.schema.CodeName}}, error) {
|
||||||
resp := &{{.schema.CodeName}}{}
|
resp := &{{.schema.CodeName}}{}
|
||||||
err := c.apiClient.Ops.DoById({{.schema.CodeName}}Type, id, resp)
|
err := c.apiClient.Ops.DoByID({{.schema.CodeName}}Type, id, resp)
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user