hostname-service/docs/swagger.yaml

353 lines
9.4 KiB
YAML

basePath: /api/v1
definitions:
models.ErrorResponse:
properties:
error:
type: string
type: object
models.Hostname:
description: Model of the Hostname as it is represented in the database
properties:
Category:
description: Category / Rule that was used when generating the hostname
example: notebook
type: string
Created_at:
description: Creation Time of the entry
example: "2024-01-16T12:53:59Z"
type: string
Hostname:
description: Generated hostname
example: ISEHENNB0009
type: string
Id:
description: Internal ID of the Hostname within the database
example: 25
type: integer
Parameters:
additionalProperties: true
description: Parameter object of rule specific attributes, see rule.* models
type: object
type: object
models.LoginCredentials:
description: User account information used in the login process with Username
and password
properties:
Password:
type: string
Username:
type: string
type: object
models.SimpleHostnameResponse:
description: Model of the Hostname as returned by POST endpoint
properties:
Hostname:
description: Name of the newly generated host
type: string
type: object
models.TokenResponse:
description: Model returned after successful login
properties:
token:
type: string
type: object
rules.NotebookRuleInput:
properties:
Location:
type: string
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:
email: florian@beisel.it
name: Florian Beisel
url: http://git.beisel.it/florian
description: This is a sample server for a hostname service.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: Hostname Service API
version: "1"
paths:
/{category}:
get:
description: List all details for a given category
operationId: list-hostnames-by-category
parameters:
- description: Category of the hostname
in: path
name: category
required: true
type: string
produces:
- application/json
responses:
"200":
description: An array of responses
schema:
items:
$ref: '#/definitions/models.Hostname'
type: array
security:
- Bearer: []
summary: Return a list of hosts and their details filtered by category
tags:
- Querying Hostnames
/{category}/{hostname}:
delete:
description: List all details for a given category
operationId: delete-hostnames-by-category-and-name
parameters:
- description: Category of the hostname
in: path
name: category
required: true
type: string
- description: Hostname to delete
in: path
name: hostname
required: true
type: string
produces:
- application/json
responses:
"200":
description: Hostname
schema:
$ref: '#/definitions/models.SimpleHostnameResponse'
security:
- Bearer: []
summary: Delete a hostname from the database
tags:
- Manipulate existing Hostnames
get:
description: Return details for a single hostname identified by its category
operationId: get-hostname-by-category-and-name
parameters:
- description: Category of the hostname
in: path
name: category
required: true
type: string
- description: Category of the hostname
in: path
name: hostname
required: true
type: string
produces:
- application/json
responses:
"200":
description: A single response object
schema:
$ref: '#/definitions/models.Hostname'
security:
- Bearer: []
summary: Return a single hostname by Category and Name
tags:
- Querying Hostnames
/api/notebook:
post:
consumes:
- application/json
description: Generates a hostname for a notebook based on dynamic rules.
operationId: insert-notebook-hostname
parameters:
- description: Input data to generate hostname
in: body
name: body
required: true
schema:
$ref: '#/definitions/rules.NotebookRuleInput'
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-notebook-hostname
parameters:
- description: Input data to generate hostname
in: body
name: body
required: true
schema:
$ref: '#/definitions/rules.NotebookRuleInput'
produces:
- application/json
responses:
"200":
description: Hostname
schema:
$ref: '#/definitions/models.SimpleHostnameResponse'
security:
- Bearer: []
summary: Update hostname for category "notebook"
tags:
- Manipulate existing Hostnames
/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:
- application/json
description: Checks whether the user is successfully authenticated
operationId: hello
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
security:
- Bearer: []
summary: Check your authentication
tags:
- Authentication
/login:
post:
consumes:
- application/json
description: Authenticate user and return JWT token
parameters:
- description: Login Credentials
in: body
name: loginCredentials
required: true
schema:
$ref: '#/definitions/models.LoginCredentials'
produces:
- application/json
responses:
"200":
description: Successfully authenticated, JWT token returned
schema:
$ref: '#/definitions/models.TokenResponse'
"400":
description: Invalid request body
schema:
$ref: '#/definitions/models.ErrorResponse'
"401":
description: Invalid login credentials
schema:
$ref: '#/definitions/models.ErrorResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: User login
tags:
- Authentication
/rules:
get:
description: Return a list of names of Rules which are known in the RulesRegistry
operationId: get-rules
produces:
- application/json
responses: {}
security:
- Bearer: []
summary: Returns a list of available rules
tags:
- Querying Rules
/rules/:rule:
get:
description: |-
Returns two obea an Input Object and an Output Object
describing the Rules stored values and required parameters
operationId: get-rule-details
produces:
- application/json
responses:
"200":
description: Hostname
schema:
$ref: '#/definitions/models.SimpleHostnameResponse'
security:
- Bearer: []
summary: Returns details about a rule
tags:
- Querying Rules
securityDefinitions:
Bearer:
description: Type "Bearer" followed by a space and JWT token.
in: header
name: Authorization
type: apiKey
swagger: "2.0"