diff --git a/packages/sshecret-frontend/openapi.json b/packages/sshecret-frontend/openapi.json index fbd1f26..eba5015 100644 --- a/packages/sshecret-frontend/openapi.json +++ b/packages/sshecret-frontend/openapi.json @@ -1 +1 @@ -{"openapi": "3.1.0", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": {"/health": {"get": {"summary": "Get Health", "description": "Provide simple health check.", "operationId": "get_health_health_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/api/v1/audit/": {"get": {"summary": "Get Audit Log", "description": "Query audit log.", "operationId": "get_audit_log_api_v1_audit__get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "subsystem", "in": "query", "required": false, "schema": {"anyOf": [{"$ref": "#/components/schemas/SubSystem"}, {"type": "null"}], "title": "Subsystem"}}, {"name": "operation", "in": "query", "required": false, "schema": {"anyOf": [{"$ref": "#/components/schemas/Operation"}, {"type": "null"}], "title": "Operation"}}, {"name": "client_id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Id"}}, {"name": "client_name", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Name"}}, {"name": "secret_id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret Id"}}, {"name": "secret_name", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret Name"}}, {"name": "origin", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Origin"}}, {"name": "offset", "in": "query", "required": false, "schema": {"type": "integer", "default": 0, "title": "Offset"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "default": 100, "title": "Limit"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AuditListResult"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/token": {"post": {"summary": "Login For Access Token", "description": "Login user and generate token.", "operationId": "login_for_access_token_api_v1_token_post", "requestBody": {"content": {"application/x-www-form-urlencoded": {"schema": {"$ref": "#/components/schemas/Body_login_for_access_token_api_v1_token_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Token"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/refresh": {"post": {"summary": "Refresh Token", "description": "Refresh access token.", "operationId": "refresh_token_api_v1_refresh_post", "requestBody": {"content": {"application/x-www-form-urlencoded": {"schema": {"$ref": "#/components/schemas/RefreshTokenForm"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Token"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/clients/": {"get": {"summary": "Get Clients", "description": "Get clients.", "operationId": "get_clients_api_v1_clients__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/Client"}, "type": "array", "title": "Response Get Clients Api V1 Clients Get"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}, "post": {"summary": "Create Client", "description": "Create a new client.", "operationId": "create_client_api_v1_clients__post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientCreate"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Client"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/v1/clients/terse/": {"get": {"summary": "Get Clients Terse", "description": "Get a list of client ids and names.", "operationId": "get_clients_terse_api_v1_clients_terse__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/ClientReference"}, "type": "array", "title": "Response Get Clients Terse Api V1 Clients Terse Get"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/v1/query/clients/": {"get": {"summary": "Query Clients", "description": "Query clients.", "operationId": "query_clients_api_v1_query_clients__get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "exclusiveMinimum": 0, "default": 100, "title": "Limit"}}, {"name": "offset", "in": "query", "required": false, "schema": {"type": "integer", "minimum": 0, "default": 0, "title": "Offset"}}, {"name": "id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "format": "uuid"}, {"type": "null"}], "title": "Id"}}, {"name": "name", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Name"}}, {"name": "name__like", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Name Like"}}, {"name": "name__contains", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Name Contains"}}, {"name": "order_by", "in": "query", "required": false, "schema": {"type": "string", "default": "created_at", "title": "Order By"}}, {"name": "order_reverse", "in": "query", "required": false, "schema": {"type": "boolean", "default": true, "title": "Order Reverse"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientQueryResult"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/clients/{id}": {"get": {"summary": "Get Client", "description": "Get a client.", "operationId": "get_client_api_v1_clients__id__get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Client"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"summary": "Update Client", "description": "Update a client.", "operationId": "update_client_api_v1_clients__id__put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientCreate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Client"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"summary": "Delete Client", "description": "Delete a client.", "operationId": "delete_client_api_v1_clients__id__delete", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/clients/{id}/secrets/{secret_name}": {"delete": {"summary": "Delete Secret From Client", "description": "Delete a secret from a client.", "operationId": "delete_secret_from_client_api_v1_clients__id__secrets__secret_name__delete", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}, {"name": "secret_name", "in": "path", "required": true, "schema": {"type": "string", "title": "Secret Name"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"summary": "Add Secret To Client", "description": "Add secret to a client.", "operationId": "add_secret_to_client_api_v1_clients__id__secrets__secret_name__put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}, {"name": "secret_name", "in": "path", "required": true, "schema": {"type": "string", "title": "Secret Name"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/clients/{id}/policies": {"put": {"summary": "Update Client Policies", "description": "Update the client access policies.", "operationId": "update_client_policies_api_v1_clients__id__policies_put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Id"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UpdatePoliciesRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Client"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/clients/{id}/public-key": {"put": {"summary": "Update Client Public Key", "description": "Update client public key.\n\nUpdating the public key will invalidate the current secrets, so these well\nbe resolved first, and re-encrypted using the new key.", "operationId": "update_client_public_key_api_v1_clients__id__public_key_put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UpdateKeyModel"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UpdateKeyResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/secrets/": {"get": {"summary": "Get Secret Names", "description": "Get Secret Names.", "operationId": "get_secret_names_api_v1_secrets__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/SecretListView"}, "type": "array", "title": "Response Get Secret Names Api V1 Secrets Get"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}, "post": {"summary": "Add Secret", "description": "Create a secret.", "operationId": "add_secret_api_v1_secrets__post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretCreate"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/v1/secrets/{name}": {"get": {"summary": "Get Secret", "description": "Get a secret.", "operationId": "get_secret_api_v1_secrets__name__get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "name", "in": "path", "required": true, "schema": {"type": "string", "title": "Name"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretView"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"summary": "Update Secret", "operationId": "update_secret_api_v1_secrets__name__put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "name", "in": "path", "required": true, "schema": {"type": "string", "title": "Name"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretUpdate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"summary": "Delete Secret", "description": "Delete secret.", "operationId": "delete_secret_api_v1_secrets__name__delete", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "name", "in": "path", "required": true, "schema": {"type": "string", "title": "Name"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/secrets/groups/": {"get": {"summary": "Get Secret Groups", "description": "Get secret groups.", "operationId": "get_secret_groups_api_v1_secrets_groups__get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "filter_regex", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Filter Regex"}}, {"name": "flat", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Flat"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientSecretGroupList"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "post": {"summary": "Add Secret Group", "description": "Create a secret grouping.", "operationId": "add_secret_group_api_v1_secrets_groups__post", "security": [{"OAuth2PasswordBearer": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretGroupCreate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientSecretGroup"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/secrets/groups/{group_path}/": {"get": {"summary": "Get Secret Group", "description": "Get a specific secret group.", "operationId": "get_secret_group_api_v1_secrets_groups__group_path___get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "group_path", "in": "path", "required": true, "schema": {"type": "string", "title": "Group Path"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientSecretGroup"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"summary": "Update Secret Group", "description": "Update a secret group.", "operationId": "update_secret_group_api_v1_secrets_groups__group_path___put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "group_path", "in": "path", "required": true, "schema": {"type": "string", "title": "Group Path"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretGroupUdate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientSecretGroup"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"summary": "Delete Secret Group", "description": "Remove a group.\n\nEntries within the group will be moved to the root.\nThis also includes nested entries further down from the group.", "operationId": "delete_secret_group_api_v1_secrets_groups__group_path___delete", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "group_path", "in": "path", "required": true, "schema": {"type": "string", "title": "Group Path"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/secrets/group/{id}": {"delete": {"summary": "Delete Group Id", "description": "Remove a group by ID.", "operationId": "delete_group_id_api_v1_secrets_group__id__delete", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/secrets/set-group": {"post": {"summary": "Assign Secret Group", "description": "Assign a secret to a group or root.", "operationId": "assign_secret_group_api_v1_secrets_set_group_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretGroupAssign"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/v1/secrets/move-group/{group_name}": {"post": {"summary": "Move Group", "description": "Move a group.", "operationId": "move_group_api_v1_secrets_move_group__group_name__post", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "group_name", "in": "path", "required": true, "schema": {"type": "string", "title": "Group Name"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/GroupPath"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}}, "components": {"schemas": {"AuditListResult": {"properties": {"results": {"items": {"$ref": "#/components/schemas/AuditLog"}, "type": "array", "title": "Results"}, "total": {"type": "integer", "title": "Total"}, "remaining": {"type": "integer", "title": "Remaining"}}, "type": "object", "required": ["results", "total", "remaining"], "title": "AuditListResult", "description": "Class to return when listing audit entries."}, "AuditLog": {"properties": {"id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Id"}, "subsystem": {"$ref": "#/components/schemas/SubSystem"}, "operation": {"$ref": "#/components/schemas/Operation"}, "client_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Id"}, "client_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Name"}, "secret_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret Id"}, "secret_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret Name"}, "data": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"type": "null"}], "title": "Data"}, "message": {"type": "string", "title": "Message"}, "origin": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Origin"}, "timestamp": {"anyOf": [{"type": "string", "format": "date-time"}, {"type": "null"}], "title": "Timestamp"}}, "type": "object", "required": ["subsystem", "operation", "message"], "title": "AuditLog", "description": "Implementation of the backend class AuditView."}, "AutoGenerateOpts": {"properties": {"auto_generate": {"type": "boolean", "const": true, "title": "Auto Generate"}, "length": {"type": "integer", "title": "Length", "default": 32}}, "type": "object", "required": ["auto_generate"], "title": "AutoGenerateOpts", "description": "Option to auto-generate a password."}, "Body_login_for_access_token_api_v1_token_post": {"properties": {"grant_type": {"anyOf": [{"type": "string", "pattern": "^password$"}, {"type": "null"}], "title": "Grant Type"}, "username": {"type": "string", "title": "Username"}, "password": {"type": "string", "format": "password", "title": "Password"}, "scope": {"type": "string", "title": "Scope", "default": ""}, "client_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Id"}, "client_secret": {"anyOf": [{"type": "string"}, {"type": "null"}], "format": "password", "title": "Client Secret"}}, "type": "object", "required": ["username", "password"], "title": "Body_login_for_access_token_api_v1_token_post"}, "Client": {"properties": {"id": {"type": "string", "format": "uuid", "title": "Id"}, "name": {"type": "string", "title": "Name"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "public_key": {"type": "string", "title": "Public Key"}, "version": {"type": "integer", "title": "Version"}, "is_active": {"type": "boolean", "title": "Is Active"}, "is_deleted": {"type": "boolean", "title": "Is Deleted"}, "secrets": {"items": {"type": "string"}, "type": "array", "title": "Secrets"}, "policies": {"items": {"anyOf": [{"type": "string", "format": "ipvanynetwork"}, {"type": "string", "format": "ipvanyaddress"}]}, "type": "array", "title": "Policies"}, "created_at": {"type": "string", "format": "date-time", "title": "Created At"}, "updated_at": {"anyOf": [{"type": "string", "format": "date-time"}, {"type": "null"}], "title": "Updated At"}, "deleted_at": {"anyOf": [{"type": "string", "format": "date-time"}, {"type": "null"}], "title": "Deleted At"}}, "type": "object", "required": ["id", "name", "description", "public_key", "version", "is_active", "is_deleted", "secrets", "policies", "created_at", "updated_at", "deleted_at"], "title": "Client", "description": "Implementation of the backend class ClientView."}, "ClientCreate": {"properties": {"name": {"type": "string", "title": "Name"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "public_key": {"type": "string", "title": "Public Key"}, "sources": {"items": {"anyOf": [{"type": "string", "format": "ipvanyaddress"}, {"type": "string", "format": "ipvanynetwork"}]}, "type": "array", "title": "Sources"}}, "type": "object", "required": ["name", "public_key"], "title": "ClientCreate", "description": "Model to create a client."}, "ClientQueryResult": {"properties": {"clients": {"items": {"$ref": "#/components/schemas/Client"}, "type": "array", "title": "Clients"}, "total_results": {"type": "integer", "title": "Total Results"}, "remaining_results": {"type": "integer", "title": "Remaining Results"}}, "type": "object", "required": ["clients", "total_results", "remaining_results"], "title": "ClientQueryResult", "description": "Implementation of the backend ClientQueryResult class."}, "ClientReference": {"properties": {"id": {"type": "string", "title": "Id"}, "name": {"type": "string", "title": "Name"}}, "type": "object", "required": ["id", "name"], "title": "ClientReference", "description": "Implementation of the backend class ClientReference."}, "ClientSecretGroup": {"properties": {"id": {"type": "string", "format": "uuid", "title": "Id"}, "group_name": {"type": "string", "title": "Group Name"}, "path": {"type": "string", "title": "Path"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "parent_group": {"anyOf": [{"$ref": "#/components/schemas/GroupReference"}, {"type": "null"}]}, "children": {"items": {"$ref": "#/components/schemas/ClientSecretGroup"}, "type": "array", "title": "Children"}, "entries": {"items": {"$ref": "#/components/schemas/SecretClientMapping"}, "type": "array", "title": "Entries"}}, "type": "object", "required": ["id", "group_name", "path"], "title": "ClientSecretGroup", "description": "Client secrets grouped."}, "ClientSecretGroupList": {"properties": {"ungrouped": {"items": {"$ref": "#/components/schemas/SecretClientMapping"}, "type": "array", "title": "Ungrouped"}, "groups": {"items": {"$ref": "#/components/schemas/ClientSecretGroup"}, "type": "array", "title": "Groups"}}, "type": "object", "title": "ClientSecretGroupList", "description": "Secret group list."}, "GroupPath": {"properties": {"path": {"type": "string", "pattern": "^/.*", "title": "Path"}}, "type": "object", "required": ["path"], "title": "GroupPath", "description": "Path to a group."}, "GroupReference": {"properties": {"group_name": {"type": "string", "title": "Group Name"}, "path": {"type": "string", "title": "Path"}}, "type": "object", "required": ["group_name", "path"], "title": "GroupReference", "description": "Reference to a group.\n\nThis will be used for references to parent groups to avoid circular\nreferences."}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "Operation": {"type": "string", "enum": ["create", "read", "update", "delete", "deny", "permit", "login", "none"], "title": "Operation", "description": "Various operations for the audit logging module."}, "RefreshTokenForm": {"properties": {"grant_type": {"type": "string", "const": "refresh_token", "title": "Grant Type"}, "refresh_token": {"type": "string", "title": "Refresh Token"}}, "type": "object", "required": ["grant_type", "refresh_token"], "title": "RefreshTokenForm", "description": "The refresh token form data."}, "SecretClientMapping": {"properties": {"name": {"type": "string", "title": "Name"}, "unmanaged": {"type": "boolean", "title": "Unmanaged", "default": false}, "clients": {"items": {"$ref": "#/components/schemas/ClientReference"}, "type": "array", "title": "Clients"}}, "type": "object", "required": ["name"], "title": "SecretClientMapping", "description": "Secret name with list of clients."}, "SecretCreate": {"properties": {"value": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/AutoGenerateOpts"}], "title": "Value", "description": "Secret as string value or auto-generated with optional length", "examples": ["MySecretString", {"auto_generate": true, "length": 32}]}, "name": {"type": "string", "title": "Name"}, "clients": {"anyOf": [{"items": {"type": "string"}, "type": "array"}, {"type": "null"}], "title": "Clients", "description": "Assign the secret to a list of clients."}, "client_distinguisher": {"type": "string", "enum": ["id", "name"], "title": "Client Distinguisher", "default": "name"}, "group": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Group"}}, "type": "object", "required": ["value", "name"], "title": "SecretCreate", "description": "Model to create a secret.", "examples": [{"clients": ["client-1", "client-2"], "name": "MySecret", "value": {"auto_generate": true, "length": 32}}, {"group": "MySecretGroup", "name": "MySecret", "value": "mysecretstring"}]}, "SecretGroupAssign": {"properties": {"secret_name": {"type": "string", "title": "Secret Name"}, "group_path": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Group Path"}}, "type": "object", "required": ["secret_name", "group_path"], "title": "SecretGroupAssign", "description": "Model for assigning secrets to a group.\n\nIf group is None, then it will be placed in the root."}, "SecretGroupCreate": {"properties": {"name": {"type": "string", "minLength": 1, "title": "Name"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "parent_group": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Parent Group"}}, "type": "object", "required": ["name"], "title": "SecretGroupCreate", "description": "Create model for creating secret groups."}, "SecretGroupUdate": {"properties": {"name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Name"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "parent_group": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Parent Group"}}, "type": "object", "title": "SecretGroupUdate", "description": "Update model for updating secret groups."}, "SecretListView": {"properties": {"name": {"type": "string", "title": "Name"}, "unmanaged": {"type": "boolean", "title": "Unmanaged", "default": false}, "clients": {"items": {"type": "string"}, "type": "array", "title": "Clients"}}, "type": "object", "required": ["name"], "title": "SecretListView", "description": "Model containing a list of all available secrets."}, "SecretUpdate": {"properties": {"value": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/AutoGenerateOpts"}], "title": "Value", "description": "Secret as string value or auto-generated with optional length", "examples": ["MySecretString", {"auto_generate": true, "length": 32}]}}, "type": "object", "required": ["value"], "title": "SecretUpdate", "description": "Model to update a secret."}, "SecretView": {"properties": {"name": {"type": "string", "title": "Name"}, "secret": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret"}, "group": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Group"}, "clients": {"items": {"$ref": "#/components/schemas/ClientReference"}, "type": "array", "title": "Clients"}}, "type": "object", "required": ["name", "secret"], "title": "SecretView", "description": "Model containing a secret, including its clear-text value."}, "SubSystem": {"type": "string", "enum": ["admin", "sshd", "backend"], "title": "SubSystem", "description": "Available subsystems."}, "Token": {"properties": {"access_token": {"type": "string", "title": "Access Token"}, "refresh_token": {"type": "string", "title": "Refresh Token"}, "token_type": {"type": "string", "title": "Token Type"}}, "type": "object", "required": ["access_token", "refresh_token", "token_type"], "title": "Token"}, "UpdateKeyModel": {"properties": {"public_key": {"type": "string", "title": "Public Key"}}, "type": "object", "required": ["public_key"], "title": "UpdateKeyModel", "description": "Model for updating client public key."}, "UpdateKeyResponse": {"properties": {"public_key": {"type": "string", "title": "Public Key"}, "updated_secrets": {"items": {"type": "string"}, "type": "array", "title": "Updated Secrets"}, "detail": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Detail"}}, "type": "object", "required": ["public_key"], "title": "UpdateKeyResponse", "description": "Response model after updating the public key."}, "UpdatePoliciesRequest": {"properties": {"sources": {"items": {"anyOf": [{"type": "string", "format": "ipvanyaddress"}, {"type": "string", "format": "ipvanynetwork"}]}, "type": "array", "title": "Sources"}}, "type": "object", "required": ["sources"], "title": "UpdatePoliciesRequest", "description": "Update policy request."}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}}, "securitySchemes": {"OAuth2PasswordBearer": {"type": "oauth2", "flows": {"password": {"refreshUrl": "/api/v1/refresh", "scopes": {}, "tokenUrl": "/api/v1/token"}}}}}} \ No newline at end of file +{"openapi": "3.1.0", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": {"/health": {"get": {"summary": "Get Health", "description": "Provide simple health check.", "operationId": "get_health_health_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/api/v1/audit/": {"get": {"summary": "Get Audit Log", "description": "Query audit log.", "operationId": "get_audit_log_api_v1_audit__get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "subsystem", "in": "query", "required": false, "schema": {"anyOf": [{"$ref": "#/components/schemas/SubSystem"}, {"type": "null"}], "title": "Subsystem"}}, {"name": "operation", "in": "query", "required": false, "schema": {"anyOf": [{"$ref": "#/components/schemas/Operation"}, {"type": "null"}], "title": "Operation"}}, {"name": "client_id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Id"}}, {"name": "client_name", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Name"}}, {"name": "secret_id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret Id"}}, {"name": "secret_name", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret Name"}}, {"name": "origin", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Origin"}}, {"name": "offset", "in": "query", "required": false, "schema": {"type": "integer", "default": 0, "title": "Offset"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "default": 100, "title": "Limit"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AuditListResult"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/token": {"post": {"summary": "Login For Access Token", "description": "Login user and generate token.", "operationId": "login_for_access_token_api_v1_token_post", "requestBody": {"content": {"application/x-www-form-urlencoded": {"schema": {"$ref": "#/components/schemas/Body_login_for_access_token_api_v1_token_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Token"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/refresh": {"post": {"summary": "Refresh Token", "description": "Refresh access token.", "operationId": "refresh_token_api_v1_refresh_post", "requestBody": {"content": {"application/x-www-form-urlencoded": {"schema": {"$ref": "#/components/schemas/RefreshTokenForm"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Token"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/clients/": {"get": {"summary": "Get Clients", "description": "Get clients.", "operationId": "get_clients_api_v1_clients__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/Client"}, "type": "array", "title": "Response Get Clients Api V1 Clients Get"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}, "post": {"summary": "Create Client", "description": "Create a new client.", "operationId": "create_client_api_v1_clients__post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientCreate"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Client"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/v1/clients/terse/": {"get": {"summary": "Get Clients Terse", "description": "Get a list of client ids and names.", "operationId": "get_clients_terse_api_v1_clients_terse__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/ClientReference"}, "type": "array", "title": "Response Get Clients Terse Api V1 Clients Terse Get"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/v1/query/clients/": {"get": {"summary": "Query Clients", "description": "Query clients.", "operationId": "query_clients_api_v1_query_clients__get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "exclusiveMinimum": 0, "default": 100, "title": "Limit"}}, {"name": "offset", "in": "query", "required": false, "schema": {"type": "integer", "minimum": 0, "default": 0, "title": "Offset"}}, {"name": "id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "format": "uuid"}, {"type": "null"}], "title": "Id"}}, {"name": "name", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Name"}}, {"name": "name__like", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Name Like"}}, {"name": "name__contains", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Name Contains"}}, {"name": "order_by", "in": "query", "required": false, "schema": {"type": "string", "default": "created_at", "title": "Order By"}}, {"name": "order_reverse", "in": "query", "required": false, "schema": {"type": "boolean", "default": true, "title": "Order Reverse"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientQueryResult"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/clients/{id}": {"get": {"summary": "Get Client", "description": "Get a client.", "operationId": "get_client_api_v1_clients__id__get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Client"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"summary": "Update Client", "description": "Update a client.", "operationId": "update_client_api_v1_clients__id__put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientCreate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Client"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"summary": "Delete Client", "description": "Delete a client.", "operationId": "delete_client_api_v1_clients__id__delete", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/clients/{id}/secrets/{secret_name}": {"delete": {"summary": "Delete Secret From Client", "description": "Delete a secret from a client.", "operationId": "delete_secret_from_client_api_v1_clients__id__secrets__secret_name__delete", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}, {"name": "secret_name", "in": "path", "required": true, "schema": {"type": "string", "title": "Secret Name"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"summary": "Add Secret To Client", "description": "Add secret to a client.", "operationId": "add_secret_to_client_api_v1_clients__id__secrets__secret_name__put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}, {"name": "secret_name", "in": "path", "required": true, "schema": {"type": "string", "title": "Secret Name"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/clients/{id}/policies": {"put": {"summary": "Update Client Policies", "description": "Update the client access policies.", "operationId": "update_client_policies_api_v1_clients__id__policies_put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Id"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UpdatePoliciesRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Client"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/clients/{id}/public-key": {"put": {"summary": "Update Client Public Key", "description": "Update client public key.\n\nUpdating the public key will invalidate the current secrets, so these well\nbe resolved first, and re-encrypted using the new key.", "operationId": "update_client_public_key_api_v1_clients__id__public_key_put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Client identifier", "description": "Identifier of path, may include the prefix 'id:' or 'name:'", "examples": ["name:myclient", "id:8eab15a4-a8eb-4d1b-b47f-2283b9f6f6b0"]}, "description": "Identifier of path, may include the prefix 'id:' or 'name:'"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UpdateKeyModel"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UpdateKeyResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/stats": {"get": {"summary": "Get System Stats", "description": "Get system stats.", "operationId": "get_system_stats_api_v1_stats_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SystemStats"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/v1/secrets/": {"get": {"summary": "Get Secret Names", "description": "Get Secret Names.", "operationId": "get_secret_names_api_v1_secrets__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/SecretListView"}, "type": "array", "title": "Response Get Secret Names Api V1 Secrets Get"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}, "post": {"summary": "Add Secret", "description": "Create a secret.", "operationId": "add_secret_api_v1_secrets__post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretCreate"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/v1/secrets/{name}": {"get": {"summary": "Get Secret", "description": "Get a secret.", "operationId": "get_secret_api_v1_secrets__name__get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "name", "in": "path", "required": true, "schema": {"type": "string", "title": "Name"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretView"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"summary": "Update Secret", "operationId": "update_secret_api_v1_secrets__name__put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "name", "in": "path", "required": true, "schema": {"type": "string", "title": "Name"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretUpdate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"summary": "Delete Secret", "description": "Delete secret.", "operationId": "delete_secret_api_v1_secrets__name__delete", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "name", "in": "path", "required": true, "schema": {"type": "string", "title": "Name"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/secrets/groups/": {"get": {"summary": "Get Secret Groups", "description": "Get secret groups.", "operationId": "get_secret_groups_api_v1_secrets_groups__get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "filter_regex", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Filter Regex"}}, {"name": "flat", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Flat"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientSecretGroupList"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "post": {"summary": "Add Secret Group", "description": "Create a secret grouping.", "operationId": "add_secret_group_api_v1_secrets_groups__post", "security": [{"OAuth2PasswordBearer": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretGroupCreate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientSecretGroup"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/secrets/groups/{group_path}/": {"get": {"summary": "Get Secret Group", "description": "Get a specific secret group.", "operationId": "get_secret_group_api_v1_secrets_groups__group_path___get", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "group_path", "in": "path", "required": true, "schema": {"type": "string", "title": "Group Path"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientSecretGroup"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"summary": "Update Secret Group", "description": "Update a secret group.", "operationId": "update_secret_group_api_v1_secrets_groups__group_path___put", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "group_path", "in": "path", "required": true, "schema": {"type": "string", "title": "Group Path"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretGroupUdate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ClientSecretGroup"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"summary": "Delete Secret Group", "description": "Remove a group.\n\nEntries within the group will be moved to the root.\nThis also includes nested entries further down from the group.", "operationId": "delete_secret_group_api_v1_secrets_groups__group_path___delete", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "group_path", "in": "path", "required": true, "schema": {"type": "string", "title": "Group Path"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/secrets/group/{id}": {"delete": {"summary": "Delete Group Id", "description": "Remove a group by ID.", "operationId": "delete_group_id_api_v1_secrets_group__id__delete", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/secrets/set-group": {"post": {"summary": "Assign Secret Group", "description": "Assign a secret to a group or root.", "operationId": "assign_secret_group_api_v1_secrets_set_group_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SecretGroupAssign"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/v1/secrets/move-group/{group_name}": {"post": {"summary": "Move Group", "description": "Move a group.", "operationId": "move_group_api_v1_secrets_move_group__group_name__post", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "group_name", "in": "path", "required": true, "schema": {"type": "string", "title": "Group Name"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/GroupPath"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}}, "components": {"schemas": {"AuditListResult": {"properties": {"results": {"items": {"$ref": "#/components/schemas/AuditLog"}, "type": "array", "title": "Results"}, "total": {"type": "integer", "title": "Total"}, "remaining": {"type": "integer", "title": "Remaining"}}, "type": "object", "required": ["results", "total", "remaining"], "title": "AuditListResult", "description": "Class to return when listing audit entries."}, "AuditLog": {"properties": {"id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Id"}, "subsystem": {"$ref": "#/components/schemas/SubSystem"}, "operation": {"$ref": "#/components/schemas/Operation"}, "client_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Id"}, "client_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Name"}, "secret_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret Id"}, "secret_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret Name"}, "data": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"type": "null"}], "title": "Data"}, "message": {"type": "string", "title": "Message"}, "origin": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Origin"}, "timestamp": {"anyOf": [{"type": "string", "format": "date-time"}, {"type": "null"}], "title": "Timestamp"}}, "type": "object", "required": ["subsystem", "operation", "message"], "title": "AuditLog", "description": "Implementation of the backend class AuditView."}, "AutoGenerateOpts": {"properties": {"auto_generate": {"type": "boolean", "const": true, "title": "Auto Generate"}, "length": {"type": "integer", "title": "Length", "default": 32}}, "type": "object", "required": ["auto_generate"], "title": "AutoGenerateOpts", "description": "Option to auto-generate a password."}, "Body_login_for_access_token_api_v1_token_post": {"properties": {"grant_type": {"anyOf": [{"type": "string", "pattern": "^password$"}, {"type": "null"}], "title": "Grant Type"}, "username": {"type": "string", "title": "Username"}, "password": {"type": "string", "format": "password", "title": "Password"}, "scope": {"type": "string", "title": "Scope", "default": ""}, "client_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Id"}, "client_secret": {"anyOf": [{"type": "string"}, {"type": "null"}], "format": "password", "title": "Client Secret"}}, "type": "object", "required": ["username", "password"], "title": "Body_login_for_access_token_api_v1_token_post"}, "Client": {"properties": {"id": {"type": "string", "format": "uuid", "title": "Id"}, "name": {"type": "string", "title": "Name"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "public_key": {"type": "string", "title": "Public Key"}, "version": {"type": "integer", "title": "Version"}, "is_active": {"type": "boolean", "title": "Is Active"}, "is_deleted": {"type": "boolean", "title": "Is Deleted"}, "secrets": {"items": {"type": "string"}, "type": "array", "title": "Secrets"}, "policies": {"items": {"anyOf": [{"type": "string", "format": "ipvanynetwork"}, {"type": "string", "format": "ipvanyaddress"}]}, "type": "array", "title": "Policies"}, "created_at": {"type": "string", "format": "date-time", "title": "Created At"}, "updated_at": {"anyOf": [{"type": "string", "format": "date-time"}, {"type": "null"}], "title": "Updated At"}, "deleted_at": {"anyOf": [{"type": "string", "format": "date-time"}, {"type": "null"}], "title": "Deleted At"}}, "type": "object", "required": ["id", "name", "description", "public_key", "version", "is_active", "is_deleted", "secrets", "policies", "created_at", "updated_at", "deleted_at"], "title": "Client", "description": "Implementation of the backend class ClientView."}, "ClientCreate": {"properties": {"name": {"type": "string", "title": "Name"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "public_key": {"type": "string", "title": "Public Key"}, "sources": {"items": {"anyOf": [{"type": "string", "format": "ipvanyaddress"}, {"type": "string", "format": "ipvanynetwork"}]}, "type": "array", "title": "Sources"}}, "type": "object", "required": ["name", "public_key"], "title": "ClientCreate", "description": "Model to create a client."}, "ClientQueryResult": {"properties": {"clients": {"items": {"$ref": "#/components/schemas/Client"}, "type": "array", "title": "Clients"}, "total_results": {"type": "integer", "title": "Total Results"}, "remaining_results": {"type": "integer", "title": "Remaining Results"}}, "type": "object", "required": ["clients", "total_results", "remaining_results"], "title": "ClientQueryResult", "description": "Implementation of the backend ClientQueryResult class."}, "ClientReference": {"properties": {"id": {"type": "string", "title": "Id"}, "name": {"type": "string", "title": "Name"}}, "type": "object", "required": ["id", "name"], "title": "ClientReference", "description": "Implementation of the backend class ClientReference."}, "ClientSecretGroup": {"properties": {"id": {"type": "string", "format": "uuid", "title": "Id"}, "group_name": {"type": "string", "title": "Group Name"}, "path": {"type": "string", "title": "Path"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "parent_group": {"anyOf": [{"$ref": "#/components/schemas/GroupReference"}, {"type": "null"}]}, "children": {"items": {"$ref": "#/components/schemas/ClientSecretGroup"}, "type": "array", "title": "Children"}, "entries": {"items": {"$ref": "#/components/schemas/SecretClientMapping"}, "type": "array", "title": "Entries"}}, "type": "object", "required": ["id", "group_name", "path"], "title": "ClientSecretGroup", "description": "Client secrets grouped."}, "ClientSecretGroupList": {"properties": {"ungrouped": {"items": {"$ref": "#/components/schemas/SecretClientMapping"}, "type": "array", "title": "Ungrouped"}, "groups": {"items": {"$ref": "#/components/schemas/ClientSecretGroup"}, "type": "array", "title": "Groups"}}, "type": "object", "title": "ClientSecretGroupList", "description": "Secret group list."}, "GroupPath": {"properties": {"path": {"type": "string", "pattern": "^/.*", "title": "Path"}}, "type": "object", "required": ["path"], "title": "GroupPath", "description": "Path to a group."}, "GroupReference": {"properties": {"group_name": {"type": "string", "title": "Group Name"}, "path": {"type": "string", "title": "Path"}}, "type": "object", "required": ["group_name", "path"], "title": "GroupReference", "description": "Reference to a group.\n\nThis will be used for references to parent groups to avoid circular\nreferences."}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "Operation": {"type": "string", "enum": ["create", "read", "update", "delete", "deny", "permit", "login", "none"], "title": "Operation", "description": "Various operations for the audit logging module."}, "RefreshTokenForm": {"properties": {"grant_type": {"type": "string", "const": "refresh_token", "title": "Grant Type"}, "refresh_token": {"type": "string", "title": "Refresh Token"}}, "type": "object", "required": ["grant_type", "refresh_token"], "title": "RefreshTokenForm", "description": "The refresh token form data."}, "SecretClientMapping": {"properties": {"name": {"type": "string", "title": "Name"}, "unmanaged": {"type": "boolean", "title": "Unmanaged", "default": false}, "clients": {"items": {"$ref": "#/components/schemas/ClientReference"}, "type": "array", "title": "Clients"}}, "type": "object", "required": ["name"], "title": "SecretClientMapping", "description": "Secret name with list of clients."}, "SecretCreate": {"properties": {"value": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/AutoGenerateOpts"}], "title": "Value", "description": "Secret as string value or auto-generated with optional length", "examples": ["MySecretString", {"auto_generate": true, "length": 32}]}, "name": {"type": "string", "title": "Name"}, "clients": {"anyOf": [{"items": {"type": "string"}, "type": "array"}, {"type": "null"}], "title": "Clients", "description": "Assign the secret to a list of clients."}, "client_distinguisher": {"type": "string", "enum": ["id", "name"], "title": "Client Distinguisher", "default": "name"}, "group": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Group"}}, "type": "object", "required": ["value", "name"], "title": "SecretCreate", "description": "Model to create a secret.", "examples": [{"clients": ["client-1", "client-2"], "name": "MySecret", "value": {"auto_generate": true, "length": 32}}, {"group": "MySecretGroup", "name": "MySecret", "value": "mysecretstring"}]}, "SecretGroupAssign": {"properties": {"secret_name": {"type": "string", "title": "Secret Name"}, "group_path": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Group Path"}}, "type": "object", "required": ["secret_name", "group_path"], "title": "SecretGroupAssign", "description": "Model for assigning secrets to a group.\n\nIf group is None, then it will be placed in the root."}, "SecretGroupCreate": {"properties": {"name": {"type": "string", "minLength": 1, "title": "Name"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "parent_group": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Parent Group"}}, "type": "object", "required": ["name"], "title": "SecretGroupCreate", "description": "Create model for creating secret groups."}, "SecretGroupUdate": {"properties": {"name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Name"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "parent_group": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Parent Group"}}, "type": "object", "title": "SecretGroupUdate", "description": "Update model for updating secret groups."}, "SecretListView": {"properties": {"name": {"type": "string", "title": "Name"}, "unmanaged": {"type": "boolean", "title": "Unmanaged", "default": false}, "clients": {"items": {"type": "string"}, "type": "array", "title": "Clients"}}, "type": "object", "required": ["name"], "title": "SecretListView", "description": "Model containing a list of all available secrets."}, "SecretUpdate": {"properties": {"value": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/AutoGenerateOpts"}], "title": "Value", "description": "Secret as string value or auto-generated with optional length", "examples": ["MySecretString", {"auto_generate": true, "length": 32}]}}, "type": "object", "required": ["value"], "title": "SecretUpdate", "description": "Model to update a secret."}, "SecretView": {"properties": {"name": {"type": "string", "title": "Name"}, "secret": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret"}, "group": {"anyOf": [{"$ref": "#/components/schemas/GroupReference"}, {"type": "null"}]}, "clients": {"items": {"$ref": "#/components/schemas/ClientReference"}, "type": "array", "title": "Clients"}}, "type": "object", "required": ["name", "secret"], "title": "SecretView", "description": "Model containing a secret, including its clear-text value."}, "SubSystem": {"type": "string", "enum": ["admin", "sshd", "backend"], "title": "SubSystem", "description": "Available subsystems."}, "SystemStats": {"properties": {"clients": {"type": "integer", "title": "Clients"}, "secrets": {"type": "integer", "title": "Secrets"}, "audit_events": {"type": "integer", "title": "Audit Events"}}, "type": "object", "required": ["clients", "secrets", "audit_events"], "title": "SystemStats", "description": "Generic system stats."}, "Token": {"properties": {"access_token": {"type": "string", "title": "Access Token"}, "refresh_token": {"type": "string", "title": "Refresh Token"}, "token_type": {"type": "string", "title": "Token Type"}}, "type": "object", "required": ["access_token", "refresh_token", "token_type"], "title": "Token"}, "UpdateKeyModel": {"properties": {"public_key": {"type": "string", "title": "Public Key"}}, "type": "object", "required": ["public_key"], "title": "UpdateKeyModel", "description": "Model for updating client public key."}, "UpdateKeyResponse": {"properties": {"public_key": {"type": "string", "title": "Public Key"}, "updated_secrets": {"items": {"type": "string"}, "type": "array", "title": "Updated Secrets"}, "detail": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Detail"}}, "type": "object", "required": ["public_key"], "title": "UpdateKeyResponse", "description": "Response model after updating the public key."}, "UpdatePoliciesRequest": {"properties": {"sources": {"items": {"anyOf": [{"type": "string", "format": "ipvanyaddress"}, {"type": "string", "format": "ipvanynetwork"}]}, "type": "array", "title": "Sources"}}, "type": "object", "required": ["sources"], "title": "UpdatePoliciesRequest", "description": "Update policy request."}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}}, "securitySchemes": {"OAuth2PasswordBearer": {"type": "oauth2", "flows": {"password": {"refreshUrl": "/api/v1/refresh", "scopes": {}, "tokenUrl": "/api/v1/token"}}}}}} \ No newline at end of file diff --git a/packages/sshecret-frontend/src/api/assertSdkResponseOk.ts b/packages/sshecret-frontend/src/api/assertSdkResponseOk.ts new file mode 100644 index 0000000..7ab4ace --- /dev/null +++ b/packages/sshecret-frontend/src/api/assertSdkResponseOk.ts @@ -0,0 +1,31 @@ +// /src/utils/assertSdkResponseOk.ts +import type { AxiosResponse, AxiosError } from 'axios' +import { ApiError, ValidationError, NotFoundError } from '@/api/errors' +import { isHttpValidationError } from './typeguards'; + +export type SDKResponse = + | (AxiosResponse & { error: undefined }) + | (AxiosError & { data: undefined; error: any }) + +export function assertSdkResponseOk(response: SDKResponse): T { + if ('error' in response && response.error) { + const status = response.status ?? 500 + + if (status === 404) { + throw new NotFoundError("Not found") + } + + if (status === 422 && isHttpValidationError(response.error)) { + throw new ValidationError(response.error.detail ?? []) + } + + const errorMessage = response.error.detail ?? 'Unknown error' + throw new ApiError(`API error: ${errorMessage}`, status) + } + + if ('data' in response && response.data) { + return response.data + } + + throw new ApiError('Invalid response shape', 500) +} diff --git a/packages/sshecret-frontend/src/api/errors.ts b/packages/sshecret-frontend/src/api/errors.ts new file mode 100644 index 0000000..f288931 --- /dev/null +++ b/packages/sshecret-frontend/src/api/errors.ts @@ -0,0 +1,28 @@ + +export class ApiError extends Error { + public status: number + + constructor(message: string, status: number) { + super(message) + this.name = 'ApiError' + this.status = status + } +} + +export class NotFoundError extends ApiError { + constructor(message: string) { + super(message, 404) + this.name = "NotFoundError" + } +} + +export class ValidationError extends ApiError { + public errors: any[] + + constructor(errors: any[], message: string = 'Validation failed') { + super(message, 422) + this.name = 'ValidationError' + this.errors = errors + } +} + diff --git a/packages/sshecret-frontend/src/api/interceptors.ts b/packages/sshecret-frontend/src/api/interceptors.ts index 8595c8a..256ece7 100644 --- a/packages/sshecret-frontend/src/api/interceptors.ts +++ b/packages/sshecret-frontend/src/api/interceptors.ts @@ -1,6 +1,8 @@ import { client } from '@/client/client.gen' import { useAuthTokenStore } from '@/store/auth.ts' +import router from '@/router' + client.instance.interceptors.response.use( response => response, @@ -11,6 +13,7 @@ client.instance.interceptors.response.use( if (originalRequest.url.includes("/refresh")) { const auth = useAuthTokenStore() auth.logout() + router.push({ name: 'login' }) return Promise.reject("Refresh failed - logged out") } if (error.response?.status === 401 && !originalRequest._retry) { @@ -27,6 +30,6 @@ client.instance.interceptors.response.use( } return Promise.reject("Could not refresh token") } - return Promise.reject("Could not refresh token") + return Promise.reject(error) } ) diff --git a/packages/sshecret-frontend/src/api/typeguards.ts b/packages/sshecret-frontend/src/api/typeguards.ts index b69483e..0ea3c5f 100644 --- a/packages/sshecret-frontend/src/api/typeguards.ts +++ b/packages/sshecret-frontend/src/api/typeguards.ts @@ -2,7 +2,7 @@ import { OPERATIONS } from '@/api/types' import { SUBSYSTEM } from '@/api/types' -import type { Operation, SubSystem } from '@/client' +import type { HttpValidationError, Operation, SubSystem } from '@/client' export function isOperation(value: string): value is Operation { return (OPERATIONS as readonly string[]).includes(value) @@ -11,3 +11,7 @@ export function isOperation(value: string): value is Operation { export function isSubSystem(value: string): value is SubSystem { return (SUBSYSTEM as readonly string[]).includes(value) } + +export function isHttpValidationError(error: unknown): error is HttpValidationError { + return !!(error && typeof error === 'object' && 'detail' in error) +} diff --git a/packages/sshecret-frontend/src/assets/custom.css b/packages/sshecret-frontend/src/assets/custom.css index 0418a6e..e3e5dbc 100644 --- a/packages/sshecret-frontend/src/assets/custom.css +++ b/packages/sshecret-frontend/src/assets/custom.css @@ -53,3 +53,12 @@ sl-checkbox:focus-within[data-user-valid]::part(control) { border-color: var(--sl-color-success-600); box-shadow: 0 0 0 var(--sl-focus-ring-width) var(--sl-color-success-300); } + + +sl-tab-group.master-pane-tabs::part(base), +sl-tab-group.master-pane-tabs::part(body), +sl-tab-group.master-pane-tabs sl-tab-panel::part(base), +sl-tab-group.master-pane-tabs sl-tab-panel::part(body), +sl-tab-group.master-pane-tabs sl-tab-panel { + height: 100%; +} diff --git a/packages/sshecret-frontend/src/client/sdk.gen.ts b/packages/sshecret-frontend/src/client/sdk.gen.ts index 02e3b73..e4861eb 100644 --- a/packages/sshecret-frontend/src/client/sdk.gen.ts +++ b/packages/sshecret-frontend/src/client/sdk.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { type Options as ClientOptions, type TDataShape, type Client, urlSearchParamsBodySerializer } from './client'; -import type { GetHealthHealthGetData, GetHealthHealthGetResponses, GetAuditLogApiV1AuditGetData, GetAuditLogApiV1AuditGetResponses, GetAuditLogApiV1AuditGetErrors, LoginForAccessTokenApiV1TokenPostData, LoginForAccessTokenApiV1TokenPostResponses, LoginForAccessTokenApiV1TokenPostErrors, RefreshTokenApiV1RefreshPostData, RefreshTokenApiV1RefreshPostResponses, RefreshTokenApiV1RefreshPostErrors, GetClientsApiV1ClientsGetData, GetClientsApiV1ClientsGetResponses, CreateClientApiV1ClientsPostData, CreateClientApiV1ClientsPostResponses, CreateClientApiV1ClientsPostErrors, GetClientsTerseApiV1ClientsTerseGetData, GetClientsTerseApiV1ClientsTerseGetResponses, QueryClientsApiV1QueryClientsGetData, QueryClientsApiV1QueryClientsGetResponses, QueryClientsApiV1QueryClientsGetErrors, DeleteClientApiV1ClientsIdDeleteData, DeleteClientApiV1ClientsIdDeleteResponses, DeleteClientApiV1ClientsIdDeleteErrors, GetClientApiV1ClientsIdGetData, GetClientApiV1ClientsIdGetResponses, GetClientApiV1ClientsIdGetErrors, UpdateClientApiV1ClientsIdPutData, UpdateClientApiV1ClientsIdPutResponses, UpdateClientApiV1ClientsIdPutErrors, DeleteSecretFromClientApiV1ClientsIdSecretsSecretNameDeleteData, DeleteSecretFromClientApiV1ClientsIdSecretsSecretNameDeleteResponses, DeleteSecretFromClientApiV1ClientsIdSecretsSecretNameDeleteErrors, AddSecretToClientApiV1ClientsIdSecretsSecretNamePutData, AddSecretToClientApiV1ClientsIdSecretsSecretNamePutResponses, AddSecretToClientApiV1ClientsIdSecretsSecretNamePutErrors, UpdateClientPoliciesApiV1ClientsIdPoliciesPutData, UpdateClientPoliciesApiV1ClientsIdPoliciesPutResponses, UpdateClientPoliciesApiV1ClientsIdPoliciesPutErrors, UpdateClientPublicKeyApiV1ClientsIdPublicKeyPutData, UpdateClientPublicKeyApiV1ClientsIdPublicKeyPutResponses, UpdateClientPublicKeyApiV1ClientsIdPublicKeyPutErrors, GetSecretNamesApiV1SecretsGetData, GetSecretNamesApiV1SecretsGetResponses, AddSecretApiV1SecretsPostData, AddSecretApiV1SecretsPostResponses, AddSecretApiV1SecretsPostErrors, DeleteSecretApiV1SecretsNameDeleteData, DeleteSecretApiV1SecretsNameDeleteResponses, DeleteSecretApiV1SecretsNameDeleteErrors, GetSecretApiV1SecretsNameGetData, GetSecretApiV1SecretsNameGetResponses, GetSecretApiV1SecretsNameGetErrors, UpdateSecretApiV1SecretsNamePutData, UpdateSecretApiV1SecretsNamePutResponses, UpdateSecretApiV1SecretsNamePutErrors, GetSecretGroupsApiV1SecretsGroupsGetData, GetSecretGroupsApiV1SecretsGroupsGetResponses, GetSecretGroupsApiV1SecretsGroupsGetErrors, AddSecretGroupApiV1SecretsGroupsPostData, AddSecretGroupApiV1SecretsGroupsPostResponses, AddSecretGroupApiV1SecretsGroupsPostErrors, DeleteSecretGroupApiV1SecretsGroupsGroupPathDeleteData, DeleteSecretGroupApiV1SecretsGroupsGroupPathDeleteResponses, DeleteSecretGroupApiV1SecretsGroupsGroupPathDeleteErrors, GetSecretGroupApiV1SecretsGroupsGroupPathGetData, GetSecretGroupApiV1SecretsGroupsGroupPathGetResponses, GetSecretGroupApiV1SecretsGroupsGroupPathGetErrors, UpdateSecretGroupApiV1SecretsGroupsGroupPathPutData, UpdateSecretGroupApiV1SecretsGroupsGroupPathPutResponses, UpdateSecretGroupApiV1SecretsGroupsGroupPathPutErrors, DeleteGroupIdApiV1SecretsGroupIdDeleteData, DeleteGroupIdApiV1SecretsGroupIdDeleteResponses, DeleteGroupIdApiV1SecretsGroupIdDeleteErrors, AssignSecretGroupApiV1SecretsSetGroupPostData, AssignSecretGroupApiV1SecretsSetGroupPostResponses, AssignSecretGroupApiV1SecretsSetGroupPostErrors, MoveGroupApiV1SecretsMoveGroupGroupNamePostData, MoveGroupApiV1SecretsMoveGroupGroupNamePostResponses, MoveGroupApiV1SecretsMoveGroupGroupNamePostErrors } from './types.gen'; +import type { GetHealthHealthGetData, GetHealthHealthGetResponses, GetAuditLogApiV1AuditGetData, GetAuditLogApiV1AuditGetResponses, GetAuditLogApiV1AuditGetErrors, LoginForAccessTokenApiV1TokenPostData, LoginForAccessTokenApiV1TokenPostResponses, LoginForAccessTokenApiV1TokenPostErrors, RefreshTokenApiV1RefreshPostData, RefreshTokenApiV1RefreshPostResponses, RefreshTokenApiV1RefreshPostErrors, GetClientsApiV1ClientsGetData, GetClientsApiV1ClientsGetResponses, CreateClientApiV1ClientsPostData, CreateClientApiV1ClientsPostResponses, CreateClientApiV1ClientsPostErrors, GetClientsTerseApiV1ClientsTerseGetData, GetClientsTerseApiV1ClientsTerseGetResponses, QueryClientsApiV1QueryClientsGetData, QueryClientsApiV1QueryClientsGetResponses, QueryClientsApiV1QueryClientsGetErrors, DeleteClientApiV1ClientsIdDeleteData, DeleteClientApiV1ClientsIdDeleteResponses, DeleteClientApiV1ClientsIdDeleteErrors, GetClientApiV1ClientsIdGetData, GetClientApiV1ClientsIdGetResponses, GetClientApiV1ClientsIdGetErrors, UpdateClientApiV1ClientsIdPutData, UpdateClientApiV1ClientsIdPutResponses, UpdateClientApiV1ClientsIdPutErrors, DeleteSecretFromClientApiV1ClientsIdSecretsSecretNameDeleteData, DeleteSecretFromClientApiV1ClientsIdSecretsSecretNameDeleteResponses, DeleteSecretFromClientApiV1ClientsIdSecretsSecretNameDeleteErrors, AddSecretToClientApiV1ClientsIdSecretsSecretNamePutData, AddSecretToClientApiV1ClientsIdSecretsSecretNamePutResponses, AddSecretToClientApiV1ClientsIdSecretsSecretNamePutErrors, UpdateClientPoliciesApiV1ClientsIdPoliciesPutData, UpdateClientPoliciesApiV1ClientsIdPoliciesPutResponses, UpdateClientPoliciesApiV1ClientsIdPoliciesPutErrors, UpdateClientPublicKeyApiV1ClientsIdPublicKeyPutData, UpdateClientPublicKeyApiV1ClientsIdPublicKeyPutResponses, UpdateClientPublicKeyApiV1ClientsIdPublicKeyPutErrors, GetSystemStatsApiV1StatsGetData, GetSystemStatsApiV1StatsGetResponses, GetSecretNamesApiV1SecretsGetData, GetSecretNamesApiV1SecretsGetResponses, AddSecretApiV1SecretsPostData, AddSecretApiV1SecretsPostResponses, AddSecretApiV1SecretsPostErrors, DeleteSecretApiV1SecretsNameDeleteData, DeleteSecretApiV1SecretsNameDeleteResponses, DeleteSecretApiV1SecretsNameDeleteErrors, GetSecretApiV1SecretsNameGetData, GetSecretApiV1SecretsNameGetResponses, GetSecretApiV1SecretsNameGetErrors, UpdateSecretApiV1SecretsNamePutData, UpdateSecretApiV1SecretsNamePutResponses, UpdateSecretApiV1SecretsNamePutErrors, GetSecretGroupsApiV1SecretsGroupsGetData, GetSecretGroupsApiV1SecretsGroupsGetResponses, GetSecretGroupsApiV1SecretsGroupsGetErrors, AddSecretGroupApiV1SecretsGroupsPostData, AddSecretGroupApiV1SecretsGroupsPostResponses, AddSecretGroupApiV1SecretsGroupsPostErrors, DeleteSecretGroupApiV1SecretsGroupsGroupPathDeleteData, DeleteSecretGroupApiV1SecretsGroupsGroupPathDeleteResponses, DeleteSecretGroupApiV1SecretsGroupsGroupPathDeleteErrors, GetSecretGroupApiV1SecretsGroupsGroupPathGetData, GetSecretGroupApiV1SecretsGroupsGroupPathGetResponses, GetSecretGroupApiV1SecretsGroupsGroupPathGetErrors, UpdateSecretGroupApiV1SecretsGroupsGroupPathPutData, UpdateSecretGroupApiV1SecretsGroupsGroupPathPutResponses, UpdateSecretGroupApiV1SecretsGroupsGroupPathPutErrors, DeleteGroupIdApiV1SecretsGroupIdDeleteData, DeleteGroupIdApiV1SecretsGroupIdDeleteResponses, DeleteGroupIdApiV1SecretsGroupIdDeleteErrors, AssignSecretGroupApiV1SecretsSetGroupPostData, AssignSecretGroupApiV1SecretsSetGroupPostResponses, AssignSecretGroupApiV1SecretsSetGroupPostErrors, MoveGroupApiV1SecretsMoveGroupGroupNamePostData, MoveGroupApiV1SecretsMoveGroupGroupNamePostResponses, MoveGroupApiV1SecretsMoveGroupGroupNamePostErrors } from './types.gen'; import { client as _heyApiClient } from './client.gen'; export type Options = ClientOptions & { @@ -300,6 +300,24 @@ export class SshecretAdmin { }); } + /** + * Get System Stats + * Get system stats. + */ + public static getSystemStatsApiV1StatsGet(options?: Options) { + return (options?.client ?? _heyApiClient).get({ + responseType: 'json', + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/api/v1/stats', + ...options + }); + } + /** * Get Secret Names * Get Secret Names. diff --git a/packages/sshecret-frontend/src/client/types.gen.ts b/packages/sshecret-frontend/src/client/types.gen.ts index 8861ee2..5245c18 100644 --- a/packages/sshecret-frontend/src/client/types.gen.ts +++ b/packages/sshecret-frontend/src/client/types.gen.ts @@ -477,10 +477,7 @@ export type SecretView = { * Secret */ secret: string | null; - /** - * Group - */ - group?: string | null; + group?: GroupReference | null; /** * Clients */ @@ -493,6 +490,25 @@ export type SecretView = { */ export type SubSystem = 'admin' | 'sshd' | 'backend'; +/** + * SystemStats + * Generic system stats. + */ +export type SystemStats = { + /** + * Clients + */ + clients: number; + /** + * Secrets + */ + secrets: number; + /** + * Audit Events + */ + audit_events: number; +}; + /** * Token */ @@ -1031,6 +1047,22 @@ export type UpdateClientPublicKeyApiV1ClientsIdPublicKeyPutResponses = { export type UpdateClientPublicKeyApiV1ClientsIdPublicKeyPutResponse = UpdateClientPublicKeyApiV1ClientsIdPublicKeyPutResponses[keyof UpdateClientPublicKeyApiV1ClientsIdPublicKeyPutResponses]; +export type GetSystemStatsApiV1StatsGetData = { + body?: never; + path?: never; + query?: never; + url: '/api/v1/stats'; +}; + +export type GetSystemStatsApiV1StatsGetResponses = { + /** + * Successful Response + */ + 200: SystemStats; +}; + +export type GetSystemStatsApiV1StatsGetResponse = GetSystemStatsApiV1StatsGetResponses[keyof GetSystemStatsApiV1StatsGetResponses]; + export type GetSecretNamesApiV1SecretsGetData = { body?: never; path?: never; diff --git a/packages/sshecret-frontend/src/components/audit/AuditFilters.vue b/packages/sshecret-frontend/src/components/audit/AuditFilters.vue index fabedde..f6d4a75 100644 --- a/packages/sshecret-frontend/src/components/audit/AuditFilters.vue +++ b/packages/sshecret-frontend/src/components/audit/AuditFilters.vue @@ -79,6 +79,8 @@ import { ref, reactive, onMounted, watch } from 'vue' import { useAuditFilterState } from '@/store/useAuditFilterState' import { SshecretAdmin } from '@/client' import { SUBSYSTEM, OPERATIONS } from '@/api/types' +import { assertSdkResponseOk } from '@/api/AssertSdkResponseOk' + const auditFilterState = useAuditFilterState() const clientNames = ref() @@ -94,16 +96,14 @@ const filterForm = reactive({ async function fetchClientNames() { const response = await SshecretAdmin.getClientsTerseApiV1ClientsTerseGet() - if (response.data) { - clientNames.value = response.data.map((x) => x.name) - } + const responseData = assertSdkResponseOk(response) + clientNames.value = responseData.map((x) => x.name) } async function fetchSecretNames() { const response = await SshecretAdmin.getSecretNamesApiV1SecretsGet() - if (response.data) { - secretNames.value = response.data.map((x) => x.name) - } + const responseData = assertSdkResponseOk(response) + secretNames.value = responseData.map((x) => x.name) } async function fetchNames() { diff --git a/packages/sshecret-frontend/src/components/audit/AuditSkeleton.vue b/packages/sshecret-frontend/src/components/audit/AuditSkeleton.vue index 3aa2795..15cf26b 100644 --- a/packages/sshecret-frontend/src/components/audit/AuditSkeleton.vue +++ b/packages/sshecret-frontend/src/components/audit/AuditSkeleton.vue @@ -53,7 +53,7 @@ -