Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SapSystems Health overview OpenApi spec #579

Merged
merged 1 commit into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/trento_web/controllers/health_overview_controller.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
defmodule TrentoWeb.HealthOverviewController do
use TrentoWeb, :controller

alias TrentoWeb.OpenApi.Schema

alias Trento.SapSystems.HealthSummaryService
use OpenApiSpex.ControllerSpecs

operation(:overview,
summary: "Health overview of the disovered SAP Systems",
tags: ["Landscape"],
description:
"Provide an aggregated overview of the health of the discovered SAP Systems (and their components) on the target infrastructure",
responses: [
ok:
{"An overview of the health of the disovered SAP Systems and their components",
"application/json", Schema.SAPSystem.HealthOverview}
]
)

@spec overview(Plug.Conn.t(), any) :: Plug.Conn.t()
def overview(conn, _) do
summary = HealthSummaryService.get_health_summary()

Expand Down
29 changes: 29 additions & 0 deletions lib/trento_web/openapi/schema/sap_system.ex
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,33 @@ defmodule TrentoWeb.OpenApi.Schema.SAPSystem do
items: SAPSystemItem
})
end

defmodule SAPSystemHealthOverview do
@moduledoc false

OpenApiSpex.schema(%{
title: "SAPSystemHealthOverview",
description: "An overview of the health of a discovered SAP System and its components",
type: :object,
properties: %{
id: %Schema{type: :string, description: "SAP System ID", format: :uuid},
sid: %Schema{type: :string, description: "SID"},
sapsystem_health: ResourceHealth,
database_health: ResourceHealth,
hosts_health: ResourceHealth,
clusters_health: ResourceHealth
}
})
end

defmodule HealthOverview do
@moduledoc false

OpenApiSpex.schema(%{
title: "HealthOverview",
description: "A list of health summaries for the discovered SAP Systems",
type: :array,
items: SAPSystemHealthOverview
})
end
end