{"action":"created","comment":{"url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/comments/24444816","id":24444816,"diff_hunk":"@@ -0,0 +1,136 @@\n+package storageservice\n+\n+import (\n+\t\"encoding/base64\"\n+\t\"encoding/xml\"\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"strings\"\n+\n+\t\"github.com/MSOpenTech/azure-sdk-for-go/azure\"\n+)\n+\n+const (\n+\tazureStorageServiceListURL = \"services/storageservices\"\n+\tazureStorageServiceURL     = \"services/storageservices/%s\"\n+\n+\tazureXmlns = \"http://schemas.microsoft.com/windowsazure\"\n+\n+\terrBlobEndpointNotFound = \"Blob endpoint was not found in storage serice %s\"\n+\terrParamNotSpecified    = \"Parameter %s is not specified.\"\n+)\n+\n+//NewClient is used to instantiate a new StorageServiceClient from an Azure client\n+func NewClient(self *azure.Client) *StorageServiceClient {\n+\treturn &StorageServiceClient{client: self}\n+}\n+\n+func (self *StorageServiceClient) GetStorageServiceList() (*StorageServiceList, error) {\n+\tstorageServiceList := new(StorageServiceList)\n+\n+\tresponse, err := self.client.SendAzureGetRequest(azureStorageServiceListURL)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\terr = xml.Unmarshal(response, storageServiceList)\n+\tif err != nil {\n+\t\treturn storageServiceList, err\n+\t}\n+\n+\treturn storageServiceList, nil\n+}\n+\n+func (self *StorageServiceClient) GetStorageServiceByName(serviceName string) (*StorageService, error) {\n+\tif len(serviceName) == 0 {\n+\t\treturn nil, fmt.Errorf(errParamNotSpecified, \"serviceName\")\n+\t}\n+\n+\tstorageService := new(StorageService)\n+\trequestURL := fmt.Sprintf(azureStorageServiceURL, serviceName)\n+\tresponse, err := self.client.SendAzureGetRequest(requestURL)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\terr = xml.Unmarshal(response, storageService)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\treturn storageService, nil\n+}\n+\n+func (self *StorageServiceClient) GetStorageServiceByLocation(location string) (*StorageService, error) {","path":"azure/storageservice/client.go","position":64,"original_position":64,"commit_id":"467357135762f2d88b82495496d655b9a9c69394","original_commit_id":"467357135762f2d88b82495496d655b9a9c69394","user":{"login":"hopetobelievein","id":6327511,"avatar_url":"https://avatars.githubusercontent.com/u/6327511?v=3","gravatar_id":"","url":"https://api.github.com/users/hopetobelievein","html_url":"https://github.com/hopetobelievein","followers_url":"https://api.github.com/users/hopetobelievein/followers","following_url":"https://api.github.com/users/hopetobelievein/following{/other_user}","gists_url":"https://api.github.com/users/hopetobelievein/gists{/gist_id}","starred_url":"https://api.github.com/users/hopetobelievein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hopetobelievein/subscriptions","organizations_url":"https://api.github.com/users/hopetobelievein/orgs","repos_url":"https://api.github.com/users/hopetobelievein/repos","events_url":"https://api.github.com/users/hopetobelievein/events{/privacy}","received_events_url":"https://api.github.com/users/hopetobelievein/received_events","type":"User","site_admin":false},"body":"@ahmetalpbalkan This method is used to create VHD media link for VM's OS virtual hard disk. I was checking for storage services in specified location and using first one if there are any. \r\nI agree that we can change name to something more suitable.","created_at":"2015-02-10T19:55:57Z","updated_at":"2015-02-10T19:55:57Z","html_url":"https://github.com/MSOpenTech/azure-sdk-for-go/pull/39#discussion_r24444816","pull_request_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/comments/24444816"},"html":{"href":"https://github.com/MSOpenTech/azure-sdk-for-go/pull/39#discussion_r24444816"},"pull_request":{"href":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/39","id":28966881,"html_url":"https://github.com/MSOpenTech/azure-sdk-for-go/pull/39","diff_url":"https://github.com/MSOpenTech/azure-sdk-for-go/pull/39.diff","patch_url":"https://github.com/MSOpenTech/azure-sdk-for-go/pull/39.patch","issue_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/issues/39","number":39,"state":"open","locked":false,"title":"Convert to having a stateful client","user":{"login":"jen20","id":548524,"avatar_url":"https://avatars.githubusercontent.com/u/548524?v=3","gravatar_id":"","url":"https://api.github.com/users/jen20","html_url":"https://github.com/jen20","followers_url":"https://api.github.com/users/jen20/followers","following_url":"https://api.github.com/users/jen20/following{/other_user}","gists_url":"https://api.github.com/users/jen20/gists{/gist_id}","starred_url":"https://api.github.com/users/jen20/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jen20/subscriptions","organizations_url":"https://api.github.com/users/jen20/orgs","repos_url":"https://api.github.com/users/jen20/repos","events_url":"https://api.github.com/users/jen20/events{/privacy}","received_events_url":"https://api.github.com/users/jen20/received_events","type":"User","site_admin":false},"body":"Note that this is a continuation of #37, to avoid force pushing having squashed the commits for clean history.\r\n\r\nThis pull request introduces a large refactoring. Rather than having global state storing the subscription information, there is now a type named `azure.Client`, which is initialized with an `azure.Config` containing the profile settings. Operations are then invoked on this client, meaning that multiple subscriptions can be managed in one process.\r\n\r\nIn addition, the package names have been rationalized, and it is necessary to pass the generic azure.Client to each of the specific service clients. For example:\r\n\r\n```go\r\n//Create a generic azure client\r\nconfig := &azure.Config{\r\n    PublishSettingsFilePath: \"path/to/settings\",\r\n}\r\nclient, err := azure.NewClient(config)\r\n\r\n//Create a client to the hosted service API on which operations can\r\n//be invoked.\r\nhostedServiceClient := hostedservice.NewClient(client)\r\n```","created_at":"2015-02-09T23:25:44Z","updated_at":"2015-02-10T19:55:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d52eb6f97ef776a1fa53c325b0f6882f729c8601","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/39/commits","review_comments_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/39/comments","review_comment_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/comments/{number}","comments_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/issues/39/comments","statuses_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/statuses/467357135762f2d88b82495496d655b9a9c69394","head":{"label":"MSOpenTech:jen20-stateful-client-squashed","ref":"jen20-stateful-client-squashed","sha":"467357135762f2d88b82495496d655b9a9c69394","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":22855240,"name":"azure-sdk-for-go","full_name":"MSOpenTech/azure-sdk-for-go","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/azure-sdk-for-go","description":"azure-sdk-for-go","fork":false,"url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go","forks_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/forks","keys_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/teams","hooks_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/hooks","issue_events_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/issues/events{/number}","events_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/events","assignees_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/assignees{/user}","branches_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/branches{/branch}","tags_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/tags","blobs_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/statuses/{sha}","languages_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/languages","stargazers_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/stargazers","contributors_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/contributors","subscribers_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/subscribers","subscription_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/subscription","commits_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/issues/comments/{number}","contents_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/contents/{+path}","compare_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/merges","archive_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/downloads","issues_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/issues{/number}","pulls_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls{/number}","milestones_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/milestones{/number}","notifications_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/labels{/name}","releases_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/releases{/id}","created_at":"2014-08-11T21:18:43Z","updated_at":"2015-02-10T11:34:32Z","pushed_at":"2015-02-09T23:23:37Z","git_url":"git://github.com/MSOpenTech/azure-sdk-for-go.git","ssh_url":"git@github.com:MSOpenTech/azure-sdk-for-go.git","clone_url":"https://github.com/MSOpenTech/azure-sdk-for-go.git","svn_url":"https://github.com/MSOpenTech/azure-sdk-for-go","homepage":null,"size":1333,"stargazers_count":28,"watchers_count":28,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":5,"forks":14,"open_issues":5,"watchers":28,"default_branch":"master"}},"base":{"label":"MSOpenTech:master","ref":"master","sha":"0fbd37144de3adc2aef74db867c0e15e41c7f74a","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":22855240,"name":"azure-sdk-for-go","full_name":"MSOpenTech/azure-sdk-for-go","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/azure-sdk-for-go","description":"azure-sdk-for-go","fork":false,"url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go","forks_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/forks","keys_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/teams","hooks_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/hooks","issue_events_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/issues/events{/number}","events_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/events","assignees_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/assignees{/user}","branches_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/branches{/branch}","tags_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/tags","blobs_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/statuses/{sha}","languages_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/languages","stargazers_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/stargazers","contributors_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/contributors","subscribers_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/subscribers","subscription_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/subscription","commits_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/issues/comments/{number}","contents_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/contents/{+path}","compare_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/merges","archive_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/downloads","issues_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/issues{/number}","pulls_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls{/number}","milestones_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/milestones{/number}","notifications_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/labels{/name}","releases_url":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/releases{/id}","created_at":"2014-08-11T21:18:43Z","updated_at":"2015-02-10T11:34:32Z","pushed_at":"2015-02-09T23:23:37Z","git_url":"git://github.com/MSOpenTech/azure-sdk-for-go.git","ssh_url":"git@github.com:MSOpenTech/azure-sdk-for-go.git","clone_url":"https://github.com/MSOpenTech/azure-sdk-for-go.git","svn_url":"https://github.com/MSOpenTech/azure-sdk-for-go","homepage":null,"size":1333,"stargazers_count":28,"watchers_count":28,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":5,"forks":14,"open_issues":5,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/39"},"html":{"href":"https://github.com/MSOpenTech/azure-sdk-for-go/pull/39"},"issue":{"href":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/issues/39"},"comments":{"href":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/MSOpenTech/azure-sdk-for-go/statuses/467357135762f2d88b82495496d655b9a9c69394"}}}}