📝 Updates the Swagger Docs

This commit is contained in:
Florian Beisel 2024-01-21 16:22:04 +01:00
parent 1669a65512
commit 2b41bbdbb9
Signed by: florian
GPG Key ID: 79ECA2E54996FF4D
3 changed files with 367 additions and 8 deletions

View File

@ -15,8 +15,8 @@ const docTemplate = `{
"email": "florian@beisel.it"
},
"license": {
"name": "MIT",
"url": "http://git.beisel.it/florian/hostname-service/"
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
@ -25,6 +25,11 @@ const docTemplate = `{
"paths": {
"/api/notebook": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "Generates a new hostname for a notebook based on dynamic rules.",
"consumes": [
"application/json"
@ -33,7 +38,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Generating Hostnames"
"Manipulate existing Hostnames"
],
"summary": "Update hostname for category \"notebook\"",
"operationId": "update-notebook-hostname",
@ -58,6 +63,11 @@ const docTemplate = `{
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"description": "Generates a hostname for a notebook based on dynamic rules.",
"consumes": [
"application/json"
@ -91,6 +101,110 @@ const docTemplate = `{
}
}
},
"/api/rules": {
"get": {
"description": "Get a list of all available hostname generation rules.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Rules"
],
"summary": "List Available Rules",
"responses": {
"200": {
"description": "List of available rules with descriptions",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/server": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "Generates a new hostname for a notebook based on dynamic rules.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Manipulate existing Hostnames"
],
"summary": "Update hostname for category \"notebook\"",
"operationId": "update-server-hostname",
"parameters": [
{
"description": "Input data to generate hostname",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/rules.ServerRuleInput"
}
}
],
"responses": {
"200": {
"description": "Hostname",
"schema": {
"$ref": "#/definitions/models.SimpleHostnameResponse"
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"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-server-hostname",
"parameters": [
{
"description": "Input data to generate hostname",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/rules.ServerRuleInput"
}
}
],
"responses": {
"200": {
"description": "Hostname",
"schema": {
"$ref": "#/definitions/models.SimpleHostnameResponse"
}
}
}
}
},
"/hello": {
"get": {
"security": [
@ -374,6 +488,29 @@ const docTemplate = `{
"type": "string"
}
}
},
"rules.ServerRuleInput": {
"type": "object",
"properties": {
"Description": {
"type": "string"
},
"ILO": {
"type": "string"
},
"IP": {
"type": "string"
},
"Location": {
"type": "string"
},
"OrgUnit": {
"type": "string"
},
"Responsible": {
"type": "string"
}
}
}
},
"securityDefinitions": {

View File

@ -9,8 +9,8 @@
"email": "florian@beisel.it"
},
"license": {
"name": "MIT",
"url": "http://git.beisel.it/florian/hostname-service/"
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1"
},
@ -19,6 +19,11 @@
"paths": {
"/api/notebook": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "Generates a new hostname for a notebook based on dynamic rules.",
"consumes": [
"application/json"
@ -27,7 +32,7 @@
"application/json"
],
"tags": [
"Generating Hostnames"
"Manipulate existing Hostnames"
],
"summary": "Update hostname for category \"notebook\"",
"operationId": "update-notebook-hostname",
@ -52,6 +57,11 @@
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"description": "Generates a hostname for a notebook based on dynamic rules.",
"consumes": [
"application/json"
@ -85,6 +95,110 @@
}
}
},
"/api/rules": {
"get": {
"description": "Get a list of all available hostname generation rules.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Rules"
],
"summary": "List Available Rules",
"responses": {
"200": {
"description": "List of available rules with descriptions",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/server": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "Generates a new hostname for a notebook based on dynamic rules.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Manipulate existing Hostnames"
],
"summary": "Update hostname for category \"notebook\"",
"operationId": "update-server-hostname",
"parameters": [
{
"description": "Input data to generate hostname",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/rules.ServerRuleInput"
}
}
],
"responses": {
"200": {
"description": "Hostname",
"schema": {
"$ref": "#/definitions/models.SimpleHostnameResponse"
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"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-server-hostname",
"parameters": [
{
"description": "Input data to generate hostname",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/rules.ServerRuleInput"
}
}
],
"responses": {
"200": {
"description": "Hostname",
"schema": {
"$ref": "#/definitions/models.SimpleHostnameResponse"
}
}
}
}
},
"/hello": {
"get": {
"security": [
@ -368,6 +482,29 @@
"type": "string"
}
}
},
"rules.ServerRuleInput": {
"type": "object",
"properties": {
"Description": {
"type": "string"
},
"ILO": {
"type": "string"
},
"IP": {
"type": "string"
},
"Location": {
"type": "string"
},
"OrgUnit": {
"type": "string"
},
"Responsible": {
"type": "string"
}
}
}
},
"securityDefinitions": {

View File

@ -58,6 +58,21 @@ definitions:
OrgUnit:
type: string
type: object
rules.ServerRuleInput:
properties:
Description:
type: string
ILO:
type: string
IP:
type: string
Location:
type: string
OrgUnit:
type: string
Responsible:
type: string
type: object
host: localhost:8080
info:
contact:
@ -66,8 +81,8 @@ info:
url: http://git.beisel.it/florian
description: This is a sample server for a hostname service.
license:
name: MIT
url: http://git.beisel.it/florian/hostname-service/
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: Hostname Service API
version: "1"
paths:
@ -168,6 +183,8 @@ paths:
description: Hostname
schema:
$ref: '#/definitions/models.SimpleHostnameResponse'
security:
- Bearer: []
summary: Generate hostname for category "notebook"
tags:
- Generating Hostnames
@ -190,9 +207,77 @@ paths:
description: Hostname
schema:
$ref: '#/definitions/models.SimpleHostnameResponse'
security:
- Bearer: []
summary: Update hostname for category "notebook"
tags:
- Manipulate existing Hostnames
/api/rules:
get:
consumes:
- application/json
description: Get a list of all available hostname generation rules.
produces:
- application/json
responses:
"200":
description: List of available rules with descriptions
schema:
additionalProperties:
type: string
type: object
summary: List Available Rules
tags:
- Rules
/api/server:
post:
consumes:
- application/json
description: Generates a hostname for a notebook based on dynamic rules.
operationId: insert-server-hostname
parameters:
- description: Input data to generate hostname
in: body
name: body
required: true
schema:
$ref: '#/definitions/rules.ServerRuleInput'
produces:
- application/json
responses:
"200":
description: Hostname
schema:
$ref: '#/definitions/models.SimpleHostnameResponse'
security:
- Bearer: []
summary: Generate hostname for category "notebook"
tags:
- Generating Hostnames
put:
consumes:
- application/json
description: Generates a new hostname for a notebook based on dynamic rules.
operationId: update-server-hostname
parameters:
- description: Input data to generate hostname
in: body
name: body
required: true
schema:
$ref: '#/definitions/rules.ServerRuleInput'
produces:
- application/json
responses:
"200":
description: Hostname
schema:
$ref: '#/definitions/models.SimpleHostnameResponse'
security:
- Bearer: []
summary: Update hostname for category "notebook"
tags:
- Manipulate existing Hostnames
/hello:
get:
consumes: