2018-07-19 14:43:13 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-10-03 17:21:54 -04:00
|
|
|
class ClusterEntity < Grape::Entity
|
|
|
|
include RequestAwareEntity
|
|
|
|
|
2020-04-30 17:09:47 -04:00
|
|
|
expose :cluster_type
|
|
|
|
expose :enabled
|
|
|
|
expose :environment_scope
|
2020-09-18 17:10:11 -04:00
|
|
|
expose :id
|
2020-09-29 14:09:52 -04:00
|
|
|
expose :namespace_per_environment
|
2020-04-30 17:09:47 -04:00
|
|
|
expose :name
|
2020-05-14 17:07:52 -04:00
|
|
|
expose :nodes
|
2020-06-10 14:09:15 -04:00
|
|
|
expose :provider_type
|
2017-10-04 16:13:10 -04:00
|
|
|
expose :status_name, as: :status
|
2017-10-03 17:21:54 -04:00
|
|
|
expose :status_reason
|
2020-05-14 17:07:52 -04:00
|
|
|
expose :applications, using: ClusterApplicationEntity
|
2020-04-30 17:09:47 -04:00
|
|
|
|
|
|
|
expose :path do |cluster|
|
|
|
|
Clusters::ClusterPresenter.new(cluster).show_path # rubocop: disable CodeReuse/Presenter
|
|
|
|
end
|
2020-07-14 11:09:05 -04:00
|
|
|
|
|
|
|
expose :gitlab_managed_apps_logs_path do |cluster|
|
|
|
|
Clusters::ClusterPresenter.new(cluster, current_user: request.current_user).gitlab_managed_apps_logs_path # rubocop: disable CodeReuse/Presenter
|
|
|
|
end
|
2020-08-05 17:09:40 -04:00
|
|
|
|
|
|
|
expose :kubernetes_errors do |cluster|
|
2022-02-28 04:15:16 -05:00
|
|
|
Clusters::KubernetesErrorEntity.new(cluster)
|
2020-08-05 17:09:40 -04:00
|
|
|
end
|
2020-08-26 14:11:43 -04:00
|
|
|
|
|
|
|
expose :enable_advanced_logs_querying do |cluster|
|
2021-05-13 23:10:11 -04:00
|
|
|
cluster.elastic_stack_available?
|
2020-08-26 14:11:43 -04:00
|
|
|
end
|
2017-10-03 17:21:54 -04:00
|
|
|
end
|