Fix UpdateStatus

This commit is contained in:
Chao Xu
2016-01-19 22:13:04 -08:00
parent 4e04a289d8
commit ee6f03f55a
15 changed files with 162 additions and 60 deletions

View File

@@ -283,10 +283,17 @@ func (c *$.type|privatePlural$) Update($.type|private$ *$.type|raw$) (result *$.
`
var updateStatusTemplate = `
func (c *$.type|privatePlural$) UpdateStatus($.type|private$ *$.type|raw$) (*$.type|raw$, error) {
result := &$.type|raw${}
err := c.client.Put().Resource("$.type|privatePlural$").Name($.type|private$.Name).SubResource("status").Body($.type|private$).Do().Into(result)
return result, err
func (c *$.type|privatePlural$) UpdateStatus($.type|private$ *$.type|raw$) (result *$.type|raw$, err error) {
result = &$.type|raw${}
err = c.client.Put().
$if .namespaced$Namespace(c.ns).$end$
Resource("$.type|privatePlural$").
Name($.type|private$.Name).
SubResource("status").
Body($.type|private$).
Do().
Into(result)
return
}
`

View File

@@ -80,10 +80,17 @@ func (c *testTypes) Update(testType *testgroup.TestType) (result *testgroup.Test
return
}
func (c *testTypes) UpdateStatus(testType *testgroup.TestType) (*testgroup.TestType, error) {
result := &testgroup.TestType{}
err := c.client.Put().Resource("testTypes").Name(testType.Name).SubResource("status").Body(testType).Do().Into(result)
return result, err
func (c *testTypes) UpdateStatus(testType *testgroup.TestType) (result *testgroup.TestType, err error) {
result = &testgroup.TestType{}
err = c.client.Put().
Namespace(c.ns).
Resource("testTypes").
Name(testType.Name).
SubResource("status").
Body(testType).
Do().
Into(result)
return
}
// Delete takes name of the testType and deletes it. Returns an error if one occurs.