{"action":"created","comment":{"url":"https://api.github.com/repos/romana/core/pulls/comments/56918814","id":56918814,"diff_hunk":"@@ -0,0 +1,238 @@\n+// Copyright (c) 2016 Pani Networks\n+// All Rights Reserved.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n+// not use this file except in compliance with the License. You may obtain\n+// 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, WITHOUT\n+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+// License for the specific language governing permissions and limitations\n+// under the License.\n+\n+// Package openstack implements openstack API specific\n+// helper functions.\n+package openstack\n+\n+import (\n+\t\"log\"\n+\t\"os\"\n+\n+\t\"github.com/rackspace/gophercloud\"\n+\t\"github.com/rackspace/gophercloud/openstack\"\n+\t\"github.com/rackspace/gophercloud/openstack/identity/v2/tenants\"\n+\t\"github.com/rackspace/gophercloud/pagination\"\n+)\n+\n+var (\n+\tidentityClient *gophercloud.ServiceClient\n+\tnetworkClient  *gophercloud.ServiceClient\n+\tcomputeClient  *gophercloud.ServiceClient\n+)\n+\n+type ClientInterface interface {\n+}\n+\n+func getIdentityClient() (*gophercloud.ServiceClient, error) {\n+\tvar err error\n+\tif identityClient == nil {\n+\t\tidentityClient, err = initIdentityClient()\n+\t\tif err != nil {\n+\t\t\tlog.Println(\"Error: \", err)\n+\t\t\treturn nil, err\n+\t\t}\n+\t}\n+\treturn identityClient, nil\n+}\n+\n+func getComputeClient() (*gophercloud.ServiceClient, error) {\n+\tvar err error\n+\tif computeClient == nil {\n+\t\tcomputeClient, err = initComputeClient()\n+\t\tif err != nil {\n+\t\t\tlog.Println(\"Error: \", err)\n+\t\t\treturn nil, err\n+\t\t}\n+\t}\n+\treturn computeClient, nil\n+}\n+\n+func getNetworkClient() (*gophercloud.ServiceClient, error) {\n+\tvar err error\n+\tif networkClient == nil {\n+\t\tnetworkClient, err = initNetworkClient()\n+\t\tif err != nil {\n+\t\t\tlog.Println(\"Error: \", err)\n+\t\t\treturn nil, err\n+\t\t}\n+\t}\n+\treturn networkClient, nil\n+}\n+\n+// initIdentityClient initializes openstack api using\n+// gophercloud. Currently it uses enviornmental variables\n+// for authenticating with openstack identity.\n+func initIdentityClient() (*gophercloud.ServiceClient, error) {\n+\topts, err := openstack.AuthOptionsFromEnv()","path":"romana/openstack/tenant.go","position":79,"original_position":79,"commit_id":"0398c47cffba557925598b1fac40ad68a638623c","original_commit_id":"0398c47cffba557925598b1fac40ad68a638623c","user":{"login":"jbrendel","id":233741,"avatar_url":"https://avatars.githubusercontent.com/u/233741?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrendel","html_url":"https://github.com/jbrendel","followers_url":"https://api.github.com/users/jbrendel/followers","following_url":"https://api.github.com/users/jbrendel/following{/other_user}","gists_url":"https://api.github.com/users/jbrendel/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrendel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrendel/subscriptions","organizations_url":"https://api.github.com/users/jbrendel/orgs","repos_url":"https://api.github.com/users/jbrendel/repos","events_url":"https://api.github.com/users/jbrendel/events{/privacy}","received_events_url":"https://api.github.com/users/jbrendel/received_events","type":"User","site_admin":false},"body":"These three init... functions have most code in common. Seems like that could be re-factored.","created_at":"2016-03-22T00:04:52Z","updated_at":"2016-03-22T00:04:52Z","html_url":"https://github.com/romana/core/pull/56#discussion_r56918814","pull_request_url":"https://api.github.com/repos/romana/core/pulls/56","_links":{"self":{"href":"https://api.github.com/repos/romana/core/pulls/comments/56918814"},"html":{"href":"https://github.com/romana/core/pull/56#discussion_r56918814"},"pull_request":{"href":"https://api.github.com/repos/romana/core/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/romana/core/pulls/56","id":63601940,"html_url":"https://github.com/romana/core/pull/56","diff_url":"https://github.com/romana/core/pull/56.diff","patch_url":"https://github.com/romana/core/pull/56.patch","issue_url":"https://api.github.com/repos/romana/core/issues/56","number":56,"state":"open","locked":false,"title":"Initial version of romana command line tools.","user":{"login":"pritesh","id":9474171,"avatar_url":"https://avatars.githubusercontent.com/u/9474171?v=3","gravatar_id":"","url":"https://api.github.com/users/pritesh","html_url":"https://github.com/pritesh","followers_url":"https://api.github.com/users/pritesh/followers","following_url":"https://api.github.com/users/pritesh/following{/other_user}","gists_url":"https://api.github.com/users/pritesh/gists{/gist_id}","starred_url":"https://api.github.com/users/pritesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pritesh/subscriptions","organizations_url":"https://api.github.com/users/pritesh/orgs","repos_url":"https://api.github.com/users/pritesh/repos","events_url":"https://api.github.com/users/pritesh/events{/privacy}","received_events_url":"https://api.github.com/users/pritesh/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-21T17:32:18Z","updated_at":"2016-03-22T00:04:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f3058b084261148667cb053d877f91319c6da9b","assignee":{"login":"pritesh","id":9474171,"avatar_url":"https://avatars.githubusercontent.com/u/9474171?v=3","gravatar_id":"","url":"https://api.github.com/users/pritesh","html_url":"https://github.com/pritesh","followers_url":"https://api.github.com/users/pritesh/followers","following_url":"https://api.github.com/users/pritesh/following{/other_user}","gists_url":"https://api.github.com/users/pritesh/gists{/gist_id}","starred_url":"https://api.github.com/users/pritesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pritesh/subscriptions","organizations_url":"https://api.github.com/users/pritesh/orgs","repos_url":"https://api.github.com/users/pritesh/repos","events_url":"https://api.github.com/users/pritesh/events{/privacy}","received_events_url":"https://api.github.com/users/pritesh/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/romana/core/pulls/56/commits","review_comments_url":"https://api.github.com/repos/romana/core/pulls/56/comments","review_comment_url":"https://api.github.com/repos/romana/core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/romana/core/issues/56/comments","statuses_url":"https://api.github.com/repos/romana/core/statuses/0398c47cffba557925598b1fac40ad68a638623c","head":{"label":"romana:feature/command","ref":"feature/command","sha":"0398c47cffba557925598b1fac40ad68a638623c","user":{"login":"romana","id":9849297,"avatar_url":"https://avatars.githubusercontent.com/u/9849297?v=3","gravatar_id":"","url":"https://api.github.com/users/romana","html_url":"https://github.com/romana","followers_url":"https://api.github.com/users/romana/followers","following_url":"https://api.github.com/users/romana/following{/other_user}","gists_url":"https://api.github.com/users/romana/gists{/gist_id}","starred_url":"https://api.github.com/users/romana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romana/subscriptions","organizations_url":"https://api.github.com/users/romana/orgs","repos_url":"https://api.github.com/users/romana/repos","events_url":"https://api.github.com/users/romana/events{/privacy}","received_events_url":"https://api.github.com/users/romana/received_events","type":"Organization","site_admin":false},"repo":{"id":43855674,"name":"core","full_name":"romana/core","owner":{"login":"romana","id":9849297,"avatar_url":"https://avatars.githubusercontent.com/u/9849297?v=3","gravatar_id":"","url":"https://api.github.com/users/romana","html_url":"https://github.com/romana","followers_url":"https://api.github.com/users/romana/followers","following_url":"https://api.github.com/users/romana/following{/other_user}","gists_url":"https://api.github.com/users/romana/gists{/gist_id}","starred_url":"https://api.github.com/users/romana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romana/subscriptions","organizations_url":"https://api.github.com/users/romana/orgs","repos_url":"https://api.github.com/users/romana/repos","events_url":"https://api.github.com/users/romana/events{/privacy}","received_events_url":"https://api.github.com/users/romana/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/romana/core","description":"Romana core components - Micro services written in Go.","fork":false,"url":"https://api.github.com/repos/romana/core","forks_url":"https://api.github.com/repos/romana/core/forks","keys_url":"https://api.github.com/repos/romana/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/romana/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/romana/core/teams","hooks_url":"https://api.github.com/repos/romana/core/hooks","issue_events_url":"https://api.github.com/repos/romana/core/issues/events{/number}","events_url":"https://api.github.com/repos/romana/core/events","assignees_url":"https://api.github.com/repos/romana/core/assignees{/user}","branches_url":"https://api.github.com/repos/romana/core/branches{/branch}","tags_url":"https://api.github.com/repos/romana/core/tags","blobs_url":"https://api.github.com/repos/romana/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/romana/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/romana/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/romana/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/romana/core/statuses/{sha}","languages_url":"https://api.github.com/repos/romana/core/languages","stargazers_url":"https://api.github.com/repos/romana/core/stargazers","contributors_url":"https://api.github.com/repos/romana/core/contributors","subscribers_url":"https://api.github.com/repos/romana/core/subscribers","subscription_url":"https://api.github.com/repos/romana/core/subscription","commits_url":"https://api.github.com/repos/romana/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/romana/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/romana/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/romana/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/romana/core/contents/{+path}","compare_url":"https://api.github.com/repos/romana/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/romana/core/merges","archive_url":"https://api.github.com/repos/romana/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/romana/core/downloads","issues_url":"https://api.github.com/repos/romana/core/issues{/number}","pulls_url":"https://api.github.com/repos/romana/core/pulls{/number}","milestones_url":"https://api.github.com/repos/romana/core/milestones{/number}","notifications_url":"https://api.github.com/repos/romana/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/romana/core/labels{/name}","releases_url":"https://api.github.com/repos/romana/core/releases{/id}","deployments_url":"https://api.github.com/repos/romana/core/deployments","created_at":"2015-10-08T01:45:35Z","updated_at":"2016-03-17T01:42:32Z","pushed_at":"2016-03-21T23:48:50Z","git_url":"git://github.com/romana/core.git","ssh_url":"git@github.com:romana/core.git","clone_url":"https://github.com/romana/core.git","svn_url":"https://github.com/romana/core","homepage":"","size":374,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":4,"default_branch":"master"}},"base":{"label":"romana:master","ref":"master","sha":"210d8bd6bb47e69497c1a93e98b700d31ffaf4a8","user":{"login":"romana","id":9849297,"avatar_url":"https://avatars.githubusercontent.com/u/9849297?v=3","gravatar_id":"","url":"https://api.github.com/users/romana","html_url":"https://github.com/romana","followers_url":"https://api.github.com/users/romana/followers","following_url":"https://api.github.com/users/romana/following{/other_user}","gists_url":"https://api.github.com/users/romana/gists{/gist_id}","starred_url":"https://api.github.com/users/romana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romana/subscriptions","organizations_url":"https://api.github.com/users/romana/orgs","repos_url":"https://api.github.com/users/romana/repos","events_url":"https://api.github.com/users/romana/events{/privacy}","received_events_url":"https://api.github.com/users/romana/received_events","type":"Organization","site_admin":false},"repo":{"id":43855674,"name":"core","full_name":"romana/core","owner":{"login":"romana","id":9849297,"avatar_url":"https://avatars.githubusercontent.com/u/9849297?v=3","gravatar_id":"","url":"https://api.github.com/users/romana","html_url":"https://github.com/romana","followers_url":"https://api.github.com/users/romana/followers","following_url":"https://api.github.com/users/romana/following{/other_user}","gists_url":"https://api.github.com/users/romana/gists{/gist_id}","starred_url":"https://api.github.com/users/romana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romana/subscriptions","organizations_url":"https://api.github.com/users/romana/orgs","repos_url":"https://api.github.com/users/romana/repos","events_url":"https://api.github.com/users/romana/events{/privacy}","received_events_url":"https://api.github.com/users/romana/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/romana/core","description":"Romana core components - Micro services written in Go.","fork":false,"url":"https://api.github.com/repos/romana/core","forks_url":"https://api.github.com/repos/romana/core/forks","keys_url":"https://api.github.com/repos/romana/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/romana/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/romana/core/teams","hooks_url":"https://api.github.com/repos/romana/core/hooks","issue_events_url":"https://api.github.com/repos/romana/core/issues/events{/number}","events_url":"https://api.github.com/repos/romana/core/events","assignees_url":"https://api.github.com/repos/romana/core/assignees{/user}","branches_url":"https://api.github.com/repos/romana/core/branches{/branch}","tags_url":"https://api.github.com/repos/romana/core/tags","blobs_url":"https://api.github.com/repos/romana/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/romana/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/romana/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/romana/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/romana/core/statuses/{sha}","languages_url":"https://api.github.com/repos/romana/core/languages","stargazers_url":"https://api.github.com/repos/romana/core/stargazers","contributors_url":"https://api.github.com/repos/romana/core/contributors","subscribers_url":"https://api.github.com/repos/romana/core/subscribers","subscription_url":"https://api.github.com/repos/romana/core/subscription","commits_url":"https://api.github.com/repos/romana/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/romana/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/romana/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/romana/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/romana/core/contents/{+path}","compare_url":"https://api.github.com/repos/romana/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/romana/core/merges","archive_url":"https://api.github.com/repos/romana/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/romana/core/downloads","issues_url":"https://api.github.com/repos/romana/core/issues{/number}","pulls_url":"https://api.github.com/repos/romana/core/pulls{/number}","milestones_url":"https://api.github.com/repos/romana/core/milestones{/number}","notifications_url":"https://api.github.com/repos/romana/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/romana/core/labels{/name}","releases_url":"https://api.github.com/repos/romana/core/releases{/id}","deployments_url":"https://api.github.com/repos/romana/core/deployments","created_at":"2015-10-08T01:45:35Z","updated_at":"2016-03-17T01:42:32Z","pushed_at":"2016-03-21T23:48:50Z","git_url":"git://github.com/romana/core.git","ssh_url":"git@github.com:romana/core.git","clone_url":"https://github.com/romana/core.git","svn_url":"https://github.com/romana/core","homepage":"","size":374,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/romana/core/pulls/56"},"html":{"href":"https://github.com/romana/core/pull/56"},"issue":{"href":"https://api.github.com/repos/romana/core/issues/56"},"comments":{"href":"https://api.github.com/repos/romana/core/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/romana/core/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/romana/core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/romana/core/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/romana/core/statuses/0398c47cffba557925598b1fac40ad68a638623c"}}}}