Cluster API¶
Warning
This API is actually in beta. Its interface is likely to change.
This API provides control over a cluster.
Links¶
-
GET
/v1/links?
(category)=&
(name)=
¶ Get the URI links to the multiple applications by category. Current categories are global, monitor and project.
Example response:
[{ "id": "consul-ui", "category": "monitor", "name": "Consul-UI", "href": "http://127.0.0.1:8500" }, { "id": "hashi-ui", "category": "monitor", "name": "Hashi-UI", "href": "http://127.0.0.1:28143" }]
Query Parameters: - category – The links category
- name – The link id in the category
Settings¶
-
GET
/v1/settings
¶ Get the settings in JSON format
-
GET
/v1/settings/default
¶ Get the default settings
-
GET
/v1/schemas/settings.json
¶ Get the settings JSON schemas. This schema is used to validate the settings.
-
POST
/v1/settings
¶ Validate and set the settings. Any missing values is replaced by the default values.
Jobs¶
-
GET
/v1/jobs
¶ Get the list of jobs in the cluster.
Example response:
[{ "name": "web", "status": "running", "taskGroups": [{ "name": "web", "count": 0, "countInit": 1, "countMax": 5, "summary": { "queued": 0, "complete": 0, "failed": 0, "running": 1, "starting": 0, "lost": 0 } }] }]
Request Headers: - waitIndex – (Optional) Used for long polling
Response Headers: - waitIndex – Used for long polling
-
POST
/v1/jobs/start/
(job_id)¶ Start a job.
Parameters: - job_id – The job id
-
POST
/v1/jobs/stop/
(job_id)¶ Stop a job.
Parameters: - job_id – The job id
-
POST
/v1/jobs/updatecounts
¶ Increment or decrement a task group count.
Request JSON Object: - jobID (string) – The job ID
- taskGroup (string) – The task group id
- count (int) – The count delta. 0 will stop the task group.
Logs¶
-
GET
/v1/log/logs
¶ Get the list of logs.
Response JSON Array of Objects: - id (string) – The log ID
- group (string) – The log group
- job (string) – The log job
- task (string) – The task
- fileName (string) – The file name
- logLevel (boolean) – If the process supports log level or not
-
POST
/v1/log/logs
¶ Set the list of logs. All previous logs information are deleted or replaced
Request JSON Array of Objects: - id (string) – The log ID
- group (string) – The log group
- job (string) – The log job
- task (string) – The task
- fileName (string) – The file name
- logLevel (boolean) – If the process supports log level or not
-
GET
/v1/log/meta/
(name)¶ Get the list log meta information
Parameters: - name – The log name
Response JSON Array of Objects: - allocID (string) – The log allocation ID
- status (string) – The task status
- jobName (string) – The job name
- taskName (string) – The task name
- fileName (string) – The file name
- createTime (string) – The creation time of the log
- logLevel (string) – If the process supports log level or not
-
GET
/v1/log/fs/
(alloc)/
(task)/
(fs)¶ Get the log for a task.
Parameters: - alloc – The allocation id
- task – The task group id
- fs – The file system id. Either stdout or stderr
Query Parameters: - origin – The origin of the log. start or end
- offset – The offset from the origin
Loggers¶
The loggers enable setting a log level per logger. The loggers are the name of the log element in the project.
The log level influences the amount of information on a log. The log level can be debug, info, warning, error, fatal or panic.
-
GET
/v1/log/defaults
¶ Get the default loggers configuration
-
POST
/v1/log/defaults/
(loggerID)¶ Set a default logger configuration
Example query:
{ "leaf": "info" }
Parameters: - loggerID – The logger ID
-
GET
/v1/log/allocs/
(allocID)¶ Get the current allocation loggers configuration. An empty value means that the allocation is using the default value. An allocation is an instance of a task.
Parameters: - allocID – The allocation ID
-
POST
/v1/log/allocs/
(allocID)/
(loggerID)¶ Set a allocation loggers configuration.
Example query:
{ "leaf": "debug" }
Parameters: - allocID – The allocation ID
- loggerID – The logger ID
Events¶
-
GET
/v1/events
¶ Get the events definitions and errors.
Response JSON Object: - errors (string) – Errors in the events
Response JSON Array of Objects: - mapreduce (object) – An array of events file contents
-
POST
/v1/events
¶ Update the events contents.
-
GET
/v1/events/results/(counter:[0-9]+)
¶ Get a log of events results. This request can be used in a pull request to show a events log. The log is reset when there are no requests for 5 seconds.
Parameters: - counter – Position of the log
Response JSON Object: - counter – The position at the end of the log
- messages – A list of events results messages
Secrets¶
-
GET
/v1/secrets/list
¶ Get the list of secret keys
Example response:
{ "keys": [ "command", "disco" ] }
-
GET
/secrets/secret/
(ID)¶ Get a secret.
Example response:
{ "GENVID_COMMAND_SECRET": "anothersecret", "akey": "avalue" }
-
POST
/secrets/secret/
(ID)¶ Create or update a secret.
Example request:
{ "GENVID_COMMAND_SECRET": "anothersecret", "akey": "avalue" }
-
DELETE
/secrets/secret/
(ID)¶ Delete a secret.
Example request:
{ "GENVID_COMMAND_SECRET": "anothersecret", "akey": "avalue" }
Secrets¶
-
GET
/v1/secrets/list
¶ Get the list of secret keys
Example response:
{ "keys": [ "command", "disco" ] }
-
GET
/secrets/secret/
(ID)¶ Get a secret.
Example response:
{ "GENVID_COMMAND_SECRET": "anothersecret", "akey": "avalue" }
-
POST
/secrets/secret/
(ID)¶ Create or update a secret.
Example request:
{ "GENVID_COMMAND_SECRET": "anothersecret", "akey": "avalue" }
-
DELETE
/secrets/secret/
(ID)¶ Delete a secret.