gitlab-org--gitlab-foss/app/services/list_gcp_projects_service.rb

13 lines
334 B
Ruby
Raw Normal View History

class ListGcpProjectsService
2017-12-15 19:44:36 -05:00
def execute(token)
client = GoogleApi::CloudPlatform::Client.new(token, nil)
# Lists only projects with billing enabled
client.projects_list.select do |project|
2018-01-10 09:23:22 -05:00
begin
client.projects_get_billing_info(project.project_id).billing_enabled
rescue
end
2017-12-15 19:44:36 -05:00
end
end
end