diff --git a/openstack/mls/v1/instances/requests.go b/openstack/mls/v1/instances/requests.go index 7335ada22..c669ad1a3 100644 --- a/openstack/mls/v1/instances/requests.go +++ b/openstack/mls/v1/instances/requests.go @@ -68,7 +68,10 @@ func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateRe //delete an instance via id func Delete(client *golangsdk.ServiceClient, id string) (r DeleteResult) { - _, r.Err = client.Delete(resourceURL(client, id), &RequestOpts) + b := make(map[string]interface{}) + _, r.Err = client.DeleteWithBody(resourceURL(client, id), b, &golangsdk.RequestOpts{ + OkCodes: []int{202}, + }) return } diff --git a/service_client.go b/service_client.go index df6eaa23f..db12a9d67 100644 --- a/service_client.go +++ b/service_client.go @@ -108,6 +108,15 @@ func (client *ServiceClient) Delete(url string, opts *RequestOpts) (*http.Respon return client.Request("DELETE", url, opts) } +// DeleteWithBody calls `Request` with the "DELETE" HTTP verb. +func (client *ServiceClient) DeleteWithBody(url string, JSONBody interface{}, opts *RequestOpts) (*http.Response, error) { + if opts == nil { + opts = new(RequestOpts) + } + client.initReqOpts(url, JSONBody, nil, opts) + return client.Request("DELETE", url, opts) +} + func (client *ServiceClient) setMicroversionHeader(opts *RequestOpts) { switch client.Type { case "compute":