summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-04-20 16:33:20 +0200
committerMatija Čupić <matteeyah@gmail.com>2018-04-20 16:33:20 +0200
commitcffc8899b75b018c0b2b619e25450c8e81507035 (patch)
tree0bf4182b1e20a2928fcb017aa848516ca35a20d4 /app
parentd1052289139c3be664908e0266c9389f7c797bd5 (diff)
downloadgitlab-ce-cffc8899b75b018c0b2b619e25450c8e81507035.tar.gz
Rename CheckGcpProjectBillingService to ListGcpProjectsService
Diffstat (limited to 'app')
-rw-r--r--app/services/list_gcp_projects_service.rb (renamed from app/services/check_gcp_project_billing_service.rb)3
-rw-r--r--app/workers/check_gcp_project_billing_worker.rb2
2 files changed, 3 insertions, 2 deletions
diff --git a/app/services/check_gcp_project_billing_service.rb b/app/services/list_gcp_projects_service.rb
index ea82b61b279..7f7b35fd48a 100644
--- a/app/services/check_gcp_project_billing_service.rb
+++ b/app/services/list_gcp_projects_service.rb
@@ -1,6 +1,7 @@
-class CheckGcpProjectBillingService
+class ListGcpProjectsService
def execute(token)
client = GoogleApi::CloudPlatform::Client.new(token, nil)
+ # Lists only projects with billing enabled
client.projects_list.select do |project|
begin
client.projects_get_billing_info(project.project_id).billing_enabled
diff --git a/app/workers/check_gcp_project_billing_worker.rb b/app/workers/check_gcp_project_billing_worker.rb
index 363f81590ab..dd35b2de50d 100644
--- a/app/workers/check_gcp_project_billing_worker.rb
+++ b/app/workers/check_gcp_project_billing_worker.rb
@@ -37,7 +37,7 @@ class CheckGcpProjectBillingWorker
return unless token
return unless try_obtain_lease_for(token)
- billing_enabled_state = !CheckGcpProjectBillingService.new.execute(token).empty?
+ billing_enabled_state = !ListGcpProjectsService.new.execute(token).empty?
update_billing_change_counter(self.class.get_billing_state(token), billing_enabled_state)
self.class.set_billing_state(token, billing_enabled_state)
end