2024-01-17 18:05:55 +01:00
|
|
|
basePath: /api/v1
|
|
|
|
definitions:
|
2024-01-18 00:15:14 +01:00
|
|
|
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:
|
2024-01-18 00:15:14 +01:00
|
|
|
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
|
2024-01-18 00:15:14 +01:00
|
|
|
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":
|
2024-01-18 00:15:14 +01:00
|
|
|
description: An array of responses
|
2024-01-17 18:05:55 +01:00
|
|
|
schema:
|
2024-01-18 00:15:14 +01:00
|
|
|
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:
|
2024-01-18 00:15:14 +01:00
|
|
|
$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":
|
2024-01-18 00:15:14 +01:00
|
|
|
description: A single response object
|
2024-01-17 18:05:55 +01:00
|
|
|
schema:
|
2024-01-18 00:15:14 +01:00
|
|
|
$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:
|
2024-01-18 00:15:14 +01:00
|
|
|
$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:
|
2024-01-18 00:15:14 +01:00
|
|
|
$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/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:
|
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:
|
2024-01-18 00:15:14 +01:00
|
|
|
$ref: '#/definitions/models.TokenResponse'
|
2024-01-17 18:05:55 +01:00
|
|
|
"400":
|
|
|
|
description: Invalid request body
|
|
|
|
schema:
|
2024-01-18 00:15:14 +01:00
|
|
|
$ref: '#/definitions/models.ErrorResponse'
|
2024-01-17 18:05:55 +01:00
|
|
|
"401":
|
|
|
|
description: Invalid login credentials
|
|
|
|
schema:
|
2024-01-18 00:15:14 +01:00
|
|
|
$ref: '#/definitions/models.ErrorResponse'
|
2024-01-17 18:05:55 +01:00
|
|
|
"500":
|
|
|
|
description: Internal server error
|
|
|
|
schema:
|
2024-01-18 00:15:14 +01:00
|
|
|
$ref: '#/definitions/models.ErrorResponse'
|
2024-01-17 18:05:55 +01:00
|
|
|
summary: User login
|
|
|
|
tags:
|
|
|
|
- Authentication
|
|
|
|
securityDefinitions:
|
|
|
|
Bearer:
|
|
|
|
description: Type "Bearer" followed by a space and JWT token.
|
|
|
|
in: header
|
|
|
|
name: Authorization
|
|
|
|
type: apiKey
|
|
|
|
swagger: "2.0"
|