hostname-service/docs/swagger.json

332 lines
11 KiB
JSON
Raw Normal View History

2024-01-17 18:05:55 +01:00
{
"swagger": "2.0",
"info": {
"description": "This is a sample server for a hostname service.",
"title": "Hostname Service API",
"contact": {
"name": "Florian Beisel",
"url": "http://git.beisel.it/florian",
"email": "florian@beisel.it"
},
"license": {
"name": "MIT",
"url": "http://git.beisel.it/florian/hostname-service/"
},
"version": "1"
},
"host": "localhost:8080",
"basePath": "/api/v1",
"paths": {
"/api/notebook": {
"put": {
"description": "Generates a new hostname for a notebook based on dynamic rules.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Generating Hostnames"
],
"summary": "Update hostname for category \"notebook\"",
"operationId": "update-notebook-hostname",
"parameters": [
{
"description": "Input data to generate hostname",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/rules.NotebookRuleInput"
}
}
],
"responses": {
"200": {
"description": "Hostname",
"schema": {
"type": "string"
}
}
}
},
"post": {
"description": "Generates a hostname for a notebook based on dynamic rules.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Generating Hostnames"
],
"summary": "Generate hostname for category \"notebook\"",
"operationId": "insert-notebook-hostname",
"parameters": [
{
"description": "Input data to generate hostname",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/rules.NotebookRuleInput"
}
}
],
"responses": {
"200": {
"description": "Hostname",
"schema": {
"type": "string"
}
}
}
}
},
"/hello": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "Checks whether the user is successfully authenticated",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Authentication"
],
"summary": "Check your authentication",
"operationId": "hello",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
}
}
},
"/login": {
"post": {
"description": "Authenticate user and return JWT token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Authentication"
],
"summary": "User login",
"parameters": [
{
"description": "Login Credentials",
"name": "loginCredentials",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.LoginCredentials"
}
}
],
"responses": {
"200": {
"description": "Successfully authenticated, JWT token returned",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Invalid request body",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"401": {
"description": "Invalid login credentials",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/{category}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "List all details for a given category",
"produces": [
"application/json"
],
"tags": [
"Querying Hostnames"
],
"summary": "Return a list of hosts and their details filtered by category",
"operationId": "list-hostnames-by-category",
"parameters": [
{
"type": "string",
"description": "Category of the hostname",
"name": "category",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Hostname",
"schema": {
"type": "json"
}
}
}
}
},
"/{category}/{hostname}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "Return details for a single hostname identified by its category",
"produces": [
"application/json"
],
"tags": [
"Querying Hostnames"
],
"summary": "Return a single hostname by Category and Name",
"operationId": "get-hostname-by-category-and-name",
"parameters": [
{
"type": "string",
"description": "Category of the hostname",
"name": "category",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Category of the hostname",
"name": "hostname",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Hostname",
"schema": {
"type": "json"
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
}
],
"description": "List all details for a given category",
"produces": [
"application/json"
],
"tags": [
"Manipulate existing Hostnames"
],
"summary": "Delete a hostname from the database",
"operationId": "delete-hostnames-by-category-and-name",
"parameters": [
{
"type": "string",
"description": "Category of the hostname",
"name": "category",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Hostname to delete",
"name": "hostname",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Hostname",
"schema": {
"type": "json"
}
}
}
}
}
},
"definitions": {
"models.LoginCredentials": {
"description": "User account information used in the login process with Username and password",
"type": "object",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"rules.NotebookRuleInput": {
"type": "object",
"properties": {
"Location": {
"type": "string"
},
"OrgUnit": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"Bearer": {
"description": "Type \"Bearer\" followed by a space and JWT token.",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}