{"action":"created","comment":{"url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/comments/27646053","id":27646053,"diff_hunk":"@@ -0,0 +1,70 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements.  See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * the License.  You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jclouds.azurecompute.compute.strategy.impl;\n+\n+import com.google.common.base.Function;\n+import java.util.Map;\n+import javax.inject.Inject;\n+import org.jclouds.azurecompute.compute.AzureComputeServiceAdapter;\n+import org.jclouds.azurecompute.domain.Deployment;\n+import org.jclouds.azurecompute.domain.Location;\n+import org.jclouds.azurecompute.domain.OSImage;\n+import org.jclouds.azurecompute.domain.RoleSize;\n+import org.jclouds.compute.ComputeServiceAdapter;\n+import org.jclouds.compute.config.ComputeServiceAdapterContextModule.AddDefaultCredentialsToImage;\n+import org.jclouds.compute.domain.Image;\n+import org.jclouds.compute.domain.NodeMetadata;\n+import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;\n+import org.jclouds.compute.strategy.impl.AdaptingComputeServiceStrategies;\n+import org.jclouds.domain.Credentials;\n+\n+public class AzureAdaptingComputeServiceStrategies\n+        extends AdaptingComputeServiceStrategies<Deployment, RoleSize, OSImage, Location> {\n+\n+   private final AzureComputeServiceAdapter client;\n+\n+   private final Function<Deployment, NodeMetadata> nodeMetadataAdapter;\n+\n+   @Inject\n+   public AzureAdaptingComputeServiceStrategies(\n+           final Map<String, Credentials> credentialStore,\n+           final PrioritizeCredentialsFromTemplate prioritizeCredentialsFromTemplate,\n+           final ComputeServiceAdapter<Deployment, RoleSize, OSImage, Location> client,\n+           final Function<Deployment, NodeMetadata> nodeMetadataAdapter,\n+           final Function<OSImage, Image> imageAdapter,\n+           final AddDefaultCredentialsToImage addDefaultCredentialsToImage) {\n+\n+      super(credentialStore,\n+              prioritizeCredentialsFromTemplate,\n+              client,\n+              nodeMetadataAdapter,\n+              imageAdapter,\n+              addDefaultCredentialsToImage);\n+\n+      this.client = (AzureComputeServiceAdapter) client;\n+      this.nodeMetadataAdapter = nodeMetadataAdapter;\n+   }\n+\n+   @Override\n+   public NodeMetadata destroyNode(final String id) {\n+      final Deployment node = client.internalDestroyNode(id);\n+      return node == null\n+              ? null\n+              : nodeMetadataAdapter.apply(node);","path":"azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/impl/AzureAdaptingComputeServiceStrategies.java","position":67,"original_position":67,"commit_id":"4a875ea4ef3f80e8e0f37b29b0822472bd4a36cc","original_commit_id":"4a875ea4ef3f80e8e0f37b29b0822472bd4a36cc","user":{"login":"ilgrosso","id":1064664,"avatar_url":"https://avatars.githubusercontent.com/u/1064664?v=3","gravatar_id":"","url":"https://api.github.com/users/ilgrosso","html_url":"https://github.com/ilgrosso","followers_url":"https://api.github.com/users/ilgrosso/followers","following_url":"https://api.github.com/users/ilgrosso/following{/other_user}","gists_url":"https://api.github.com/users/ilgrosso/gists{/gist_id}","starred_url":"https://api.github.com/users/ilgrosso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilgrosso/subscriptions","organizations_url":"https://api.github.com/users/ilgrosso/orgs","repos_url":"https://api.github.com/users/ilgrosso/repos","events_url":"https://api.github.com/users/ilgrosso/events{/privacy}","received_events_url":"https://api.github.com/users/ilgrosso/received_events","type":"User","site_admin":false},"body":"The [default implementation of destroyNode()](https://github.com/jclouds/jclouds/blob/master/compute/src/main/java/org/jclouds/compute/strategy/impl/AdaptingComputeServiceStrategies.java#L177) will simply rely on `getNode()` and, if such method returns NULL, not perform any delete.\r\n\r\nThe `getNode()` logic in Azure needs to be handled in a slightly different way (a \"node\" is returned only when the CloudService is available and all RoleInstance elements are in a non-transient state) so we implemented the logic for a sort of \"getNode for destroy\" in the `internalDestroyNode`. ","created_at":"2015-04-02T10:24:35Z","updated_at":"2015-04-02T10:24:35Z","html_url":"https://github.com/jclouds/jclouds-labs/pull/158#discussion_r27646053","pull_request_url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/158","_links":{"self":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/comments/27646053"},"html":{"href":"https://github.com/jclouds/jclouds-labs/pull/158#discussion_r27646053"},"pull_request":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/158"}}},"pull_request":{"url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/158","id":32097782,"html_url":"https://github.com/jclouds/jclouds-labs/pull/158","diff_url":"https://github.com/jclouds/jclouds-labs/pull/158.diff","patch_url":"https://github.com/jclouds/jclouds-labs/pull/158.patch","issue_url":"https://api.github.com/repos/jclouds/jclouds-labs/issues/158","number":158,"state":"open","locked":false,"title":"[JCLOUDS-849] All tests are green","user":{"login":"ilgrosso","id":1064664,"avatar_url":"https://avatars.githubusercontent.com/u/1064664?v=3","gravatar_id":"","url":"https://api.github.com/users/ilgrosso","html_url":"https://github.com/ilgrosso","followers_url":"https://api.github.com/users/ilgrosso/followers","following_url":"https://api.github.com/users/ilgrosso/following{/other_user}","gists_url":"https://api.github.com/users/ilgrosso/gists{/gist_id}","starred_url":"https://api.github.com/users/ilgrosso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilgrosso/subscriptions","organizations_url":"https://api.github.com/users/ilgrosso/orgs","repos_url":"https://api.github.com/users/ilgrosso/repos","events_url":"https://api.github.com/users/ilgrosso/events{/privacy}","received_events_url":"https://api.github.com/users/ilgrosso/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-27T10:52:32Z","updated_at":"2015-04-02T10:24:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"096c914d6fcfc547037ea1395728c02bf18b4393","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/158/commits","review_comments_url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/158/comments","review_comment_url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jclouds/jclouds-labs/issues/158/comments","statuses_url":"https://api.github.com/repos/jclouds/jclouds-labs/statuses/4a875ea4ef3f80e8e0f37b29b0822472bd4a36cc","head":{"label":"Tirasa:JCLOUDS-849","ref":"JCLOUDS-849","sha":"4a875ea4ef3f80e8e0f37b29b0822472bd4a36cc","user":{"login":"Tirasa","id":1718149,"avatar_url":"https://avatars.githubusercontent.com/u/1718149?v=3","gravatar_id":"","url":"https://api.github.com/users/Tirasa","html_url":"https://github.com/Tirasa","followers_url":"https://api.github.com/users/Tirasa/followers","following_url":"https://api.github.com/users/Tirasa/following{/other_user}","gists_url":"https://api.github.com/users/Tirasa/gists{/gist_id}","starred_url":"https://api.github.com/users/Tirasa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tirasa/subscriptions","organizations_url":"https://api.github.com/users/Tirasa/orgs","repos_url":"https://api.github.com/users/Tirasa/repos","events_url":"https://api.github.com/users/Tirasa/events{/privacy}","received_events_url":"https://api.github.com/users/Tirasa/received_events","type":"Organization","site_admin":false},"repo":{"id":31010558,"name":"jclouds-labs","full_name":"Tirasa/jclouds-labs","owner":{"login":"Tirasa","id":1718149,"avatar_url":"https://avatars.githubusercontent.com/u/1718149?v=3","gravatar_id":"","url":"https://api.github.com/users/Tirasa","html_url":"https://github.com/Tirasa","followers_url":"https://api.github.com/users/Tirasa/followers","following_url":"https://api.github.com/users/Tirasa/following{/other_user}","gists_url":"https://api.github.com/users/Tirasa/gists{/gist_id}","starred_url":"https://api.github.com/users/Tirasa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tirasa/subscriptions","organizations_url":"https://api.github.com/users/Tirasa/orgs","repos_url":"https://api.github.com/users/Tirasa/repos","events_url":"https://api.github.com/users/Tirasa/events{/privacy}","received_events_url":"https://api.github.com/users/Tirasa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Tirasa/jclouds-labs","description":"Read-only mirror of ASF Git Repo for jclouds labs","fork":true,"url":"https://api.github.com/repos/Tirasa/jclouds-labs","forks_url":"https://api.github.com/repos/Tirasa/jclouds-labs/forks","keys_url":"https://api.github.com/repos/Tirasa/jclouds-labs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tirasa/jclouds-labs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tirasa/jclouds-labs/teams","hooks_url":"https://api.github.com/repos/Tirasa/jclouds-labs/hooks","issue_events_url":"https://api.github.com/repos/Tirasa/jclouds-labs/issues/events{/number}","events_url":"https://api.github.com/repos/Tirasa/jclouds-labs/events","assignees_url":"https://api.github.com/repos/Tirasa/jclouds-labs/assignees{/user}","branches_url":"https://api.github.com/repos/Tirasa/jclouds-labs/branches{/branch}","tags_url":"https://api.github.com/repos/Tirasa/jclouds-labs/tags","blobs_url":"https://api.github.com/repos/Tirasa/jclouds-labs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tirasa/jclouds-labs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tirasa/jclouds-labs/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tirasa/jclouds-labs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tirasa/jclouds-labs/statuses/{sha}","languages_url":"https://api.github.com/repos/Tirasa/jclouds-labs/languages","stargazers_url":"https://api.github.com/repos/Tirasa/jclouds-labs/stargazers","contributors_url":"https://api.github.com/repos/Tirasa/jclouds-labs/contributors","subscribers_url":"https://api.github.com/repos/Tirasa/jclouds-labs/subscribers","subscription_url":"https://api.github.com/repos/Tirasa/jclouds-labs/subscription","commits_url":"https://api.github.com/repos/Tirasa/jclouds-labs/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tirasa/jclouds-labs/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tirasa/jclouds-labs/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tirasa/jclouds-labs/issues/comments{/number}","contents_url":"https://api.github.com/repos/Tirasa/jclouds-labs/contents/{+path}","compare_url":"https://api.github.com/repos/Tirasa/jclouds-labs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tirasa/jclouds-labs/merges","archive_url":"https://api.github.com/repos/Tirasa/jclouds-labs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tirasa/jclouds-labs/downloads","issues_url":"https://api.github.com/repos/Tirasa/jclouds-labs/issues{/number}","pulls_url":"https://api.github.com/repos/Tirasa/jclouds-labs/pulls{/number}","milestones_url":"https://api.github.com/repos/Tirasa/jclouds-labs/milestones{/number}","notifications_url":"https://api.github.com/repos/Tirasa/jclouds-labs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tirasa/jclouds-labs/labels{/name}","releases_url":"https://api.github.com/repos/Tirasa/jclouds-labs/releases{/id}","created_at":"2015-02-19T10:31:00Z","updated_at":"2015-04-02T09:37:20Z","pushed_at":"2015-04-02T10:03:24Z","git_url":"git://github.com/Tirasa/jclouds-labs.git","ssh_url":"git@github.com:Tirasa/jclouds-labs.git","clone_url":"https://github.com/Tirasa/jclouds-labs.git","svn_url":"https://github.com/Tirasa/jclouds-labs","homepage":null,"size":19908,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jclouds:master","ref":"master","sha":"0fd26fedc2ecac7ffa37dcb32b4424ba38a95946","user":{"login":"jclouds","id":108982,"avatar_url":"https://avatars.githubusercontent.com/u/108982?v=3","gravatar_id":"","url":"https://api.github.com/users/jclouds","html_url":"https://github.com/jclouds","followers_url":"https://api.github.com/users/jclouds/followers","following_url":"https://api.github.com/users/jclouds/following{/other_user}","gists_url":"https://api.github.com/users/jclouds/gists{/gist_id}","starred_url":"https://api.github.com/users/jclouds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jclouds/subscriptions","organizations_url":"https://api.github.com/users/jclouds/orgs","repos_url":"https://api.github.com/users/jclouds/repos","events_url":"https://api.github.com/users/jclouds/events{/privacy}","received_events_url":"https://api.github.com/users/jclouds/received_events","type":"Organization","site_admin":false},"repo":{"id":10040970,"name":"jclouds-labs","full_name":"jclouds/jclouds-labs","owner":{"login":"jclouds","id":108982,"avatar_url":"https://avatars.githubusercontent.com/u/108982?v=3","gravatar_id":"","url":"https://api.github.com/users/jclouds","html_url":"https://github.com/jclouds","followers_url":"https://api.github.com/users/jclouds/followers","following_url":"https://api.github.com/users/jclouds/following{/other_user}","gists_url":"https://api.github.com/users/jclouds/gists{/gist_id}","starred_url":"https://api.github.com/users/jclouds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jclouds/subscriptions","organizations_url":"https://api.github.com/users/jclouds/orgs","repos_url":"https://api.github.com/users/jclouds/repos","events_url":"https://api.github.com/users/jclouds/events{/privacy}","received_events_url":"https://api.github.com/users/jclouds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jclouds/jclouds-labs","description":"Read-only mirror of ASF Git Repo for jclouds labs","fork":false,"url":"https://api.github.com/repos/jclouds/jclouds-labs","forks_url":"https://api.github.com/repos/jclouds/jclouds-labs/forks","keys_url":"https://api.github.com/repos/jclouds/jclouds-labs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jclouds/jclouds-labs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jclouds/jclouds-labs/teams","hooks_url":"https://api.github.com/repos/jclouds/jclouds-labs/hooks","issue_events_url":"https://api.github.com/repos/jclouds/jclouds-labs/issues/events{/number}","events_url":"https://api.github.com/repos/jclouds/jclouds-labs/events","assignees_url":"https://api.github.com/repos/jclouds/jclouds-labs/assignees{/user}","branches_url":"https://api.github.com/repos/jclouds/jclouds-labs/branches{/branch}","tags_url":"https://api.github.com/repos/jclouds/jclouds-labs/tags","blobs_url":"https://api.github.com/repos/jclouds/jclouds-labs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jclouds/jclouds-labs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jclouds/jclouds-labs/git/refs{/sha}","trees_url":"https://api.github.com/repos/jclouds/jclouds-labs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jclouds/jclouds-labs/statuses/{sha}","languages_url":"https://api.github.com/repos/jclouds/jclouds-labs/languages","stargazers_url":"https://api.github.com/repos/jclouds/jclouds-labs/stargazers","contributors_url":"https://api.github.com/repos/jclouds/jclouds-labs/contributors","subscribers_url":"https://api.github.com/repos/jclouds/jclouds-labs/subscribers","subscription_url":"https://api.github.com/repos/jclouds/jclouds-labs/subscription","commits_url":"https://api.github.com/repos/jclouds/jclouds-labs/commits{/sha}","git_commits_url":"https://api.github.com/repos/jclouds/jclouds-labs/git/commits{/sha}","comments_url":"https://api.github.com/repos/jclouds/jclouds-labs/comments{/number}","issue_comment_url":"https://api.github.com/repos/jclouds/jclouds-labs/issues/comments{/number}","contents_url":"https://api.github.com/repos/jclouds/jclouds-labs/contents/{+path}","compare_url":"https://api.github.com/repos/jclouds/jclouds-labs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jclouds/jclouds-labs/merges","archive_url":"https://api.github.com/repos/jclouds/jclouds-labs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jclouds/jclouds-labs/downloads","issues_url":"https://api.github.com/repos/jclouds/jclouds-labs/issues{/number}","pulls_url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls{/number}","milestones_url":"https://api.github.com/repos/jclouds/jclouds-labs/milestones{/number}","notifications_url":"https://api.github.com/repos/jclouds/jclouds-labs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jclouds/jclouds-labs/labels{/name}","releases_url":"https://api.github.com/repos/jclouds/jclouds-labs/releases{/id}","created_at":"2013-05-13T20:47:47Z","updated_at":"2015-04-02T09:32:11Z","pushed_at":"2015-04-02T10:03:24Z","git_url":"git://github.com/jclouds/jclouds-labs.git","ssh_url":"git@github.com:jclouds/jclouds-labs.git","clone_url":"https://github.com/jclouds/jclouds-labs.git","svn_url":"https://github.com/jclouds/jclouds-labs","homepage":null,"size":29386,"stargazers_count":16,"watchers_count":16,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":14,"forks":64,"open_issues":14,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/158"},"html":{"href":"https://github.com/jclouds/jclouds-labs/pull/158"},"issue":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/issues/158"},"comments":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/issues/158/comments"},"review_comments":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/158/comments"},"review_comment":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/158/commits"},"statuses":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/statuses/4a875ea4ef3f80e8e0f37b29b0822472bd4a36cc"}}}}