Initial commit
This commit is contained in:
		
							
								
								
									
										356
									
								
								docs/docs.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										356
									
								
								docs/docs.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,356 @@
 | 
			
		||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
 | 
			
		||||
package docs
 | 
			
		||||
 | 
			
		||||
import "github.com/swaggo/swag"
 | 
			
		||||
 | 
			
		||||
const docTemplate = `{
 | 
			
		||||
    "schemes": {{ marshal .Schemes }},
 | 
			
		||||
    "swagger": "2.0",
 | 
			
		||||
    "info": {
 | 
			
		||||
        "description": "{{escape .Description}}",
 | 
			
		||||
        "title": "{{.Title}}",
 | 
			
		||||
        "contact": {
 | 
			
		||||
            "name": "Florian Beisel",
 | 
			
		||||
            "url": "http://git.beisel.it/florian",
 | 
			
		||||
            "email": "florian@beisel.it"
 | 
			
		||||
        },
 | 
			
		||||
        "license": {
 | 
			
		||||
            "name": "MIT",
 | 
			
		||||
            "url": "http://git.beisel.it/florian/hostname-service/"
 | 
			
		||||
        },
 | 
			
		||||
        "version": "{{.Version}}"
 | 
			
		||||
    },
 | 
			
		||||
    "host": "{{.Host}}",
 | 
			
		||||
    "basePath": "{{.BasePath}}",
 | 
			
		||||
    "paths": {
 | 
			
		||||
        "/api/notebook": {
 | 
			
		||||
            "put": {
 | 
			
		||||
                "description": "Generates a new hostname for a notebook based on dynamic rules.",
 | 
			
		||||
                "consumes": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Generating Hostnames"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "Update hostname for category \"notebook\"",
 | 
			
		||||
                "operationId": "update-notebook-hostname",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "description": "Input data to generate hostname",
 | 
			
		||||
                        "name": "body",
 | 
			
		||||
                        "in": "body",
 | 
			
		||||
                        "required": true,
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "$ref": "#/definitions/rules.NotebookRuleInput"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Hostname",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "string"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "post": {
 | 
			
		||||
                "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-notebook-hostname",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "description": "Input data to generate hostname",
 | 
			
		||||
                        "name": "body",
 | 
			
		||||
                        "in": "body",
 | 
			
		||||
                        "required": true,
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "$ref": "#/definitions/rules.NotebookRuleInput"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Hostname",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "string"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "/hello": {
 | 
			
		||||
            "get": {
 | 
			
		||||
                "security": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "Bearer": []
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "description": "Checks whether the user is successfully authenticated",
 | 
			
		||||
                "consumes": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Authentication"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "Check your authentication",
 | 
			
		||||
                "operationId": "hello",
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "OK",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "string"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "/login": {
 | 
			
		||||
            "post": {
 | 
			
		||||
                "description": "Authenticate user and return JWT token",
 | 
			
		||||
                "consumes": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Authentication"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "User login",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "description": "Login Credentials",
 | 
			
		||||
                        "name": "loginCredentials",
 | 
			
		||||
                        "in": "body",
 | 
			
		||||
                        "required": true,
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "$ref": "#/definitions/models.LoginCredentials"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Successfully authenticated, JWT token returned",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "object",
 | 
			
		||||
                            "additionalProperties": {
 | 
			
		||||
                                "type": "string"
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    "400": {
 | 
			
		||||
                        "description": "Invalid request body",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "object",
 | 
			
		||||
                            "additionalProperties": {
 | 
			
		||||
                                "type": "string"
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    "401": {
 | 
			
		||||
                        "description": "Invalid login credentials",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "object",
 | 
			
		||||
                            "additionalProperties": {
 | 
			
		||||
                                "type": "string"
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    "500": {
 | 
			
		||||
                        "description": "Internal server error",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "object",
 | 
			
		||||
                            "additionalProperties": {
 | 
			
		||||
                                "type": "string"
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "/{category}": {
 | 
			
		||||
            "get": {
 | 
			
		||||
                "security": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "Bearer": []
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "description": "List all details for a given category",
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Querying Hostnames"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "Return a list of hosts and their details filtered by category",
 | 
			
		||||
                "operationId": "list-hostnames-by-category",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "type": "string",
 | 
			
		||||
                        "description": "Category of the hostname",
 | 
			
		||||
                        "name": "category",
 | 
			
		||||
                        "in": "path",
 | 
			
		||||
                        "required": true
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Hostname",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "json"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "/{category}/{hostname}": {
 | 
			
		||||
            "get": {
 | 
			
		||||
                "security": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "Bearer": []
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "description": "Return details for a single hostname identified by its category",
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Querying Hostnames"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "Return a single hostname by Category and Name",
 | 
			
		||||
                "operationId": "get-hostname-by-category-and-name",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "type": "string",
 | 
			
		||||
                        "description": "Category of the hostname",
 | 
			
		||||
                        "name": "category",
 | 
			
		||||
                        "in": "path",
 | 
			
		||||
                        "required": true
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "type": "string",
 | 
			
		||||
                        "description": "Category of the hostname",
 | 
			
		||||
                        "name": "hostname",
 | 
			
		||||
                        "in": "path",
 | 
			
		||||
                        "required": true
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Hostname",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "json"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "delete": {
 | 
			
		||||
                "security": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "Bearer": []
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "description": "List all details for a given category",
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Manipulate existing Hostnames"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "Delete a hostname from the database",
 | 
			
		||||
                "operationId": "delete-hostnames-by-category-and-name",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "type": "string",
 | 
			
		||||
                        "description": "Category of the hostname",
 | 
			
		||||
                        "name": "category",
 | 
			
		||||
                        "in": "path",
 | 
			
		||||
                        "required": true
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "type": "string",
 | 
			
		||||
                        "description": "Hostname to delete",
 | 
			
		||||
                        "name": "hostname",
 | 
			
		||||
                        "in": "path",
 | 
			
		||||
                        "required": true
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Hostname",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "json"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "definitions": {
 | 
			
		||||
        "models.LoginCredentials": {
 | 
			
		||||
            "description": "User account information used in the login process with Username and password",
 | 
			
		||||
            "type": "object",
 | 
			
		||||
            "properties": {
 | 
			
		||||
                "password": {
 | 
			
		||||
                    "type": "string"
 | 
			
		||||
                },
 | 
			
		||||
                "username": {
 | 
			
		||||
                    "type": "string"
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "rules.NotebookRuleInput": {
 | 
			
		||||
            "type": "object",
 | 
			
		||||
            "properties": {
 | 
			
		||||
                "Location": {
 | 
			
		||||
                    "type": "string"
 | 
			
		||||
                },
 | 
			
		||||
                "OrgUnit": {
 | 
			
		||||
                    "type": "string"
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "securityDefinitions": {
 | 
			
		||||
        "Bearer": {
 | 
			
		||||
            "description": "Type \"Bearer\" followed by a space and JWT token.",
 | 
			
		||||
            "type": "apiKey",
 | 
			
		||||
            "name": "Authorization",
 | 
			
		||||
            "in": "header"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}`
 | 
			
		||||
 | 
			
		||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
 | 
			
		||||
var SwaggerInfo = &swag.Spec{
 | 
			
		||||
	Version:          "1",
 | 
			
		||||
	Host:             "localhost:8080",
 | 
			
		||||
	BasePath:         "/api/v1",
 | 
			
		||||
	Schemes:          []string{},
 | 
			
		||||
	Title:            "Hostname Service API",
 | 
			
		||||
	Description:      "This is a sample server for a hostname service.",
 | 
			
		||||
	InfoInstanceName: "swagger",
 | 
			
		||||
	SwaggerTemplate:  docTemplate,
 | 
			
		||||
	LeftDelim:        "{{",
 | 
			
		||||
	RightDelim:       "}}",
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										332
									
								
								docs/swagger.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										332
									
								
								docs/swagger.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,332 @@
 | 
			
		||||
{
 | 
			
		||||
    "swagger": "2.0",
 | 
			
		||||
    "info": {
 | 
			
		||||
        "description": "This is a sample server for a hostname service.",
 | 
			
		||||
        "title": "Hostname Service API",
 | 
			
		||||
        "contact": {
 | 
			
		||||
            "name": "Florian Beisel",
 | 
			
		||||
            "url": "http://git.beisel.it/florian",
 | 
			
		||||
            "email": "florian@beisel.it"
 | 
			
		||||
        },
 | 
			
		||||
        "license": {
 | 
			
		||||
            "name": "MIT",
 | 
			
		||||
            "url": "http://git.beisel.it/florian/hostname-service/"
 | 
			
		||||
        },
 | 
			
		||||
        "version": "1"
 | 
			
		||||
    },
 | 
			
		||||
    "host": "localhost:8080",
 | 
			
		||||
    "basePath": "/api/v1",
 | 
			
		||||
    "paths": {
 | 
			
		||||
        "/api/notebook": {
 | 
			
		||||
            "put": {
 | 
			
		||||
                "description": "Generates a new hostname for a notebook based on dynamic rules.",
 | 
			
		||||
                "consumes": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Generating Hostnames"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "Update hostname for category \"notebook\"",
 | 
			
		||||
                "operationId": "update-notebook-hostname",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "description": "Input data to generate hostname",
 | 
			
		||||
                        "name": "body",
 | 
			
		||||
                        "in": "body",
 | 
			
		||||
                        "required": true,
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "$ref": "#/definitions/rules.NotebookRuleInput"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Hostname",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "string"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "post": {
 | 
			
		||||
                "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-notebook-hostname",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "description": "Input data to generate hostname",
 | 
			
		||||
                        "name": "body",
 | 
			
		||||
                        "in": "body",
 | 
			
		||||
                        "required": true,
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "$ref": "#/definitions/rules.NotebookRuleInput"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Hostname",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "string"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "/hello": {
 | 
			
		||||
            "get": {
 | 
			
		||||
                "security": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "Bearer": []
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "description": "Checks whether the user is successfully authenticated",
 | 
			
		||||
                "consumes": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Authentication"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "Check your authentication",
 | 
			
		||||
                "operationId": "hello",
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "OK",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "string"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "/login": {
 | 
			
		||||
            "post": {
 | 
			
		||||
                "description": "Authenticate user and return JWT token",
 | 
			
		||||
                "consumes": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Authentication"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "User login",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "description": "Login Credentials",
 | 
			
		||||
                        "name": "loginCredentials",
 | 
			
		||||
                        "in": "body",
 | 
			
		||||
                        "required": true,
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "$ref": "#/definitions/models.LoginCredentials"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Successfully authenticated, JWT token returned",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "object",
 | 
			
		||||
                            "additionalProperties": {
 | 
			
		||||
                                "type": "string"
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    "400": {
 | 
			
		||||
                        "description": "Invalid request body",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "object",
 | 
			
		||||
                            "additionalProperties": {
 | 
			
		||||
                                "type": "string"
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    "401": {
 | 
			
		||||
                        "description": "Invalid login credentials",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "object",
 | 
			
		||||
                            "additionalProperties": {
 | 
			
		||||
                                "type": "string"
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    "500": {
 | 
			
		||||
                        "description": "Internal server error",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "object",
 | 
			
		||||
                            "additionalProperties": {
 | 
			
		||||
                                "type": "string"
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "/{category}": {
 | 
			
		||||
            "get": {
 | 
			
		||||
                "security": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "Bearer": []
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "description": "List all details for a given category",
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Querying Hostnames"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "Return a list of hosts and their details filtered by category",
 | 
			
		||||
                "operationId": "list-hostnames-by-category",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "type": "string",
 | 
			
		||||
                        "description": "Category of the hostname",
 | 
			
		||||
                        "name": "category",
 | 
			
		||||
                        "in": "path",
 | 
			
		||||
                        "required": true
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Hostname",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "json"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "/{category}/{hostname}": {
 | 
			
		||||
            "get": {
 | 
			
		||||
                "security": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "Bearer": []
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "description": "Return details for a single hostname identified by its category",
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Querying Hostnames"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "Return a single hostname by Category and Name",
 | 
			
		||||
                "operationId": "get-hostname-by-category-and-name",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "type": "string",
 | 
			
		||||
                        "description": "Category of the hostname",
 | 
			
		||||
                        "name": "category",
 | 
			
		||||
                        "in": "path",
 | 
			
		||||
                        "required": true
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "type": "string",
 | 
			
		||||
                        "description": "Category of the hostname",
 | 
			
		||||
                        "name": "hostname",
 | 
			
		||||
                        "in": "path",
 | 
			
		||||
                        "required": true
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Hostname",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "json"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "delete": {
 | 
			
		||||
                "security": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "Bearer": []
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "description": "List all details for a given category",
 | 
			
		||||
                "produces": [
 | 
			
		||||
                    "application/json"
 | 
			
		||||
                ],
 | 
			
		||||
                "tags": [
 | 
			
		||||
                    "Manipulate existing Hostnames"
 | 
			
		||||
                ],
 | 
			
		||||
                "summary": "Delete a hostname from the database",
 | 
			
		||||
                "operationId": "delete-hostnames-by-category-and-name",
 | 
			
		||||
                "parameters": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "type": "string",
 | 
			
		||||
                        "description": "Category of the hostname",
 | 
			
		||||
                        "name": "category",
 | 
			
		||||
                        "in": "path",
 | 
			
		||||
                        "required": true
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "type": "string",
 | 
			
		||||
                        "description": "Hostname to delete",
 | 
			
		||||
                        "name": "hostname",
 | 
			
		||||
                        "in": "path",
 | 
			
		||||
                        "required": true
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                "responses": {
 | 
			
		||||
                    "200": {
 | 
			
		||||
                        "description": "Hostname",
 | 
			
		||||
                        "schema": {
 | 
			
		||||
                            "type": "json"
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "definitions": {
 | 
			
		||||
        "models.LoginCredentials": {
 | 
			
		||||
            "description": "User account information used in the login process with Username and password",
 | 
			
		||||
            "type": "object",
 | 
			
		||||
            "properties": {
 | 
			
		||||
                "password": {
 | 
			
		||||
                    "type": "string"
 | 
			
		||||
                },
 | 
			
		||||
                "username": {
 | 
			
		||||
                    "type": "string"
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "rules.NotebookRuleInput": {
 | 
			
		||||
            "type": "object",
 | 
			
		||||
            "properties": {
 | 
			
		||||
                "Location": {
 | 
			
		||||
                    "type": "string"
 | 
			
		||||
                },
 | 
			
		||||
                "OrgUnit": {
 | 
			
		||||
                    "type": "string"
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "securityDefinitions": {
 | 
			
		||||
        "Bearer": {
 | 
			
		||||
            "description": "Type \"Bearer\" followed by a space and JWT token.",
 | 
			
		||||
            "type": "apiKey",
 | 
			
		||||
            "name": "Authorization",
 | 
			
		||||
            "in": "header"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										218
									
								
								docs/swagger.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										218
									
								
								docs/swagger.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,218 @@
 | 
			
		||||
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"
 | 
			
		||||
		Reference in New Issue
	
	Block a user