You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
api/docs/swagger.json

419 lines
13 KiB
JSON

{
"swagger": "2.0",
"info": {
"contact": {}
},
"basePath": "/api/v1",
"paths": {
"/cpus/add_cpu_to_host": {
"post": {
"description": "Create a CPU",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"CPUs"
],
"summary": "Create a CPU",
"parameters": [
{
"description": "The host to create",
"name": "host",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CPU"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/models.CPU"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/cpus/cpus": {
"get": {
"description": "Lists all the CPUs in LSM for every host",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"CPUs"
],
"summary": "Get all CPUs in LSM",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.CPU"
}
}
}
}
}
},
"/hosts/add_host": {
"post": {
"description": "Create a host",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Hosts"
],
"summary": "Create a host",
"parameters": [
{
"description": "The host to create",
"name": "host",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.AddHost"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/models.AddHost"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/hosts/delete_host/{host_id}": {
"delete": {
"description": "Delete a host",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Hosts"
],
"summary": "Delete a host",
"parameters": [
{
"type": "string",
"description": "The ID of the host to be deleted",
"name": "host_id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/hosts/delete_host_by_hostname/{hostname}": {
"delete": {
"description": "Delete a host using it hostname",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Hosts"
],
"summary": "Delete a host using its hostname",
"parameters": [
{
"type": "string",
"description": "The hostname of the host to be deleted",
"name": "hostname",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/hosts/get_host_by_hostname/{hostname}": {
"get": {
"description": "Get a host by hostname",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Hosts"
],
"summary": "Get a host by hostname",
"parameters": [
{
"type": "string",
"description": "The hostname to get the host by",
"name": "hostname",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Host"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/hosts/get_host_id_for_hostname/{hostname}": {
"get": {
"description": "Get a host ID for hostname",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Hosts"
],
"summary": "Get a host ID for hostname",
"parameters": [
{
"type": "string",
"description": "The hostname to get the host ID by",
"name": "hostname",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "integer"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/hosts/hosts": {
"get": {
"description": "Lists all the hosts in LSM",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Hosts"
],
"summary": "Get all hosts in LSM",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Host"
}
}
}
}
}
}
},
"definitions": {
"models.AddHost": {
"type": "object",
"properties": {
"hostname": {
"type": "string"
}
}
},
"models.CPU": {
"type": "object",
"properties": {
"cores": {
"type": "integer"
},
"host_id": {
"type": "integer"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"socket": {
"type": "integer"
},
"time": {
"type": "string"
}
}
},
"models.Error": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"models.Host": {
"type": "object",
"properties": {
"cpus": {
"type": "array",
"items": {
"$ref": "#/definitions/models.CPU"
}
},
"hostname": {
"type": "string"
},
"memory": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Memory"
}
}
}
},
"models.Memory": {
"type": "object",
"properties": {
"host_id": {
"type": "integer"
},
"id": {
"type": "integer"
},
"time": {
"type": "string"
},
"total": {
"type": "integer"
},
"type": {
"type": "string"
},
"usage": {
"type": "number"
},
"used": {
"type": "integer"
}
}
}
}
}