From df76e9c2afc93682c946be05b70bd40a927553d0 Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Fri, 9 Nov 2018 16:22:37 +0100 Subject: [PATCH] Add real examples to swagger spec --- website/content/swagger.yaml | 73 +++++++++++++++--------------------- 1 file changed, 31 insertions(+), 42 deletions(-) diff --git a/website/content/swagger.yaml b/website/content/swagger.yaml index f92b3b6e2..919a16499 100644 --- a/website/content/swagger.yaml +++ b/website/content/swagger.yaml @@ -8,7 +8,7 @@ produces: schemes: - http info: - version: 0.10.0 + version: 0.11.2 title: Dkron REST API description: | You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. @@ -208,22 +208,27 @@ definitions: type: string description: "Name for the job." readOnly: false + example: "job1" schedule: type: string description: "Cron expression for the job." readOnly: false + example: "@every 10s" timezone: type: string description: "Timezone where the job will be executed. By default and when field is set to empty string, the job will run in local time." readOnly: false + example: "Europe/Berlin" owner: type: string description: "Owner of the job" readOnly: false + example: "Platform Team" owner_email: type: string description: "Email of the owner" readOnly: false + example: "platform@example.com" success_count: type: integer description: "Number of successful executions" @@ -252,6 +257,8 @@ definitions: additionalProperties: type: string readOnly: false + example: + dkron_server: "true" retries: type: integer description: "Number of times to retry a failed job execution" @@ -282,6 +289,7 @@ definitions: type: string description: "Executor plugin used to run the job" readOnly: false + example: "shell" executor_config: $ref: '#/definitions/executor_config' readOnly: false @@ -292,38 +300,51 @@ definitions: Name: type: string description: "Node name" + example: "dkron1" Addr: type: string description: "IP Address" + example: "192.168.1.137" Port: type: integer description: "Port number" + example: 8946 Tags: type: object description: "Tags asociated with this node" additionalProperties: type: string + example: + dkron_rpc_addr: "192.168.1.137:6868" + dkron_server: "true" + dkron_version": "1.0.0" Status: type: integer description: "The serf status of the node see: https://godoc.org/github.com/hashicorp/serf/serf#MemberStatus" + example: 1 ProtocolMin: type: integer description: "Serf protocol minimum version this node can understand or speak" + example: 5 ProtocolMax: type: integer description: "Serf protocol maximum version this node can understand or speak" + example: 2 ProtocolCur: type: integer description: "Serf protocol current version this node can understand or speak" + example: 2 DelegateMin: type: integer description: "Serf delegate protocol minimum version this node can understand or speak" DelegateMax: type: integer description: "Serf delegate protocol maximum version this node can understand or speak" + example: 5 DelegateCur: type: integer description: "Serf delegate protocol current version this node can understand or speak" + example: 4 execution: type: object description: An execution represents a timed job run. @@ -331,6 +352,7 @@ definitions: job_name: type: string description: "job name" + example: "job_1" started_at: type: string format: date-time @@ -345,9 +367,11 @@ definitions: output: type: string description: "partial output of the command execution" + example: "Hello from Dkron" node_name: type: string description: "name of the node that executed the command" + example: "dkron1" processors: type: object @@ -356,49 +380,14 @@ definitions: type: object additionalProperties: type: string - - processor_files: - type: object - description: Files processor save execution output to disk files. - properties: - forward: - description: Forward the output to the next processor - type: boolean - log_dir: - type: string - - processor_log: - type: object - description: Log processor saves executions output to the dkron log - properties: - forward: - description: Forward the output to the next processor - type: boolean - - processor_syslog: - type: object - description: Syslog processor route execution output to syslog - properties: - forward: - description: Forward the output to the next processor - type: boolean - + example: + files: + forward: true + executor_config: type: object description: Executor plugin parameters additionalProperties: type: string - - executor_shell: - type: object - description: Shell executor runs a command in shell - properties: - command: - description: Command to run - type: string - env: - description: Comma separated environment variables pair - example: FOO=bar - type: string - shell: - type: boolean + example: + command: "echo 'Hello from Dkron'"