{"action":"created","comment":{"url":"https://api.github.com/repos/juju/gomaasapi/pulls/comments/58318804","id":58318804,"diff_hunk":"@@ -239,6 +239,44 @@ func (c *controller) AllocateMachine(args AllocateMachineArgs) (Machine, error)\n \treturn machine, nil\n }\n \n+// ReleaseMachinesArgs is an argument struct for passing the machine system IDs\n+// and an optional comment into the ReleaseMachines method.\n+type ReleaseMachinesArgs struct {\n+\tSystemIDs []string\n+\tComment   string\n+}\n+\n+// ReleaseMachines implements Controller.\n+//\n+// Release multiple machines at once. Returns\n+//  - BadRequestError if any of the machines cannot be found\n+//  - PermissionError if the user does not have permission to release any of the machines\n+//  - CannotCompleteError if any of the machines could not be released due to their current state\n+func (c *controller) ReleaseMachines(args ReleaseMachinesArgs) error {\n+\tparams := NewURLParams()\n+\tparams.MaybeAddMany(\"machines\", args.SystemIDs)\n+\tparams.MaybeAdd(\"comment\", args.Comment)\n+\t_, err := c.post(\"machines\", \"release\", params.Values)\n+\tif err != nil {\n+\t\t// A 409 Status code is \"No Matching Machines\"\n+\t\tif svrErr, ok := errors.Cause(err).(ServerError); ok {\n+\t\t\tif svrErr.StatusCode == http.StatusBadRequest {","path":"controller.go","position":25,"original_position":25,"commit_id":"e57a6eff9fcfb4fe6e1244f1eecdebc1ac43fecc","original_commit_id":"e57a6eff9fcfb4fe6e1244f1eecdebc1ac43fecc","user":{"login":"mjs","id":14993,"avatar_url":"https://avatars.githubusercontent.com/u/14993?v=3","gravatar_id":"","url":"https://api.github.com/users/mjs","html_url":"https://github.com/mjs","followers_url":"https://api.github.com/users/mjs/followers","following_url":"https://api.github.com/users/mjs/following{/other_user}","gists_url":"https://api.github.com/users/mjs/gists{/gist_id}","starred_url":"https://api.github.com/users/mjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjs/subscriptions","organizations_url":"https://api.github.com/users/mjs/orgs","repos_url":"https://api.github.com/users/mjs/repos","events_url":"https://api.github.com/users/mjs/events{/privacy}","received_events_url":"https://api.github.com/users/mjs/received_events","type":"User","site_admin":false},"body":"using switch here would be nicer","created_at":"2016-04-03T22:27:25Z","updated_at":"2016-04-03T22:27:25Z","html_url":"https://github.com/juju/gomaasapi/pull/17#discussion_r58318804","pull_request_url":"https://api.github.com/repos/juju/gomaasapi/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/juju/gomaasapi/pulls/comments/58318804"},"html":{"href":"https://github.com/juju/gomaasapi/pull/17#discussion_r58318804"},"pull_request":{"href":"https://api.github.com/repos/juju/gomaasapi/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/juju/gomaasapi/pulls/17","id":65026004,"html_url":"https://github.com/juju/gomaasapi/pull/17","diff_url":"https://github.com/juju/gomaasapi/pull/17.diff","patch_url":"https://github.com/juju/gomaasapi/pull/17.patch","issue_url":"https://api.github.com/repos/juju/gomaasapi/issues/17","number":17,"state":"open","locked":false,"title":"Add ReleaseMachines method to the Controller.","user":{"login":"howbazaar","id":1744247,"avatar_url":"https://avatars.githubusercontent.com/u/1744247?v=3","gravatar_id":"","url":"https://api.github.com/users/howbazaar","html_url":"https://github.com/howbazaar","followers_url":"https://api.github.com/users/howbazaar/followers","following_url":"https://api.github.com/users/howbazaar/following{/other_user}","gists_url":"https://api.github.com/users/howbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/howbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/howbazaar/subscriptions","organizations_url":"https://api.github.com/users/howbazaar/orgs","repos_url":"https://api.github.com/users/howbazaar/repos","events_url":"https://api.github.com/users/howbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/howbazaar/received_events","type":"User","site_admin":false},"body":"Based on unlanded PR #15","created_at":"2016-04-02T02:52:04Z","updated_at":"2016-04-03T22:27:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"38b2e4d764a9d8d100e6d69e222035a6c3149d9e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/juju/gomaasapi/pulls/17/commits","review_comments_url":"https://api.github.com/repos/juju/gomaasapi/pulls/17/comments","review_comment_url":"https://api.github.com/repos/juju/gomaasapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juju/gomaasapi/issues/17/comments","statuses_url":"https://api.github.com/repos/juju/gomaasapi/statuses/e57a6eff9fcfb4fe6e1244f1eecdebc1ac43fecc","head":{"label":"howbazaar:release-machines","ref":"release-machines","sha":"e57a6eff9fcfb4fe6e1244f1eecdebc1ac43fecc","user":{"login":"howbazaar","id":1744247,"avatar_url":"https://avatars.githubusercontent.com/u/1744247?v=3","gravatar_id":"","url":"https://api.github.com/users/howbazaar","html_url":"https://github.com/howbazaar","followers_url":"https://api.github.com/users/howbazaar/followers","following_url":"https://api.github.com/users/howbazaar/following{/other_user}","gists_url":"https://api.github.com/users/howbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/howbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/howbazaar/subscriptions","organizations_url":"https://api.github.com/users/howbazaar/orgs","repos_url":"https://api.github.com/users/howbazaar/repos","events_url":"https://api.github.com/users/howbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/howbazaar/received_events","type":"User","site_admin":false},"repo":{"id":54937785,"name":"gomaasapi","full_name":"howbazaar/gomaasapi","owner":{"login":"howbazaar","id":1744247,"avatar_url":"https://avatars.githubusercontent.com/u/1744247?v=3","gravatar_id":"","url":"https://api.github.com/users/howbazaar","html_url":"https://github.com/howbazaar","followers_url":"https://api.github.com/users/howbazaar/followers","following_url":"https://api.github.com/users/howbazaar/following{/other_user}","gists_url":"https://api.github.com/users/howbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/howbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/howbazaar/subscriptions","organizations_url":"https://api.github.com/users/howbazaar/orgs","repos_url":"https://api.github.com/users/howbazaar/repos","events_url":"https://api.github.com/users/howbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/howbazaar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/howbazaar/gomaasapi","description":"Go bindings for talking to MAAS","fork":true,"url":"https://api.github.com/repos/howbazaar/gomaasapi","forks_url":"https://api.github.com/repos/howbazaar/gomaasapi/forks","keys_url":"https://api.github.com/repos/howbazaar/gomaasapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/howbazaar/gomaasapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/howbazaar/gomaasapi/teams","hooks_url":"https://api.github.com/repos/howbazaar/gomaasapi/hooks","issue_events_url":"https://api.github.com/repos/howbazaar/gomaasapi/issues/events{/number}","events_url":"https://api.github.com/repos/howbazaar/gomaasapi/events","assignees_url":"https://api.github.com/repos/howbazaar/gomaasapi/assignees{/user}","branches_url":"https://api.github.com/repos/howbazaar/gomaasapi/branches{/branch}","tags_url":"https://api.github.com/repos/howbazaar/gomaasapi/tags","blobs_url":"https://api.github.com/repos/howbazaar/gomaasapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/howbazaar/gomaasapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/howbazaar/gomaasapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/howbazaar/gomaasapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/howbazaar/gomaasapi/statuses/{sha}","languages_url":"https://api.github.com/repos/howbazaar/gomaasapi/languages","stargazers_url":"https://api.github.com/repos/howbazaar/gomaasapi/stargazers","contributors_url":"https://api.github.com/repos/howbazaar/gomaasapi/contributors","subscribers_url":"https://api.github.com/repos/howbazaar/gomaasapi/subscribers","subscription_url":"https://api.github.com/repos/howbazaar/gomaasapi/subscription","commits_url":"https://api.github.com/repos/howbazaar/gomaasapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/howbazaar/gomaasapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/howbazaar/gomaasapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/howbazaar/gomaasapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/howbazaar/gomaasapi/contents/{+path}","compare_url":"https://api.github.com/repos/howbazaar/gomaasapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/howbazaar/gomaasapi/merges","archive_url":"https://api.github.com/repos/howbazaar/gomaasapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/howbazaar/gomaasapi/downloads","issues_url":"https://api.github.com/repos/howbazaar/gomaasapi/issues{/number}","pulls_url":"https://api.github.com/repos/howbazaar/gomaasapi/pulls{/number}","milestones_url":"https://api.github.com/repos/howbazaar/gomaasapi/milestones{/number}","notifications_url":"https://api.github.com/repos/howbazaar/gomaasapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/howbazaar/gomaasapi/labels{/name}","releases_url":"https://api.github.com/repos/howbazaar/gomaasapi/releases{/id}","deployments_url":"https://api.github.com/repos/howbazaar/gomaasapi/deployments","created_at":"2016-03-29T02:00:28Z","updated_at":"2016-03-29T02:00:29Z","pushed_at":"2016-04-03T22:25:27Z","git_url":"git://github.com/howbazaar/gomaasapi.git","ssh_url":"git@github.com:howbazaar/gomaasapi.git","clone_url":"https://github.com/howbazaar/gomaasapi.git","svn_url":"https://github.com/howbazaar/gomaasapi","homepage":null,"size":301,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"juju:master","ref":"master","sha":"d840214448521688bcf24f2141a2dd7eb901d34e","user":{"login":"juju","id":4604548,"avatar_url":"https://avatars.githubusercontent.com/u/4604548?v=3","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"repo":{"id":47433928,"name":"gomaasapi","full_name":"juju/gomaasapi","owner":{"login":"juju","id":4604548,"avatar_url":"https://avatars.githubusercontent.com/u/4604548?v=3","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juju/gomaasapi","description":"Go bindings for talking to MAAS","fork":false,"url":"https://api.github.com/repos/juju/gomaasapi","forks_url":"https://api.github.com/repos/juju/gomaasapi/forks","keys_url":"https://api.github.com/repos/juju/gomaasapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juju/gomaasapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juju/gomaasapi/teams","hooks_url":"https://api.github.com/repos/juju/gomaasapi/hooks","issue_events_url":"https://api.github.com/repos/juju/gomaasapi/issues/events{/number}","events_url":"https://api.github.com/repos/juju/gomaasapi/events","assignees_url":"https://api.github.com/repos/juju/gomaasapi/assignees{/user}","branches_url":"https://api.github.com/repos/juju/gomaasapi/branches{/branch}","tags_url":"https://api.github.com/repos/juju/gomaasapi/tags","blobs_url":"https://api.github.com/repos/juju/gomaasapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juju/gomaasapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juju/gomaasapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/juju/gomaasapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juju/gomaasapi/statuses/{sha}","languages_url":"https://api.github.com/repos/juju/gomaasapi/languages","stargazers_url":"https://api.github.com/repos/juju/gomaasapi/stargazers","contributors_url":"https://api.github.com/repos/juju/gomaasapi/contributors","subscribers_url":"https://api.github.com/repos/juju/gomaasapi/subscribers","subscription_url":"https://api.github.com/repos/juju/gomaasapi/subscription","commits_url":"https://api.github.com/repos/juju/gomaasapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/juju/gomaasapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/juju/gomaasapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/juju/gomaasapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/juju/gomaasapi/contents/{+path}","compare_url":"https://api.github.com/repos/juju/gomaasapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juju/gomaasapi/merges","archive_url":"https://api.github.com/repos/juju/gomaasapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juju/gomaasapi/downloads","issues_url":"https://api.github.com/repos/juju/gomaasapi/issues{/number}","pulls_url":"https://api.github.com/repos/juju/gomaasapi/pulls{/number}","milestones_url":"https://api.github.com/repos/juju/gomaasapi/milestones{/number}","notifications_url":"https://api.github.com/repos/juju/gomaasapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juju/gomaasapi/labels{/name}","releases_url":"https://api.github.com/repos/juju/gomaasapi/releases{/id}","deployments_url":"https://api.github.com/repos/juju/gomaasapi/deployments","created_at":"2015-12-04T23:27:09Z","updated_at":"2016-01-19T01:47:09Z","pushed_at":"2016-04-03T22:25:28Z","git_url":"git://github.com/juju/gomaasapi.git","ssh_url":"git@github.com:juju/gomaasapi.git","clone_url":"https://github.com/juju/gomaasapi.git","svn_url":"https://github.com/juju/gomaasapi","homepage":null,"size":297,"stargazers_count":3,"watchers_count":3,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/juju/gomaasapi/pulls/17"},"html":{"href":"https://github.com/juju/gomaasapi/pull/17"},"issue":{"href":"https://api.github.com/repos/juju/gomaasapi/issues/17"},"comments":{"href":"https://api.github.com/repos/juju/gomaasapi/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/juju/gomaasapi/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/juju/gomaasapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juju/gomaasapi/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/juju/gomaasapi/statuses/e57a6eff9fcfb4fe6e1244f1eecdebc1ac43fecc"}}}}