Merge lp:~axwalk/gwacl/deleteservice-media into lp:gwacl

Proposed by Andrew Wilkins on 2014-03-12
Status: Merged
Approved by: Andrew Wilkins on 2014-03-12
Approved revision: 237
Merged at revision: 234
Proposed branch: lp:~axwalk/gwacl/deleteservice-media
Merge into: lp:gwacl
Diff against target: 30 lines (+5/-3)
2 files modified
management_base.go (+3/-1)
management_base_test.go (+2/-2)
To merge this branch: bzr merge lp:~axwalk/gwacl/deleteservice-media
Reviewer Review Type Date Requested Status
Ian Booth 2014-03-12 Approve on 2014-03-12
Review via email: mp+210534@code.launchpad.net

Commit message

Pass ?comp=media to DeleteHostedService requests

As of the 2013-08-01 version of DeleteHostedService,
it is possible to pass a request parameter (comp=media)
to tell Azure to also delete associated disks and blobs.
We should use this instead of DestroyHostedService,
which does all of that in numerous API requests.

Description of the change

Pass ?comp=media to DeleteHostedService requests

As of the 2013-08-01 version of DeleteHostedService,
it is possible to pass a request parameter (comp=media)
to tell Azure to also delete associated disks and blobs.
We should use this instead of DestroyHostedService,
which does all of that in numerous API requests.

To post a comment you must log in.
Ian Booth (wallyworld) wrote :

Awesome

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'management_base.go'
2--- management_base.go 2014-03-10 03:56:29 +0000
3+++ management_base.go 2014-03-12 04:02:53 +0000
4@@ -222,7 +222,9 @@
5 // DeleteHostedService deletes the named hosted service.
6 // See http://msdn.microsoft.com/en-us/library/windowsazure/gg441305.aspx
7 func (api *ManagementAPI) DeleteHostedService(serviceName string) error {
8- response, err := api.session.delete("services/hostedservices/"+serviceName, "2010-10-28")
9+ url := "services/hostedservices/" + serviceName
10+ url = addURLQueryParams(url, "comp", "media")
11+ response, err := api.session.delete(url, "2013-08-01")
12 if err != nil {
13 if IsNotFoundError(err) {
14 return nil
15
16=== modified file 'management_base_test.go'
17--- management_base_test.go 2014-03-11 03:32:29 +0000
18+++ management_base_test.go 2014-03-12 04:02:53 +0000
19@@ -654,9 +654,9 @@
20 }
21
22 func assertDeleteHostedServiceRequest(c *C, api *ManagementAPI, serviceName string, httpRequest *X509Request) {
23- expectedURL := fmt.Sprintf("%s%s/services/hostedservices/%s", defaultManagement,
24+ expectedURL := fmt.Sprintf("%s%s/services/hostedservices/%s?comp=media", defaultManagement,
25 api.session.subscriptionId, serviceName)
26- checkRequest(c, httpRequest, expectedURL, "2010-10-28", nil, "DELETE")
27+ checkRequest(c, httpRequest, expectedURL, "2013-08-01", nil, "DELETE")
28 }
29
30 func (suite *managementBaseAPISuite) TestDeleteHostedService(c *C) {

Subscribers

People subscribed via source and target branches

to all changes: