{"action":"created","comment":{"url":"https://api.github.com/repos/mesosphere/exhibitor/pulls/comments/28281322","id":28281322,"diff_hunk":"@@ -0,0 +1,63 @@\n+package com.netflix.exhibitor.core.azure;\n+\n+import com.microsoft.azure.storage.CloudStorageAccount;\n+import com.microsoft.azure.storage.blob.*;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import java.io.ByteArrayInputStream;\n+import java.io.IOException;\n+\n+public class AzureClientImpl implements AzureClient {\n+    private final Logger log = LoggerFactory.getLogger(getClass());\n+    private final String storageConnectionString;\n+\n+    public AzureClientImpl(AzureCredential credentials) {\n+        this.storageConnectionString =\n+            \"DefaultEndpointsProtocol=http\" +\n+            \";AccountName=\" + credentials.getAccountName() +\n+            \";AccountKey=\" + credentials.getAccountKey();\n+    }\n+\n+    @Override\n+    public CloudBlobClient getClient() throws Exception {\n+        CloudStorageAccount storageAccount = CloudStorageAccount.parse(this.storageConnectionString);\n+        return storageAccount.createCloudBlobClient();\n+    }\n+\n+    @Override\n+    public CloudBlob getBlob(String containerName, String uri) throws Exception {\n+        CloudBlobContainer container = getClient().getContainerReference(containerName);\n+        return container.getBlockBlobReference(uri);\n+    }\n+\n+    @Override\n+    public BlobProperties getBlobProperties(String containerName, String uri) throws Exception {\n+        CloudBlob blob = getBlob(containerName, uri);\n+        blob.downloadAttributes();\n+        return blob.getProperties();\n+    }\n+\n+    @Override\n+    public Iterable<ListBlobItem> listBlobs(String containerName, String prefix) throws Exception {\n+        CloudBlobContainer container = getClient().getContainerReference(containerName);\n+        return container.listBlobs(prefix);\n+    }\n+\n+    @Override\n+    public void putBlob(byte[] bytes, String containerName, String uri) throws Exception {\n+        CloudBlob blob = getBlob(containerName, uri);\n+        blob.getContainer().createIfNotExists();\n+        blob.upload(new ByteArrayInputStream(bytes), bytes.length);\n+    }\n+\n+    @Override\n+    public void deleteBlob(String containerName, String uri) throws Exception {\n+        getBlob(containerName, uri).deleteIfExists();\n+    }\n+\n+    @Override\n+    public void close() throws IOException {","path":"exhibitor-core/src/main/java/com/netflix/exhibitor/core/azure/AzureClientImpl.java","position":60,"original_position":60,"commit_id":"fecb562afdb76be5f7c2d4cc2b3c4a070bd1b6f0","original_commit_id":"fecb562afdb76be5f7c2d4cc2b3c4a070bd1b6f0","user":{"login":"massenz","id":1153951,"avatar_url":"https://avatars.githubusercontent.com/u/1153951?v=3","gravatar_id":"","url":"https://api.github.com/users/massenz","html_url":"https://github.com/massenz","followers_url":"https://api.github.com/users/massenz/followers","following_url":"https://api.github.com/users/massenz/following{/other_user}","gists_url":"https://api.github.com/users/massenz/gists{/gist_id}","starred_url":"https://api.github.com/users/massenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/massenz/subscriptions","organizations_url":"https://api.github.com/users/massenz/orgs","repos_url":"https://api.github.com/users/massenz/repos","events_url":"https://api.github.com/users/massenz/events{/privacy}","received_events_url":"https://api.github.com/users/massenz/received_events","type":"User","site_admin":false},"body":"it may be worth considering adding a `closed` flag that gets set here, and any requests that come after will throw (with an appropriate error message).\r\nAlthough `closed` is not part of Azure semantics (or any object store, for that matter) it may help discover subtle (or blatant) bugs in client code: trying to access a resource that had been previously closed is a pretty strong signal not all is well :)","created_at":"2015-04-13T21:29:39Z","updated_at":"2015-04-13T21:29:39Z","html_url":"https://github.com/mesosphere/exhibitor/pull/1#discussion_r28281322","pull_request_url":"https://api.github.com/repos/mesosphere/exhibitor/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/mesosphere/exhibitor/pulls/comments/28281322"},"html":{"href":"https://github.com/mesosphere/exhibitor/pull/1#discussion_r28281322"},"pull_request":{"href":"https://api.github.com/repos/mesosphere/exhibitor/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/mesosphere/exhibitor/pulls/1","id":33201448,"html_url":"https://github.com/mesosphere/exhibitor/pull/1","diff_url":"https://github.com/mesosphere/exhibitor/pull/1.diff","patch_url":"https://github.com/mesosphere/exhibitor/pull/1.patch","issue_url":"https://api.github.com/repos/mesosphere/exhibitor/issues/1","number":1,"state":"open","locked":false,"title":"Azure support","user":{"login":"mbabineau","id":53127,"avatar_url":"https://avatars.githubusercontent.com/u/53127?v=3","gravatar_id":"","url":"https://api.github.com/users/mbabineau","html_url":"https://github.com/mbabineau","followers_url":"https://api.github.com/users/mbabineau/followers","following_url":"https://api.github.com/users/mbabineau/following{/other_user}","gists_url":"https://api.github.com/users/mbabineau/gists{/gist_id}","starred_url":"https://api.github.com/users/mbabineau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbabineau/subscriptions","organizations_url":"https://api.github.com/users/mbabineau/orgs","repos_url":"https://api.github.com/users/mbabineau/repos","events_url":"https://api.github.com/users/mbabineau/events{/privacy}","received_events_url":"https://api.github.com/users/mbabineau/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-13T20:43:42Z","updated_at":"2015-04-13T21:29:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mesosphere/exhibitor/pulls/1/commits","review_comments_url":"https://api.github.com/repos/mesosphere/exhibitor/pulls/1/comments","review_comment_url":"https://api.github.com/repos/mesosphere/exhibitor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mesosphere/exhibitor/issues/1/comments","statuses_url":"https://api.github.com/repos/mesosphere/exhibitor/statuses/fecb562afdb76be5f7c2d4cc2b3c4a070bd1b6f0","head":{"label":"mbabineau:azure_support","ref":"azure_support","sha":"fecb562afdb76be5f7c2d4cc2b3c4a070bd1b6f0","user":{"login":"mbabineau","id":53127,"avatar_url":"https://avatars.githubusercontent.com/u/53127?v=3","gravatar_id":"","url":"https://api.github.com/users/mbabineau","html_url":"https://github.com/mbabineau","followers_url":"https://api.github.com/users/mbabineau/followers","following_url":"https://api.github.com/users/mbabineau/following{/other_user}","gists_url":"https://api.github.com/users/mbabineau/gists{/gist_id}","starred_url":"https://api.github.com/users/mbabineau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbabineau/subscriptions","organizations_url":"https://api.github.com/users/mbabineau/orgs","repos_url":"https://api.github.com/users/mbabineau/repos","events_url":"https://api.github.com/users/mbabineau/events{/privacy}","received_events_url":"https://api.github.com/users/mbabineau/received_events","type":"User","site_admin":false},"repo":{"id":32826953,"name":"exhibitor","full_name":"mbabineau/exhibitor","owner":{"login":"mbabineau","id":53127,"avatar_url":"https://avatars.githubusercontent.com/u/53127?v=3","gravatar_id":"","url":"https://api.github.com/users/mbabineau","html_url":"https://github.com/mbabineau","followers_url":"https://api.github.com/users/mbabineau/followers","following_url":"https://api.github.com/users/mbabineau/following{/other_user}","gists_url":"https://api.github.com/users/mbabineau/gists{/gist_id}","starred_url":"https://api.github.com/users/mbabineau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbabineau/subscriptions","organizations_url":"https://api.github.com/users/mbabineau/orgs","repos_url":"https://api.github.com/users/mbabineau/repos","events_url":"https://api.github.com/users/mbabineau/events{/privacy}","received_events_url":"https://api.github.com/users/mbabineau/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mbabineau/exhibitor","description":"ZooKeeper co-process for instance monitoring, backup/recovery, cleanup and visualization.","fork":true,"url":"https://api.github.com/repos/mbabineau/exhibitor","forks_url":"https://api.github.com/repos/mbabineau/exhibitor/forks","keys_url":"https://api.github.com/repos/mbabineau/exhibitor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mbabineau/exhibitor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mbabineau/exhibitor/teams","hooks_url":"https://api.github.com/repos/mbabineau/exhibitor/hooks","issue_events_url":"https://api.github.com/repos/mbabineau/exhibitor/issues/events{/number}","events_url":"https://api.github.com/repos/mbabineau/exhibitor/events","assignees_url":"https://api.github.com/repos/mbabineau/exhibitor/assignees{/user}","branches_url":"https://api.github.com/repos/mbabineau/exhibitor/branches{/branch}","tags_url":"https://api.github.com/repos/mbabineau/exhibitor/tags","blobs_url":"https://api.github.com/repos/mbabineau/exhibitor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mbabineau/exhibitor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mbabineau/exhibitor/git/refs{/sha}","trees_url":"https://api.github.com/repos/mbabineau/exhibitor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mbabineau/exhibitor/statuses/{sha}","languages_url":"https://api.github.com/repos/mbabineau/exhibitor/languages","stargazers_url":"https://api.github.com/repos/mbabineau/exhibitor/stargazers","contributors_url":"https://api.github.com/repos/mbabineau/exhibitor/contributors","subscribers_url":"https://api.github.com/repos/mbabineau/exhibitor/subscribers","subscription_url":"https://api.github.com/repos/mbabineau/exhibitor/subscription","commits_url":"https://api.github.com/repos/mbabineau/exhibitor/commits{/sha}","git_commits_url":"https://api.github.com/repos/mbabineau/exhibitor/git/commits{/sha}","comments_url":"https://api.github.com/repos/mbabineau/exhibitor/comments{/number}","issue_comment_url":"https://api.github.com/repos/mbabineau/exhibitor/issues/comments{/number}","contents_url":"https://api.github.com/repos/mbabineau/exhibitor/contents/{+path}","compare_url":"https://api.github.com/repos/mbabineau/exhibitor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mbabineau/exhibitor/merges","archive_url":"https://api.github.com/repos/mbabineau/exhibitor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mbabineau/exhibitor/downloads","issues_url":"https://api.github.com/repos/mbabineau/exhibitor/issues{/number}","pulls_url":"https://api.github.com/repos/mbabineau/exhibitor/pulls{/number}","milestones_url":"https://api.github.com/repos/mbabineau/exhibitor/milestones{/number}","notifications_url":"https://api.github.com/repos/mbabineau/exhibitor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mbabineau/exhibitor/labels{/name}","releases_url":"https://api.github.com/repos/mbabineau/exhibitor/releases{/id}","created_at":"2015-03-24T21:43:57Z","updated_at":"2015-04-08T01:24:07Z","pushed_at":"2015-04-08T01:25:07Z","git_url":"git://github.com/mbabineau/exhibitor.git","ssh_url":"git@github.com:mbabineau/exhibitor.git","clone_url":"https://github.com/mbabineau/exhibitor.git","svn_url":"https://github.com/mbabineau/exhibitor","homepage":"","size":3029,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mesosphere:master","ref":"master","sha":"90709bc22f7d7a286b4f2c90ca5ccca10a5ca717","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":33565057,"name":"exhibitor","full_name":"mesosphere/exhibitor","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/exhibitor","description":"ZooKeeper co-process for instance monitoring, backup/recovery, cleanup and visualization.","fork":true,"url":"https://api.github.com/repos/mesosphere/exhibitor","forks_url":"https://api.github.com/repos/mesosphere/exhibitor/forks","keys_url":"https://api.github.com/repos/mesosphere/exhibitor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/exhibitor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/exhibitor/teams","hooks_url":"https://api.github.com/repos/mesosphere/exhibitor/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/exhibitor/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/exhibitor/events","assignees_url":"https://api.github.com/repos/mesosphere/exhibitor/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/exhibitor/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/exhibitor/tags","blobs_url":"https://api.github.com/repos/mesosphere/exhibitor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/exhibitor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/exhibitor/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/exhibitor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/exhibitor/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/exhibitor/languages","stargazers_url":"https://api.github.com/repos/mesosphere/exhibitor/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/exhibitor/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/exhibitor/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/exhibitor/subscription","commits_url":"https://api.github.com/repos/mesosphere/exhibitor/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/exhibitor/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/exhibitor/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/exhibitor/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/exhibitor/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/exhibitor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/exhibitor/merges","archive_url":"https://api.github.com/repos/mesosphere/exhibitor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/exhibitor/downloads","issues_url":"https://api.github.com/repos/mesosphere/exhibitor/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/exhibitor/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/exhibitor/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/exhibitor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/exhibitor/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/exhibitor/releases{/id}","created_at":"2015-04-07T19:56:50Z","updated_at":"2015-04-07T19:56:51Z","pushed_at":"2015-04-13T20:43:42Z","git_url":"git://github.com/mesosphere/exhibitor.git","ssh_url":"git@github.com:mesosphere/exhibitor.git","clone_url":"https://github.com/mesosphere/exhibitor.git","svn_url":"https://github.com/mesosphere/exhibitor","homepage":"","size":2938,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mesosphere/exhibitor/pulls/1"},"html":{"href":"https://github.com/mesosphere/exhibitor/pull/1"},"issue":{"href":"https://api.github.com/repos/mesosphere/exhibitor/issues/1"},"comments":{"href":"https://api.github.com/repos/mesosphere/exhibitor/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/mesosphere/exhibitor/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/mesosphere/exhibitor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mesosphere/exhibitor/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/mesosphere/exhibitor/statuses/fecb562afdb76be5f7c2d4cc2b3c4a070bd1b6f0"}}}}