2018-12-06 13:08:49 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Projects
|
|
|
|
module Serverless
|
|
|
|
class ServiceEntity < Grape::Entity
|
|
|
|
include RequestAwareEntity
|
|
|
|
|
|
|
|
expose :name do |service|
|
|
|
|
service.dig('metadata', 'name')
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :namespace do |service|
|
|
|
|
service.dig('metadata', 'namespace')
|
|
|
|
end
|
|
|
|
|
2018-12-17 02:31:38 -05:00
|
|
|
expose :environment_scope do |service|
|
|
|
|
service.dig('environment_scope')
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :cluster_id do |service|
|
|
|
|
service.dig('cluster_id')
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :detail_url do |service|
|
|
|
|
project_serverless_path(
|
|
|
|
request.project,
|
|
|
|
service.dig('environment_scope'),
|
|
|
|
service.dig('metadata', 'name'))
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :podcount do |service|
|
|
|
|
service.dig('podcount')
|
|
|
|
end
|
|
|
|
|
2018-12-06 13:08:49 -05:00
|
|
|
expose :created_at do |service|
|
|
|
|
service.dig('metadata', 'creationTimestamp')
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :url do |service|
|
|
|
|
"http://#{service.dig('status', 'domain')}"
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :description do |service|
|
2018-12-17 02:31:38 -05:00
|
|
|
service.dig(
|
|
|
|
'spec',
|
|
|
|
'runLatest',
|
|
|
|
'configuration',
|
|
|
|
'revisionTemplate',
|
|
|
|
'metadata',
|
|
|
|
'annotations',
|
|
|
|
'Description')
|
2018-12-06 13:08:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
expose :image do |service|
|
2018-12-17 02:31:38 -05:00
|
|
|
service.dig(
|
|
|
|
'spec',
|
|
|
|
'runLatest',
|
|
|
|
'configuration',
|
|
|
|
'build',
|
|
|
|
'template',
|
|
|
|
'name')
|
2018-12-06 13:08:49 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|