summaryrefslogtreecommitdiff
path: root/lib/google_api
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2017-12-15 19:39:15 +0100
committerMatija Čupić <matteeyah@gmail.com>2017-12-15 19:39:15 +0100
commit596ea9e3688537131fb918c1e9177d085a938d19 (patch)
tree1ab28aa00ac00fe17c2e712f24326420c1894018 /lib/google_api
parent497a0cd62ca8dff2e7b91f3366b69f4f2b2fa826 (diff)
downloadgitlab-ce-596ea9e3688537131fb918c1e9177d085a938d19.tar.gz
Add Google Cloud client project list
Diffstat (limited to 'lib/google_api')
-rw-r--r--lib/google_api/cloud_platform/client.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb
index b0563fb2d69..f0dabcb1c5d 100644
--- a/lib/google_api/cloud_platform/client.rb
+++ b/lib/google_api/cloud_platform/client.rb
@@ -1,4 +1,5 @@
require 'google/apis/container_v1'
+require 'google/apis/cloudresourcemanager_v1'
module GoogleApi
module CloudPlatform
@@ -40,6 +41,15 @@ module GoogleApi
true
end
+ def projects_list
+ service = Google::Apis::CloudresourcemanagerV1::CloudResourceManagerService.new
+ service.authorization = access_token
+
+ service.fetch_all(items: :projects) do |token|
+ service.list_projects(page_token: token)
+ end
+ end
+
def projects_zones_clusters_get(project_id, zone, cluster_id)
service = Google::Apis::ContainerV1::ContainerService.new
service.authorization = access_token