diff --git a/Documentation/api-v1.md b/Documentation/api-v1.md index 996acdfd2..0b5b235d9 100644 --- a/Documentation/api-v1.md +++ b/Documentation/api-v1.md @@ -1,279 +1,305 @@ -# fleet API v1 - -The fleet API allows you to manage the state of the cluster using JSON over HTTP. - -## Managing Units - -Create and modify Unit entities to communicate to fleet the desired state of the cluster. -This simply declares what *should* be happening; the backend system still has to react to the changes in this desired state. -The actual state of the system is communicated with UnitState entities. - -### Unit Entity - -- **name**: (readonly) unique identifier of entity -- **options**: list of UnitOption entities -- **desiredState**: state the user wishes the Unit to be in ("inactive", "loaded", or "launched") -- **currentState**: (readonly) state the Unit is currently in (same possible values as desiredState) -- **machineID**: ID of machine to which the Unit is scheduled - -A UnitOption represents a single option in a systemd unit file. - -- **section**: name of section that contains the option (e.g. "Unit", "Service", "Socket") -- **name**: name of option (e.g. "BindsTo", "After", "ExecStart") -- **value**: value of option (e.g. "/usr/bin/docker run busybox /bin/sleep 1000") - -### Create a Unit - -#### Request - -Create a Unit by passing a partial Unit entity to the /units resource. -The options and desiredState fields are required, and all other Unit fields will be ignored. - -The base request looks like this: - -``` -PUT /units/ HTTP/1.1 - -{"desiredState": , "options": [