Skip to content

Commit

Permalink
chore: update swagger docs
Browse files Browse the repository at this point in the history
  • Loading branch information
abc3 committed Aug 8, 2023
1 parent dde33aa commit b97d6d1
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 16 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.25
0.2.26
2 changes: 1 addition & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ alias Supavisor.Helpers, as: H

secret_key_base =
if config_env() in [:dev, :test] do
"dev_secret_key_base"
"3S1V5RyqQcuPrMVuR4BjH9XBayridj56JA0EE6wYidTEc6H84KSFY6urVX7GfOhK"
else
System.get_env("SECRET_KEY_BASE") ||
raise """
Expand Down
7 changes: 0 additions & 7 deletions lib/supavisor_web/controllers/page_controller.ex

This file was deleted.

12 changes: 12 additions & 0 deletions lib/supavisor_web/controllers/tenant_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ defmodule SupavisorWeb.TenantController do
send_resp(conn, code, "")
end

operation(:terminate,
summary: "Stop tenant's pools and clear cache",
parameters: [
external_id: [in: :path, description: "External id", type: :string],
authorization: @authorization
],
responses: %{
204 => Empty.response(),
404 => NotFound.response()
}
)

def terminate(conn, %{"external_id" => external_id}) do
Logger.metadata(project: external_id)

Expand Down
29 changes: 27 additions & 2 deletions lib/supavisor_web/open_api_schemas.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ defmodule SupavisorWeb.OpenApiSchemas do
db_password: %Schema{type: :string, description: "Database password"},
pool_size: %Schema{type: :integer, description: "Pool size"},
mode_type: %Schema{type: :string, description: "Pooling mode type"},
max_clients: %Schema{type: :integer, description: "Max clients count"},
pool_checkout_timeout: %Schema{type: :integer, description: "Pool checkout timeout"},
is_manager: %Schema{
type: :boolean,
description: "The users who can be used for internal needs"
Expand All @@ -41,6 +43,7 @@ defmodule SupavisorWeb.OpenApiSchemas do
db_password: "postgres",
pool_size: 10,
is_manager: false,
max_clients: 25000,
mode_type: "transaction",
inserted_at: "2023-03-27T12:00:00Z",
updated_at: "2023-03-27T12:00:00Z"
Expand All @@ -62,6 +65,13 @@ defmodule SupavisorWeb.OpenApiSchemas do
db_host: %Schema{type: :string, description: "Database host"},
db_port: %Schema{type: :integer, description: "Database port"},
db_database: %Schema{type: :string, description: "Database name"},
ip_version: %Schema{type: :string, description: "auto"},
require_user: %Schema{type: :boolean, description: false},
sni_hostname: %Schema{type: :string, description: "your.domain.com"},
upstream_ssl: %Schema{type: :boolean, description: true},
upstream_verify: %Schema{type: :string, description: "none"},
enforce_ssl: %Schema{type: :boolean, description: false},
auth_query: %Schema{type: :string, description: "SELECT rolname, rolpassword FROM pg_authid WHERE rolname=$1"},
users: %Schema{type: :array, items: User},
inserted_at: %Schema{type: :string, format: :date_time, readOnly: true},
updated_at: %Schema{type: :string, format: :date_time, readOnly: true}
Expand All @@ -88,6 +98,8 @@ defmodule SupavisorWeb.OpenApiSchemas do
db_user: "postgres",
db_password: "postgres",
pool_size: 10,
max_clients: 25000,
pool_checkout_timeout: 1000,
is_manager: false,
mode_type: "transaction",
inserted_at: "2023-03-27T12:00:00Z",
Expand Down Expand Up @@ -123,6 +135,13 @@ defmodule SupavisorWeb.OpenApiSchemas do
db_host: %Schema{type: :string, description: "Database host"},
db_port: %Schema{type: :integer, description: "Database port"},
db_database: %Schema{type: :string, description: "Database name"},
ip_version: %Schema{type: :string, description: "auto"},
require_user: %Schema{type: :boolean, description: false},
sni_hostname: %Schema{type: :string, description: "your.domain.com"},
upstream_ssl: %Schema{type: :boolean, description: true},
upstream_verify: %Schema{type: :string, description: "none"},
enforce_ssl: %Schema{type: :boolean, description: false},
auth_query: %Schema{type: :string, description: "SELECT rolname, rolpassword FROM pg_authid WHERE rolname=$1"},
users: %Schema{type: :array, items: User},
inserted_at: %Schema{type: :string, format: :date_time, readOnly: true},
updated_at: %Schema{type: :string, format: :date_time, readOnly: true}
Expand All @@ -131,18 +150,24 @@ defmodule SupavisorWeb.OpenApiSchemas do
:db_host,
:db_port,
:db_database,
:users
:users,
:require_user
],
example: %{
db_host: "localhost",
db_port: 5432,
db_database: "postgres",
ip_version: "auto",
enforce_ssl: false,
require_user: true,
users: [
%{
db_user: "postgres",
db_password: "postgres",
pool_size: 10,
mode_type: "transaction"
mode_type: "transaction",
max_clients: 25000,
pool_checkout_timeout: 1000
}
]
}
Expand Down
5 changes: 0 additions & 5 deletions lib/supavisor_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ defmodule SupavisorWeb.Router do
plug(OpenApiSpex.Plug.PutApiSpec, module: SupavisorWeb.ApiSpec)
end

scope "/", SupavisorWeb do
pipe_through(:browser)
get("/", PageController, :index)
end

scope "/swaggerui" do
pipe_through(:browser)
get("/", OpenApiSpex.Plug.SwaggerUI, path: "/api/openapi")
Expand Down

0 comments on commit b97d6d1

Please sign in to comment.