219 lines
5.5 KiB
YAML
219 lines
5.5 KiB
YAML
|
basePath: /api/v1
|
||
|
definitions:
|
||
|
models.LoginCredentials:
|
||
|
description: User account information used in the login process with Username
|
||
|
and password
|
||
|
properties:
|
||
|
password:
|
||
|
type: string
|
||
|
username:
|
||
|
type: string
|
||
|
type: object
|
||
|
rules.NotebookRuleInput:
|
||
|
properties:
|
||
|
Location:
|
||
|
type: string
|
||
|
OrgUnit:
|
||
|
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: MIT
|
||
|
url: http://git.beisel.it/florian/hostname-service/
|
||
|
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: Hostname
|
||
|
schema:
|
||
|
type: json
|
||
|
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:
|
||
|
type: json
|
||
|
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: Hostname
|
||
|
schema:
|
||
|
type: json
|
||
|
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:
|
||
|
type: string
|
||
|
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:
|
||
|
type: string
|
||
|
summary: Update hostname for category "notebook"
|
||
|
tags:
|
||
|
- Generating 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:
|
||
|
additionalProperties:
|
||
|
type: string
|
||
|
type: object
|
||
|
"400":
|
||
|
description: Invalid request body
|
||
|
schema:
|
||
|
additionalProperties:
|
||
|
type: string
|
||
|
type: object
|
||
|
"401":
|
||
|
description: Invalid login credentials
|
||
|
schema:
|
||
|
additionalProperties:
|
||
|
type: string
|
||
|
type: object
|
||
|
"500":
|
||
|
description: Internal server error
|
||
|
schema:
|
||
|
additionalProperties:
|
||
|
type: string
|
||
|
type: object
|
||
|
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"
|