Skip to content

Commit

Permalink
Add SapSystems Health overview OpenApi spec (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonkopliku authored May 24, 2022
1 parent eb06e2b commit 3c23e92
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
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

0 comments on commit 3c23e92

Please sign in to comment.