{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments/57817375","id":57817375,"diff_hunk":"@@ -0,0 +1,157 @@\n+/*\n+ * Copyright 2016 Google Inc. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * 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+\n+package com.google.gcloud.compute;\n+\n+import static com.google.common.base.Preconditions.checkNotNull;\n+\n+import com.google.api.services.compute.model.Image;\n+import com.google.common.base.MoreObjects;\n+\n+import java.util.Objects;\n+\n+/**\n+ * A Google Compute Engine disk image configuration. This class can be used to create images from an\n+ * existing Google Compute Engine disk.\n+ */\n+public class DiskImageConfiguration extends ImageConfiguration {\n+\n+  private static final long serialVersionUID = 2716403667042981170L;\n+\n+  private final DiskId sourceDisk;\n+  private final String sourceDiskId;\n+\n+  /**\n+   * A builder for {@code DiskImageConfiguration} objects.\n+   */\n+  public static final class Builder\n+      extends ImageConfiguration.Builder<DiskImageConfiguration, Builder> {\n+\n+    private DiskId sourceDisk;\n+    private String sourceDiskId;\n+\n+    private Builder() {}\n+\n+    private Builder(DiskImageConfiguration imageConfiguration) {\n+      super(imageConfiguration);\n+      this.sourceDisk = imageConfiguration.sourceDisk;\n+      this.sourceDiskId = imageConfiguration.sourceDiskId;\n+    }\n+\n+    private Builder(Image imagePb) {\n+      super(imagePb);\n+      this.sourceDisk = DiskId.fromUrl(imagePb.getSourceDisk());\n+      this.sourceDiskId = imagePb.getSourceDiskId();\n+    }\n+\n+    /**\n+     * Sets the identity of the source disk used to create the image.\n+     */\n+    public Builder sourceDisk(DiskId sourceDisk) {\n+      this.sourceDisk = checkNotNull(sourceDisk);\n+      return this;\n+    }\n+\n+    Builder sourceDiskId(String sourceDiskId) {\n+      this.sourceDiskId = sourceDiskId;\n+      return this;\n+    }\n+\n+    /**\n+     * Creates a {@code DiskImageConfiguration} object.\n+     */\n+    @Override\n+    public DiskImageConfiguration build() {\n+      return new DiskImageConfiguration(this);\n+    }\n+  }\n+\n+  private DiskImageConfiguration(Builder builder) {\n+    super(builder);\n+    this.sourceDisk = checkNotNull(builder.sourceDisk);\n+    this.sourceDiskId = builder.sourceDiskId;\n+  }\n+\n+  /**\n+   * Returns the identity of the source disk used to create this image.\n+   */\n+  public DiskId sourceDisk() {\n+    return sourceDisk;\n+  }\n+\n+  /**\n+   * Returns the id of the disk used to create this image. This value may be used to determine\n+   * whether the image was taken from the current or a previous instance of a given disk name.\n+   */\n+  public String sourceDiskId() {","path":"gcloud-java-compute/src/main/java/com/google/gcloud/compute/DiskImageConfiguration.java","position":99,"original_position":99,"commit_id":"d270654711123757d4763fc24b432b35f9bead8f","original_commit_id":"d270654711123757d4763fc24b432b35f9bead8f","user":{"login":"aozarov","id":8921691,"avatar_url":"https://avatars.githubusercontent.com/u/8921691?v=3","gravatar_id":"","url":"https://api.github.com/users/aozarov","html_url":"https://github.com/aozarov","followers_url":"https://api.github.com/users/aozarov/followers","following_url":"https://api.github.com/users/aozarov/following{/other_user}","gists_url":"https://api.github.com/users/aozarov/gists{/gist_id}","starred_url":"https://api.github.com/users/aozarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aozarov/subscriptions","organizations_url":"https://api.github.com/users/aozarov/orgs","repos_url":"https://api.github.com/users/aozarov/repos","events_url":"https://api.github.com/users/aozarov/events{/privacy}","received_events_url":"https://api.github.com/users/aozarov/received_events","type":"User","site_admin":false},"body":"So far (and the reason I was confused) I thought we used something like `DiskId sourceDiskId()` and `String sourceId()`. no?","created_at":"2016-03-29T23:24:35Z","updated_at":"2016-03-29T23:24:35Z","html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/794#discussion_r57817375","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/794","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments/57817375"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/794#discussion_r57817375"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/794"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/794","id":64223040,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/794","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/794.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/794.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/794","number":794,"state":"open","locked":false,"title":"Add ImageInfo, ImageId and test classes","user":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"body":"This PR adds `ImageId`, `ImageInfo` and related test classes.\r\nImages can be deprecated using [deprecate](https://cloud.google.com/compute/docs/reference/latest/images/deprecate) by passing a `DeprecationStatus` object.\r\nThis PR also refactors `DeprecationStatus` to add a public builder.\r\n\r\nFollowing issue #732 this PR also makes `DeprecationStatus` more tolerant in parsing timestamps (also partial timestamps are supported now).\r\nHowever as per #732 no checks are made on `deleted`, `deprecated` and `obsolete` timestamps provided to [deprecate](https://cloud.google.com/compute/docs/reference/latest/images/deprecate). If a user misused such fields, creating a `DeprecationStatus` might fail. Should we make `deleted`, `deprecated` and `obsolete` of `String` type? Or keep them of `Long` type and set them to `null` if the string value is not parsable?","created_at":"2016-03-26T00:49:52Z","updated_at":"2016-03-29T23:24:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f59d88d9f109f1de4d427af07dcb7524fc30b8d9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/794/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/794/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/794/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/d270654711123757d4763fc24b432b35f9bead8f","head":{"label":"mziccard:compute-image","ref":"compute-image","sha":"d270654711123757d4763fc24b432b35f9bead8f","user":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"repo":{"id":40965279,"name":"gcloud-java","full_name":"mziccard/gcloud-java","owner":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mziccard/gcloud-java","description":"Google Cloud Client Library for Java","fork":true,"url":"https://api.github.com/repos/mziccard/gcloud-java","forks_url":"https://api.github.com/repos/mziccard/gcloud-java/forks","keys_url":"https://api.github.com/repos/mziccard/gcloud-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mziccard/gcloud-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mziccard/gcloud-java/teams","hooks_url":"https://api.github.com/repos/mziccard/gcloud-java/hooks","issue_events_url":"https://api.github.com/repos/mziccard/gcloud-java/issues/events{/number}","events_url":"https://api.github.com/repos/mziccard/gcloud-java/events","assignees_url":"https://api.github.com/repos/mziccard/gcloud-java/assignees{/user}","branches_url":"https://api.github.com/repos/mziccard/gcloud-java/branches{/branch}","tags_url":"https://api.github.com/repos/mziccard/gcloud-java/tags","blobs_url":"https://api.github.com/repos/mziccard/gcloud-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mziccard/gcloud-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mziccard/gcloud-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/mziccard/gcloud-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mziccard/gcloud-java/statuses/{sha}","languages_url":"https://api.github.com/repos/mziccard/gcloud-java/languages","stargazers_url":"https://api.github.com/repos/mziccard/gcloud-java/stargazers","contributors_url":"https://api.github.com/repos/mziccard/gcloud-java/contributors","subscribers_url":"https://api.github.com/repos/mziccard/gcloud-java/subscribers","subscription_url":"https://api.github.com/repos/mziccard/gcloud-java/subscription","commits_url":"https://api.github.com/repos/mziccard/gcloud-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/mziccard/gcloud-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/mziccard/gcloud-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/mziccard/gcloud-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/mziccard/gcloud-java/contents/{+path}","compare_url":"https://api.github.com/repos/mziccard/gcloud-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mziccard/gcloud-java/merges","archive_url":"https://api.github.com/repos/mziccard/gcloud-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mziccard/gcloud-java/downloads","issues_url":"https://api.github.com/repos/mziccard/gcloud-java/issues{/number}","pulls_url":"https://api.github.com/repos/mziccard/gcloud-java/pulls{/number}","milestones_url":"https://api.github.com/repos/mziccard/gcloud-java/milestones{/number}","notifications_url":"https://api.github.com/repos/mziccard/gcloud-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mziccard/gcloud-java/labels{/name}","releases_url":"https://api.github.com/repos/mziccard/gcloud-java/releases{/id}","deployments_url":"https://api.github.com/repos/mziccard/gcloud-java/deployments","created_at":"2015-08-18T10:16:17Z","updated_at":"2016-01-12T12:42:25Z","pushed_at":"2016-03-29T20:35:36Z","git_url":"git://github.com/mziccard/gcloud-java.git","ssh_url":"git@github.com:mziccard/gcloud-java.git","clone_url":"https://github.com/mziccard/gcloud-java.git","svn_url":"https://github.com/mziccard/gcloud-java","homepage":"http://googlecloudplatform.github.io/gcloud-java/site/0.0.6/","size":18030,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:compute-alpha","ref":"compute-alpha","sha":"32394d2bc1efadad7973ea68cdc68bbc9fe879a5","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":26181278,"name":"gcloud-java","full_name":"GoogleCloudPlatform/gcloud-java","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-java","description":"Google Cloud Client Library for Java","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/deployments","created_at":"2014-11-04T17:57:16Z","updated_at":"2016-03-29T09:09:00Z","pushed_at":"2016-03-29T23:20:29Z","git_url":"git://github.com/GoogleCloudPlatform/gcloud-java.git","ssh_url":"git@github.com:GoogleCloudPlatform/gcloud-java.git","clone_url":"https://github.com/GoogleCloudPlatform/gcloud-java.git","svn_url":"https://github.com/GoogleCloudPlatform/gcloud-java","homepage":"http://googlecloudplatform.github.io/gcloud-java/","size":219363,"stargazers_count":76,"watchers_count":76,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"open_issues_count":141,"forks":41,"open_issues":141,"watchers":76,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/794"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/794"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/794"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/794/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/794/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/794/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/d270654711123757d4763fc24b432b35f9bead8f"}}}}