Documentation Communication - API Routes

class motey.communication.api_routes.capabilities.Capabilities[source]

This REST API endpoint for capability handling. A capability is basically a capability for the whole node. New capabilities can be added or deleted via this endpoint or a list with the existing ones can be fetched.

delete()[source]

Remove a list of capabilities or at least a single one from the node. The content type of the request must be application/json, otherwise the request will fail.

Returns:201 - Created if at least one capability was removed, 304 - Not Modified if non of the sent capabilities was removed because they don not exists or 400 - Bad Request if the wrong content type was sent or the json does not match the motey.models.schemas.capability_schema.
get()[source]

Returns a list off all existing capabilities of this node.

Returns:a JSON object with all the existing capabilities of this node
put()[source]

Add a list of new capabilities or at least a single one to the node. The content type of the request must be application/json, otherwise the request will fail.

Returns:201 - Created if at least one capability was added, 304 - Not Modified if non of the sent capabilities was added or 400 - Bad Request if the wrong content type was sent or the json does not match the motey.models.schemas.capability_schema.
class motey.communication.api_routes.nodestatus.NodeStatus[source]

Give information about the current hardware usage of the node. This includes the cpu, memory and disk usage.

get()[source]

Returns the currant hardware usage of the node.

Returns:a json object with the current hardware usage of the node.
get_average_cpu(loops=5)[source]

Helper method to get an average cpu usage.

Parameters:loops – the number of iterations to sum up the avarage cpu usage.
Returns:The avarage cpu usage as a float.
class motey.communication.api_routes.service.Service[source]

This REST API endpoint for getting service informations and also let the client upload a YAML file to the node. A service contain all the running images.

delete()[source]

DELETE endpoint. Receive the YAMl file and validates them. The content type of the request must be application/x-yaml, otherwiese the request will end up in a HTTP status code 400 - Bad Request. If validation was successful the given service will be terminated by the InterNodeOrchestrator.

Returns:HTTP status code 201 - Created, if the request is successful, otherwise 400 - Bad Request.
get()[source]

Returns a list off all existing capabilities of this node.

Returns:a JSON object with all the existing capabilities of this node
post()[source]

POST endpoint. Receive the YAMl file and validates them. The content type of the request must be application/x-yaml, otherwiese the request will end up in a HTTP status code 400 - Bad Request. If validation was successful the given service will be instantiate by the InterNodeOrchestrator.

Returns:HTTP status code 201 - Created, if the request is successful, otherwise 400 - Bad Request.