📝 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" "email": "florian@beisel.it"
}, },
"license": { "license": {
"name": "MIT", "name": "Apache 2.0",
"url": "http://git.beisel.it/florian/hostname-service/" "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}, },
"version": "{{.Version}}" "version": "{{.Version}}"
}, },
@ -25,6 +25,11 @@ const docTemplate = `{
"paths": { "paths": {
"/api/notebook": { "/api/notebook": {
"put": { "put": {
"security": [
{
"Bearer": []
}
],
"description": "Generates a new hostname for a notebook based on dynamic rules.", "description": "Generates a new hostname for a notebook based on dynamic rules.",
"consumes": [ "consumes": [
"application/json" "application/json"
@ -33,7 +38,7 @@ const docTemplate = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"Generating Hostnames" "Manipulate existing Hostnames"
], ],
"summary": "Update hostname for category \"notebook\"", "summary": "Update hostname for category \"notebook\"",
"operationId": "update-notebook-hostname", "operationId": "update-notebook-hostname",
@ -58,6 +63,11 @@ const docTemplate = `{
} }
}, },
"post": { "post": {
"security": [
{
"Bearer": []
}
],
"description": "Generates a hostname for a notebook based on dynamic rules.", "description": "Generates a hostname for a notebook based on dynamic rules.",
"consumes": [ "consumes": [
"application/json" "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": { "/hello": {
"get": { "get": {
"security": [ "security": [
@ -374,6 +488,29 @@ const docTemplate = `{
"type": "string" "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": { "securityDefinitions": {

View File

@ -9,8 +9,8 @@
"email": "florian@beisel.it" "email": "florian@beisel.it"
}, },
"license": { "license": {
"name": "MIT", "name": "Apache 2.0",
"url": "http://git.beisel.it/florian/hostname-service/" "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}, },
"version": "1" "version": "1"
}, },
@ -19,6 +19,11 @@
"paths": { "paths": {
"/api/notebook": { "/api/notebook": {
"put": { "put": {
"security": [
{
"Bearer": []
}
],
"description": "Generates a new hostname for a notebook based on dynamic rules.", "description": "Generates a new hostname for a notebook based on dynamic rules.",
"consumes": [ "consumes": [
"application/json" "application/json"
@ -27,7 +32,7 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"Generating Hostnames" "Manipulate existing Hostnames"
], ],
"summary": "Update hostname for category \"notebook\"", "summary": "Update hostname for category \"notebook\"",
"operationId": "update-notebook-hostname", "operationId": "update-notebook-hostname",
@ -52,6 +57,11 @@
} }
}, },
"post": { "post": {
"security": [
{
"Bearer": []
}
],
"description": "Generates a hostname for a notebook based on dynamic rules.", "description": "Generates a hostname for a notebook based on dynamic rules.",
"consumes": [ "consumes": [
"application/json" "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": { "/hello": {
"get": { "get": {
"security": [ "security": [
@ -368,6 +482,29 @@
"type": "string" "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": { "securityDefinitions": {

View File

@ -58,6 +58,21 @@ definitions:
OrgUnit: OrgUnit:
type: string type: string
type: object 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 host: localhost:8080
info: info:
contact: contact:
@ -66,8 +81,8 @@ info:
url: http://git.beisel.it/florian url: http://git.beisel.it/florian
description: This is a sample server for a hostname service. description: This is a sample server for a hostname service.
license: license:
name: MIT name: Apache 2.0
url: http://git.beisel.it/florian/hostname-service/ url: http://www.apache.org/licenses/LICENSE-2.0.html
title: Hostname Service API title: Hostname Service API
version: "1" version: "1"
paths: paths:
@ -168,6 +183,8 @@ paths:
description: Hostname description: Hostname
schema: schema:
$ref: '#/definitions/models.SimpleHostnameResponse' $ref: '#/definitions/models.SimpleHostnameResponse'
security:
- Bearer: []
summary: Generate hostname for category "notebook" summary: Generate hostname for category "notebook"
tags: tags:
- Generating Hostnames - Generating Hostnames
@ -190,9 +207,77 @@ paths:
description: Hostname description: Hostname
schema: schema:
$ref: '#/definitions/models.SimpleHostnameResponse' $ref: '#/definitions/models.SimpleHostnameResponse'
security:
- Bearer: []
summary: Update hostname for category "notebook" summary: Update hostname for category "notebook"
tags: 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 - 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: /hello:
get: get:
consumes: consumes: