hostname-service/docs/swagger.yaml

353 lines
9.4 KiB
YAML
Raw Normal View History

2024-01-17 18:05:55 +01:00
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
2024-01-17 18:05:55 +01:00
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
2024-01-17 18:05:55 +01:00
type: string
type: object
models.TokenResponse:
description: Model returned after successful login
properties:
token:
2024-01-17 18:05:55 +01:00
type: string
type: object
rules.NotebookRuleInput:
properties:
Location:
type: string
OrgUnit:
type: string
type: object
2024-01-21 16:22:04 +01:00
rules.ServerRuleInput:
properties:
Description:
type: string
ILO:
type: string
IP:
type: string
Location:
type: string
OrgUnit:
type: string
Responsible:
type: string
type: object
2024-01-17 18:05:55 +01:00
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:
2024-01-21 16:22:04 +01:00
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
2024-01-17 18:05:55 +01:00
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
2024-01-17 18:05:55 +01:00
schema:
items:
$ref: '#/definitions/models.Hostname'
type: array
2024-01-17 18:05:55 +01:00
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'
2024-01-17 18:05:55 +01:00
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
2024-01-17 18:05:55 +01:00
schema:
$ref: '#/definitions/models.Hostname'
2024-01-17 18:05:55 +01:00
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'
2024-01-21 16:22:04 +01:00
security:
- Bearer: []
2024-01-17 18:05:55 +01:00
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'
2024-01-21 16:22:04 +01:00
security:
- Bearer: []
2024-01-17 18:05:55 +01:00
summary: Update hostname for category "notebook"
tags:
2024-01-21 16:22:04 +01:00
- 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:
2024-01-17 18:05:55 +01:00
- Generating Hostnames
2024-01-21 16:22:04 +01:00
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
2024-01-17 18:05:55 +01:00
/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'
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
summary: User login
tags:
- Authentication
2024-01-24 11:03:08 +01:00
/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
2024-01-17 18:05:55 +01:00
securityDefinitions:
Bearer:
description: Type "Bearer" followed by a space and JWT token.
in: header
name: Authorization
type: apiKey
swagger: "2.0"