Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-03-16 20:41:51 +0300
committerMatija Čupić <matteeyah@gmail.com>2018-03-16 20:42:30 +0300
commite911a0f896c3699c69b27509b1b38d173f96c81a (patch)
treee9714749d68aa100befdcd896a79ddc5fe20947c /app/controllers/projects/clusters
parent45b3bcc39631729ce573210ef6201c2cc59d7cdb (diff)
Expose CloudPlatform::Client#projects_list as GcpController#list_projects
Diffstat (limited to 'app/controllers/projects/clusters')
-rw-r--r--app/controllers/projects/clusters/gcp_controller.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/projects/clusters/gcp_controller.rb b/app/controllers/projects/clusters/gcp_controller.rb
index 6b0b22f8e73..7dfe819525f 100644
--- a/app/controllers/projects/clusters/gcp_controller.rb
+++ b/app/controllers/projects/clusters/gcp_controller.rb
@@ -1,6 +1,6 @@
class Projects::Clusters::GcpController < Projects::ApplicationController
before_action :authorize_read_cluster!
- before_action :authorize_google_api, except: [:login]
+ before_action :authorize_google_api, except: [:login, :list_projects]
before_action :authorize_google_project_billing, only: [:new, :create]
before_action :authorize_create_cluster!, only: [:new, :create]
before_action :verify_billing, only: [:create]
@@ -35,6 +35,13 @@ class Projects::Clusters::GcpController < Projects::ApplicationController
end
end
+ def list_projects
+ projects = GoogleApi::CloudPlatform::Client.new(token_in_session, nil).projects_list
+ respond_to do |format|
+ format.json { render status: :ok, json: { projects: projects } }
+ end
+ end
+
private
def verify_billing