summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-01-07 18:56:09 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-01-07 18:56:09 +0000
commit2c66b942bde756554b22d8b54c586fe45f544b0e (patch)
treed475b010d6e6b25f30c8c3179a8b293a0be328fb /lib
parentdf48758c69e5927a45fb70293c18a2ec82995d6c (diff)
parente86eb09111d45787281251b80e0caab2e6c7de6f (diff)
downloadgitlab-ce-2c66b942bde756554b22d8b54c586fe45f544b0e.tar.gz
Merge branch '39957-redirect-to-gpc-page-if-users-try-to-create-a-cluster-but-the-account-is-not-enabled' into 'master'
Resolve "Redirect to GCP page if users try to create a cluster but the account is not enabled" Closes #39957 and #41410 See merge request gitlab-org/gitlab-ce!15665
Diffstat (limited to 'lib')
-rw-r--r--lib/google_api/cloud_platform/client.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb
index b0563fb2d69..f05d001fd02 100644
--- a/lib/google_api/cloud_platform/client.rb
+++ b/lib/google_api/cloud_platform/client.rb
@@ -1,4 +1,6 @@
require 'google/apis/container_v1'
+require 'google/apis/cloudbilling_v1'
+require 'google/apis/cloudresourcemanager_v1'
module GoogleApi
module CloudPlatform
@@ -40,6 +42,22 @@ 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_get_billing_info(project_name)
+ service = Google::Apis::CloudbillingV1::CloudbillingService.new
+ service.authorization = access_token
+
+ service.get_project_billing_info("projects/#{project_name}")
+ end
+
def projects_zones_clusters_get(project_id, zone, cluster_id)
service = Google::Apis::ContainerV1::ContainerService.new
service.authorization = access_token