hostname-service/docs/docs.go

406 lines
14 KiB
Go
Raw Normal View History

2024-01-17 18:05:55 +01:00
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"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": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"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": {
"$ref": "#/definitions/models.SimpleHostnameResponse"
2024-01-17 18:05:55 +01:00
}
}
}
},
"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": {
"$ref": "#/definitions/models.SimpleHostnameResponse"
2024-01-17 18:05:55 +01:00
}
}
}
}
},
"/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": {
"$ref": "#/definitions/models.TokenResponse"
2024-01-17 18:05:55 +01:00
}
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
2024-01-17 18:05:55 +01:00
}
},
"401": {
"description": "Invalid login credentials",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
2024-01-17 18:05:55 +01:00
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
2024-01-17 18:05:55 +01:00
}
}
}
}
},
"/{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": "An array of responses",
2024-01-17 18:05:55 +01:00
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Hostname"
}
2024-01-17 18:05:55 +01:00
}
}
}
}
},
"/{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": "A single response object",
2024-01-17 18:05:55 +01:00
"schema": {
"$ref": "#/definitions/models.Hostname"
2024-01-17 18:05:55 +01:00
}
}
}
},
"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": {
"$ref": "#/definitions/models.SimpleHostnameResponse"
2024-01-17 18:05:55 +01:00
}
}
}
}
}
},
"definitions": {
"models.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
},
"models.Hostname": {
"description": "Model of the Hostname as it is represented in the database",
"type": "object",
"properties": {
"Category": {
"description": "Category / Rule that was used when generating the hostname",
"type": "string",
"example": "notebook"
},
"Created_at": {
"description": "Creation Time of the entry",
"type": "string",
"example": "2024-01-16T12:53:59Z"
},
"Hostname": {
"description": "Generated hostname",
"type": "string",
"example": "ISEHENNB0009"
},
"Id": {
"description": "Internal ID of the Hostname within the database",
"type": "integer",
"example": 25
},
"Parameters": {
"description": "Parameter object of rule specific attributes, see rule.* models",
"type": "object",
"additionalProperties": true
}
}
},
2024-01-17 18:05:55 +01:00
"models.LoginCredentials": {
"description": "User account information used in the login process with Username and password",
"type": "object",
"properties": {
"Password": {
2024-01-17 18:05:55 +01:00
"type": "string"
},
"Username": {
"type": "string"
}
}
},
"models.SimpleHostnameResponse": {
"description": "Model of the Hostname as returned by POST endpoint",
"type": "object",
"properties": {
"Hostname": {
"description": "Name of the newly generated host",
"type": "string"
}
}
},
"models.TokenResponse": {
"description": "Model returned after successful login",
"type": "object",
"properties": {
"token": {
2024-01-17 18:05:55 +01:00
"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"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1",
Host: "localhost:8080",
BasePath: "/api/v1",
Schemes: []string{},
Title: "Hostname Service API",
Description: "This is a sample server for a hostname service.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}