Update delete action behavior and JSON format output (#1155)
This PR changes delete behavior: * On success, a 204 is returned rather than a 200 with an empty JSON object * The CLI now passes through the 404 error if encountered instead of swallowing it It also updates formatting for JSON to use the response body, which means that the item (or items) in the JSON format are actually the format across the wire, instead of being reinterpreted by unmarshaling into the Go SDK and then remarshaling.
This commit is contained in:
1 parent
93d8115775
commit
4690225c1e
60 files changed
+283
-474
No files matched your search
@@ -50,6 +50,11 @@ type AccountDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for AccountDeleteResult
|
||||
func (n AccountDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n AccountDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -52,6 +52,11 @@ type AuthMethodDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for AuthMethodDeleteResult
|
||||
func (n AuthMethodDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n AuthMethodDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@ type AuthTokenDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for AuthTokenDeleteResult
|
||||
func (n AuthTokenDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n AuthTokenDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@ type GroupDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for GroupDeleteResult
|
||||
func (n GroupDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n GroupDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ type HostCatalogDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for HostCatalogDeleteResult
|
||||
func (n HostCatalogDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n HostCatalogDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ type HostDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for HostDeleteResult
|
||||
func (n HostDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n HostDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ type HostSetDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for HostSetDeleteResult
|
||||
func (n HostSetDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n HostSetDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ func (r *Response) Decode(inStruct interface{}) (*Error, error) {
|
||||
}
|
||||
defer r.resp.Body.Close()
|
||||
|
||||
// Always allocate this buffer. It's okay if the bytes return `nil`.
|
||||
r.Body = new(bytes.Buffer)
|
||||
|
||||
if r.resp.StatusCode == 204 {
|
||||
// Do nothing.
|
||||
return nil, nil
|
||||
|
||||
@@ -53,6 +53,11 @@ type RoleDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for RoleDeleteResult
|
||||
func (n RoleDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n RoleDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@ type ScopeDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for ScopeDeleteResult
|
||||
func (n ScopeDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n ScopeDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -58,6 +58,11 @@ type SessionDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for SessionDeleteResult
|
||||
func (n SessionDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n SessionDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -55,6 +55,11 @@ type TargetDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for TargetDeleteResult
|
||||
func (n TargetDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n TargetDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
@@ -54,6 +54,11 @@ type UserDeleteResult struct {
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for UserDeleteResult
|
||||
func (n UserDeleteResult) GetItem() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n UserDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user