-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sap systems and Databases openapi (#528)
* Added SAPSystem and Database OpenApi schemas * Added SAP Systems and Databases list operations to controller * Fixup openapi doc types
- Loading branch information
1 parent
3ddf506
commit af6ef62
Showing
7 changed files
with
215 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
defmodule TrentoWeb.OpenApi.Schema.Database do | ||
@moduledoc false | ||
|
||
require OpenApiSpex | ||
alias OpenApiSpex.Schema | ||
|
||
alias TrentoWeb.OpenApi.Schema.{ResourceHealth, Tags} | ||
|
||
defmodule DatabaseInstance do | ||
@moduledoc false | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "DatabaseInstance", | ||
description: "A discovered HANA Database Instance on the target infrastructure", | ||
type: :object, | ||
properties: %{ | ||
sap_system_id: %Schema{type: :string, description: "SAP System ID", format: :uuid}, | ||
sid: %Schema{type: :string, description: "SID"}, | ||
tenant: %Schema{type: :string, description: "Tenant"}, | ||
instance_number: %Schema{type: :string, description: "Instance Number"}, | ||
instance_hostname: %Schema{type: :string, description: "Instance Hostname"}, | ||
features: %Schema{type: :string, description: "Instance Features"}, | ||
http_port: %Schema{type: :integer, description: "Instance HTTP Port"}, | ||
https_port: %Schema{type: :integer, description: "Instance HTTPS Port"}, | ||
start_priority: %Schema{type: :string, description: "Instance Start Priority"}, | ||
host_id: %Schema{ | ||
type: :string, | ||
description: "Identifier of the host where current instance is running", | ||
format: :uuid | ||
}, | ||
system_replication: %Schema{type: :string, description: "System Replication"}, | ||
system_replication_status: %Schema{ | ||
type: :string, | ||
description: "System Replication Status" | ||
}, | ||
health: ResourceHealth | ||
} | ||
}) | ||
end | ||
|
||
defmodule DatabaseInstances do | ||
@moduledoc false | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "DatabaseInstances", | ||
description: | ||
"A list of DatabaseInstances, part of a complete SAP System, or only a HANA Database", | ||
type: :array, | ||
items: DatabaseInstance | ||
}) | ||
end | ||
|
||
defmodule DatabaseItem do | ||
@moduledoc false | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "Database", | ||
description: "A discovered HANA Database on the target infrastructure", | ||
type: :object, | ||
properties: %{ | ||
id: %Schema{type: :string, description: "Database ID", format: :uuid}, | ||
sid: %Schema{type: :string, description: "SID"}, | ||
health: ResourceHealth, | ||
database_instances: DatabaseInstances, | ||
tags: Tags | ||
} | ||
}) | ||
end | ||
|
||
defmodule DatabasesCollection do | ||
@moduledoc false | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "DatabasesCollection", | ||
description: "A list of the discovered HANA Databases", | ||
type: :array, | ||
items: DatabaseItem | ||
}) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule TrentoWeb.OpenApi.Schema.ResourceHealth do | ||
@moduledoc false | ||
|
||
require OpenApiSpex | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "ResourceHealth", | ||
type: :string, | ||
description: "Detected health of a Resource", | ||
enum: [:passing, :warning, :critical, :unknown] | ||
}) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
defmodule TrentoWeb.OpenApi.Schema.SAPSystem do | ||
@moduledoc false | ||
|
||
require OpenApiSpex | ||
alias OpenApiSpex.Schema | ||
|
||
alias TrentoWeb.OpenApi.Schema.{Database, ResourceHealth, Tags} | ||
|
||
defmodule ApplicationInstance do | ||
@moduledoc false | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "ApplicationInstance", | ||
description: "A discovered Application Instance on the target infrastructure", | ||
type: :object, | ||
properties: %{ | ||
sap_system_id: %Schema{type: :string, description: "SAP System ID", format: :uuid}, | ||
sid: %Schema{type: :string, description: "SID"}, | ||
instance_number: %Schema{type: :string, description: "Instance Number"}, | ||
instance_hostname: %Schema{type: :string, description: "Instance Hostname"}, | ||
features: %Schema{type: :string, description: "Instance Features"}, | ||
http_port: %Schema{type: :integer, description: "Instance HTTP Port"}, | ||
https_port: %Schema{type: :integer, description: "Instance HTTPS Port"}, | ||
start_priority: %Schema{type: :string, description: "Instance Start Priority"}, | ||
host_id: %Schema{ | ||
type: :string, | ||
description: "Identifier of the host where current instance is running", | ||
format: :uuid | ||
}, | ||
health: ResourceHealth | ||
} | ||
}) | ||
end | ||
|
||
defmodule SAPSystemItem do | ||
@moduledoc false | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "SAPSystem", | ||
description: "A discovered SAP System on the target infrastructure", | ||
type: :object, | ||
properties: %{ | ||
id: %Schema{type: :string, description: "SAP System ID", format: :uuid}, | ||
sid: %Schema{type: :string, description: "SID"}, | ||
tenant: %Schema{type: :string, description: "Tenant"}, | ||
db_host: %Schema{type: :string, description: "Address of the connected Database"}, | ||
health: ResourceHealth, | ||
application_instances: %Schema{ | ||
title: "ApplicationInstances", | ||
description: "A list of the discovered Application Instances for current SAP Systems", | ||
type: :array, | ||
items: ApplicationInstance | ||
}, | ||
database_instances: Database.DatabaseInstances, | ||
tags: Tags | ||
} | ||
}) | ||
end | ||
|
||
defmodule SAPSystemsCollection do | ||
@moduledoc false | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "SAPSystemsCollection", | ||
description: "A list of the discovered SAP Systems", | ||
type: :array, | ||
items: SAPSystemItem | ||
}) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
defmodule TrentoWeb.OpenApi.Schema.Tag do | ||
defmodule TrentoWeb.OpenApi.Schema.Tags do | ||
@moduledoc false | ||
|
||
require OpenApiSpex | ||
alias OpenApiSpex.Schema | ||
|
||
defmodule Tag do | ||
@moduledoc false | ||
|
||
require OpenApiSpex | ||
alias OpenApiSpex.Schema | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "Tag", | ||
description: "A tag attached to a resource", | ||
type: :object, | ||
properties: %{ | ||
id: %Schema{type: :integer}, | ||
resource_id: %Schema{type: :string, format: :uuid}, | ||
resource_type: %Schema{type: :string, enum: [:host, :cluster, :sap_system, :database]}, | ||
value: %Schema{type: :string} | ||
} | ||
}) | ||
end | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "Tag", | ||
description: "A tag attached to a resource", | ||
type: :object, | ||
properties: %{ | ||
id: %Schema{type: :integer}, | ||
resource_id: %Schema{type: :string, format: :uuid}, | ||
resource_type: %Schema{type: :string, enum: [:host, :cluster, :sap_system, :database]}, | ||
value: %Schema{type: :string} | ||
} | ||
title: "Tags", | ||
description: "A list of tags attached to a resource", | ||
type: :array, | ||
items: Tag | ||
}) | ||
end |