summaryrefslogtreecommitdiff
path: root/lib/google_api
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-03-16 17:50:48 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-03-16 17:50:48 +0100
commit45b3bcc39631729ce573210ef6201c2cc59d7cdb (patch)
treef2ce89c40bcaa774b38bba923b848711725b049f /lib/google_api
parent78fb81e68676fb526e09cadac36045d9cf85e860 (diff)
downloadgitlab-ce-45b3bcc39631729ce573210ef6201c2cc59d7cdb.tar.gz
Add zones_list and machine_types_list to Google Cloud API client
Diffstat (limited to 'lib/google_api')
-rw-r--r--lib/google_api/cloud_platform/client.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb
index f30dd995695..f7a00974efc 100644
--- a/lib/google_api/cloud_platform/client.rb
+++ b/lib/google_api/cloud_platform/client.rb
@@ -1,3 +1,4 @@
+require 'google/apis/compute_v1'
require 'google/apis/container_v1'
require 'google/apis/cloudbilling_v1'
require 'google/apis/cloudresourcemanager_v1'
@@ -58,6 +59,24 @@ module GoogleApi
service.get_project_billing_info("projects/#{project_id}", options: user_agent_header)
end
+ def projects_zones_list(project_id)
+ service = Google::Apis::ComputeV1::ComputeService.new
+ service.authorization = access_token
+
+ service.fetch_all do |token|
+ service.list_zones(project_id, page_token: token, options: user_agent_header)
+ end
+ end
+
+ def projects_zones_machine_types_list(project_id, zone)
+ service = Google::Apis::ComputeV1::ComputeService.new
+ service.authorization = access_token
+
+ service.fetch_all do |token|
+ service.list_machine_types(project_id, zone, page_token: token, options: user_agent_header)
+ end
+ end
+
def projects_zones_clusters_get(project_id, zone, cluster_id)
service = Google::Apis::ContainerV1::ContainerService.new
service.authorization = access_token