2018-04-20 10:33:20 -04:00
|
|
|
class ListGcpProjectsService
|
2017-12-15 19:44:36 -05:00
|
|
|
def execute(token)
|
|
|
|
client = GoogleApi::CloudPlatform::Client.new(token, nil)
|
2018-04-20 10:33:20 -04:00
|
|
|
# Lists only projects with billing enabled
|
2018-01-04 18:35:19 -05:00
|
|
|
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
|