{"action":"created","comment":{"url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/comments/24748535","id":24748535,"diff_hunk":"@@ -0,0 +1,88 @@\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+ * This file has been modified by Microsoft Open Technologies, Inc.\n+ * Modifications copyright (c) Microsoft Open Technologies, Inc.\n+ */\n+package org.jclouds.azurecompute.compute.functions;\n+\n+import java.util.Map;\n+\n+import javax.annotation.Resource;\n+import javax.inject.Inject;\n+import javax.inject.Named;\n+import javax.inject.Singleton;\n+\n+import com.google.common.collect.ImmutableMap;\n+import org.jclouds.azurecompute.domain.OSImage;\n+import org.jclouds.compute.domain.Image;\n+import org.jclouds.compute.domain.ImageBuilder;\n+import org.jclouds.compute.domain.OperatingSystem;\n+import org.jclouds.compute.domain.OsFamily;\n+import org.jclouds.compute.domain.Image.Status;\n+import org.jclouds.compute.reference.ComputeServiceConstants;\n+import org.jclouds.logging.Logger;\n+\n+import com.google.common.base.Function;\n+\n+@Singleton\n+public class OSImageToImage implements Function<OSImage, Image> {\n+    private static String PUBLIC_CATEGORY = \"Public\";\n+    @Resource\n+    @Named(ComputeServiceConstants.COMPUTE_LOGGER)\n+    protected Logger logger = Logger.NULL;\n+\n+    private final Map<OsFamily, Map<String, String>> osVersionMap;\n+\n+    @Inject\n+    OSImageToImage(Map<OsFamily, Map<String, String>> osVersionMap) {\n+        this.osVersionMap = osVersionMap;\n+    }\n+\n+    protected OperatingSystem parseOs(OSImage from) {\n+        OsFamily osFamily = null;\n+        String osName = from.getImageFamily();  //from.getLabel();\n+        String osArch = \"\"; //from.getImageFamily();\n+        String osVersion = from.getPublishedDate() == null ? null : \"\" + from.getPublishedDate().getTimeInMillis();\n+        String osDescription = \"\"; //from.getDescription() == null ? \"\" : from.getDescription();\n+        try {\n+            osFamily = OsFamily.fromValue(from.getOSType().toLowerCase());\n+        } catch (IllegalArgumentException e) {\n+            logger.debug(\"<< didn't match os(%s)\", from.getName());\n+        }\n+        boolean is64Bit = true;\n+//                (from.getName() != null && from.getName().contains(\"64\")) ||\n+//                (from.getDescription() != null && from.getDescription().contains(\"64\")) ||\n+//                (from.getLabel() != null && from.getLabel().contains(\"64\")) || osFamily == OsFamily.WINDOWS;\n+\n+        return new OperatingSystem(osFamily, osName, osVersion, osArch, osDescription, is64Bit);\n+    }\n+\n+    @Override\n+    public Image apply(OSImage from) {\n+        ImageBuilder builder = new ImageBuilder();\n+        builder.ids(from.getName());","path":"azure/compute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java","position":77,"original_position":77,"commit_id":"6bebe88f063272a338545758ffee5e46e257dfdb","original_commit_id":"6bebe88f063272a338545758ffee5e46e257dfdb","user":{"login":"nacx","id":446705,"avatar_url":"https://avatars.githubusercontent.com/u/446705?v=3","gravatar_id":"","url":"https://api.github.com/users/nacx","html_url":"https://github.com/nacx","followers_url":"https://api.github.com/users/nacx/followers","following_url":"https://api.github.com/users/nacx/following{/other_user}","gists_url":"https://api.github.com/users/nacx/gists{/gist_id}","starred_url":"https://api.github.com/users/nacx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nacx/subscriptions","organizations_url":"https://api.github.com/users/nacx/orgs","repos_url":"https://api.github.com/users/nacx/repos","events_url":"https://api.github.com/users/nacx/events{/privacy}","received_events_url":"https://api.github.com/users/nacx/received_events","type":"User","site_admin":false},"body":"This sets two fields: the `id` and the `providerId`. The former is the ID jclouds will use to identify uniquely the image across all regions, and the latter the *real* ID of the resource in the provider. Is this true in this case?\r\nUsually jclouds uses a different ID and prepends the region to the provider ID. Take this into accound to make sure the providerId and the id (which is the one used when calling getImage(id) in the computeservice) are configured properly.","created_at":"2015-02-16T12:46:15Z","updated_at":"2015-02-16T12:46:15Z","html_url":"https://github.com/jclouds/jclouds-labs/pull/132#discussion_r24748535","pull_request_url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/132","_links":{"self":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/comments/24748535"},"html":{"href":"https://github.com/jclouds/jclouds-labs/pull/132#discussion_r24748535"},"pull_request":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/132"}}},"pull_request":{"url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/132","id":28950261,"html_url":"https://github.com/jclouds/jclouds-labs/pull/132","diff_url":"https://github.com/jclouds/jclouds-labs/pull/132.diff","patch_url":"https://github.com/jclouds/jclouds-labs/pull/132.patch","issue_url":"https://api.github.com/repos/jclouds/jclouds-labs/issues/132","number":132,"state":"open","locked":false,"title":"In progress implementation of JClouds for Azure","user":{"login":"eduardkoller","id":1189197,"avatar_url":"https://avatars.githubusercontent.com/u/1189197?v=3","gravatar_id":"","url":"https://api.github.com/users/eduardkoller","html_url":"https://github.com/eduardkoller","followers_url":"https://api.github.com/users/eduardkoller/followers","following_url":"https://api.github.com/users/eduardkoller/following{/other_user}","gists_url":"https://api.github.com/users/eduardkoller/gists{/gist_id}","starred_url":"https://api.github.com/users/eduardkoller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eduardkoller/subscriptions","organizations_url":"https://api.github.com/users/eduardkoller/orgs","repos_url":"https://api.github.com/users/eduardkoller/repos","events_url":"https://api.github.com/users/eduardkoller/events{/privacy}","received_events_url":"https://api.github.com/users/eduardkoller/received_events","type":"User","site_admin":false},"body":"Initial contribution for the Azure provider.\r\nhttps://issues.apache.org/jira/browse/JCLOUDS-818","created_at":"2015-02-09T19:46:05Z","updated_at":"2015-02-16T12:46:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ad64690c8e5bd8b13c34d13f82675d6b8a4e1a1b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/132/commits","review_comments_url":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/132/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/132/comments","statuses_url":"https://api.github.com/repos/jclouds/jclouds-labs/statuses/6bebe88f063272a338545758ffee5e46e257dfdb","head":{"label":"MSOpenTech:azure","ref":"azure","sha":"6bebe88f063272a338545758ffee5e46e257dfdb","user":{"login":"MSOpenTech","id":1638184,"avatar_url":"https://avatars.githubusercontent.com/u/1638184?v=3","gravatar_id":"","url":"https://api.github.com/users/MSOpenTech","html_url":"https://github.com/MSOpenTech","followers_url":"https://api.github.com/users/MSOpenTech/followers","following_url":"https://api.github.com/users/MSOpenTech/following{/other_user}","gists_url":"https://api.github.com/users/MSOpenTech/gists{/gist_id}","starred_url":"https://api.github.com/users/MSOpenTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSOpenTech/subscriptions","organizations_url":"https://api.github.com/users/MSOpenTech/orgs","repos_url":"https://api.github.com/users/MSOpenTech/repos","events_url":"https://api.github.com/users/MSOpenTech/events{/privacy}","received_events_url":"https://api.github.com/users/MSOpenTech/received_events","type":"Organization","site_admin":false},"repo":{"id":30553606,"name":"jclouds-labs","full_name":"MSOpenTech/jclouds-labs","owner":{"login":"MSOpenTech","id":1638184,"avatar_url":"https://avatars.githubusercontent.com/u/1638184?v=3","gravatar_id":"","url":"https://api.github.com/users/MSOpenTech","html_url":"https://github.com/MSOpenTech","followers_url":"https://api.github.com/users/MSOpenTech/followers","following_url":"https://api.github.com/users/MSOpenTech/following{/other_user}","gists_url":"https://api.github.com/users/MSOpenTech/gists{/gist_id}","starred_url":"https://api.github.com/users/MSOpenTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSOpenTech/subscriptions","organizations_url":"https://api.github.com/users/MSOpenTech/orgs","repos_url":"https://api.github.com/users/MSOpenTech/repos","events_url":"https://api.github.com/users/MSOpenTech/events{/privacy}","received_events_url":"https://api.github.com/users/MSOpenTech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MSOpenTech/jclouds-labs","description":"Read-only mirror of ASF Git Repo for jclouds labs","fork":true,"url":"https://api.github.com/repos/MSOpenTech/jclouds-labs","forks_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/forks","keys_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/teams","hooks_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/hooks","issue_events_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/issues/events{/number}","events_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/events","assignees_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/assignees{/user}","branches_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/branches{/branch}","tags_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/tags","blobs_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/git/refs{/sha}","trees_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/statuses/{sha}","languages_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/languages","stargazers_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/stargazers","contributors_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/contributors","subscribers_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/subscribers","subscription_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/subscription","commits_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/commits{/sha}","git_commits_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/git/commits{/sha}","comments_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/comments{/number}","issue_comment_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/issues/comments/{number}","contents_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/contents/{+path}","compare_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/merges","archive_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/downloads","issues_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/issues{/number}","pulls_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/pulls{/number}","milestones_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/milestones{/number}","notifications_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/labels{/name}","releases_url":"https://api.github.com/repos/MSOpenTech/jclouds-labs/releases{/id}","created_at":"2015-02-09T19:20:40Z","updated_at":"2015-02-09T19:20:42Z","pushed_at":"2015-02-09T19:22:06Z","git_url":"git://github.com/MSOpenTech/jclouds-labs.git","ssh_url":"git@github.com:MSOpenTech/jclouds-labs.git","clone_url":"https://github.com/MSOpenTech/jclouds-labs.git","svn_url":"https://github.com/MSOpenTech/jclouds-labs","homepage":null,"size":19386,"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":"58a9be6ad13be1df6f2db7750041d2adee23e61c","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-02-11T17:02:59Z","pushed_at":"2015-02-11T17:02:59Z","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":28415,"stargazers_count":16,"watchers_count":16,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":59,"mirror_url":null,"open_issues_count":8,"forks":59,"open_issues":8,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/132"},"html":{"href":"https://github.com/jclouds/jclouds-labs/pull/132"},"issue":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/issues/132"},"comments":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/issues/132/comments"},"review_comments":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/pulls/132/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/132/commits"},"statuses":{"href":"https://api.github.com/repos/jclouds/jclouds-labs/statuses/6bebe88f063272a338545758ffee5e46e257dfdb"}}}}