Update 'swagger.yaml'
initial swagger definition
This commit is contained in:
104
swagger.yaml
104
swagger.yaml
@@ -1,20 +1,20 @@
|
|||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
info:
|
info:
|
||||||
description: Run export-xlsx in Direktiv
|
description: Transform json input to xlsx spreadsheet
|
||||||
title: export-xlsx
|
title: export-xlsx
|
||||||
version: "1.0"
|
version: "1.0"
|
||||||
x-direktiv-meta:
|
x-direktiv-meta:
|
||||||
container: gcr.io/direktiv/functions/export-xlsx
|
container: registry.coadcorp.com/export-xlsx:1.0
|
||||||
maintainer: |-
|
maintainer: |-
|
||||||
[direktiv.io](https://www.direktiv.io)
|
[nathan.coad@dell.com](nathan.coad@dell.com)
|
||||||
issues: https://github.com/direktiv-apps/export-xlsx/issues
|
issues: https://git.coadcorp.com/nathan/export-xlsx/issues
|
||||||
url: https://github.com/direktiv-apps/export-xlsx
|
url: https://git.coadcorp.com/nathan/export-xls
|
||||||
categories:
|
categories:
|
||||||
- unknown
|
- unknown
|
||||||
license: |-
|
license: |-
|
||||||
[Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
[Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
||||||
long-description: >-
|
long-description: >-
|
||||||
Run export-xlsx in Direktiv as a function
|
Transform json input to excel spreadsheet via json2excel command
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
produces:
|
produces:
|
||||||
@@ -56,52 +56,23 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
files:
|
worksheet-name:
|
||||||
type: array
|
type: string
|
||||||
items:
|
description: Label for the worksheet created in the spreadsheet
|
||||||
$ref: '#/definitions/direktivFile'
|
default: "Sheet1"
|
||||||
description: File to create before running commands.
|
out-filename:
|
||||||
default: []
|
type: string
|
||||||
commands:
|
description: the filename of the output spreadsheet
|
||||||
type: array
|
default: "output.xlsx"
|
||||||
description: Array of commands.
|
|
||||||
items:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
command:
|
|
||||||
type: string
|
|
||||||
description: Command to run
|
|
||||||
silent:
|
|
||||||
type: boolean
|
|
||||||
description: If set to false the command will not print output to logs.
|
|
||||||
default: false
|
|
||||||
print:
|
|
||||||
type: boolean
|
|
||||||
description: If set to false the command will not print the full command with arguments to logs.
|
|
||||||
default: true
|
|
||||||
continue:
|
|
||||||
type: boolean
|
|
||||||
description: Stops excecution if command fails, otherwise proceeds with next command
|
|
||||||
default:
|
|
||||||
- command: echo Hello
|
|
||||||
# direktiv code generation is configured here
|
# direktiv code generation is configured here
|
||||||
x-direktiv-function: |-
|
x-direktiv-function: |-
|
||||||
functions:
|
functions:
|
||||||
- id: export-xlsx
|
- id: export-xlsx
|
||||||
image: gcr.io/direktiv/functions/export-xlsx:1.0
|
image: registry.coadcorp.com/export-xlsx:1.0
|
||||||
type: knative-workflow
|
type: knative-workflow
|
||||||
x-direktiv-examples:
|
x-direktiv-examples:
|
||||||
# ADD MORE EXAMPLES HERE
|
# ADD MORE EXAMPLES HERE
|
||||||
- title: Basic
|
- title: Basic
|
||||||
content: |-
|
|
||||||
- id: export-xlsx
|
|
||||||
type: action
|
|
||||||
action:
|
|
||||||
function: export-xlsx
|
|
||||||
input:
|
|
||||||
commands:
|
|
||||||
- command: Example of running export-xlsx
|
|
||||||
- title: Advanced
|
|
||||||
content: |-
|
content: |-
|
||||||
- id: export-xlsx
|
- id: export-xlsx
|
||||||
type: action
|
type: action
|
||||||
@@ -109,25 +80,25 @@ paths:
|
|||||||
function: export-xlsx
|
function: export-xlsx
|
||||||
input:
|
input:
|
||||||
files:
|
files:
|
||||||
- name: hello.txt
|
- name: input.json
|
||||||
data: Hello World
|
data: |
|
||||||
mode: '0755'
|
jq(.input)
|
||||||
commands:
|
worksheet-name: "TestSpreadsheet"
|
||||||
- command: Example of running export-xlsx
|
out-filename: example.xlsx
|
||||||
x-direktiv-secrets:
|
x-direktiv-secrets:
|
||||||
- name: export-xlsxSecret
|
- name: export-xlsxSecret
|
||||||
description: This is a secret value
|
description: This is a secret value
|
||||||
x-direktiv:
|
x-direktiv:
|
||||||
cmds:
|
cmds:
|
||||||
- action: foreach
|
- action: exec
|
||||||
loop: .Commands
|
exec: /bin/json2excel -inFile input.json -worksheetName "{{ .WorksheetName }}" -outputFilename '{{ .OutFilename }}'
|
||||||
exec: '{{ .Item.Command }}'
|
silent: false
|
||||||
silent: '{{ .Item.Silent }}'
|
print: true
|
||||||
print: '{{ .Item.Print }}'
|
- action: exec
|
||||||
continue: '{{ .Item.Continue }}'
|
exec: base64 -w 0 /tmp/{{ .OutFilename }}
|
||||||
output: |
|
output: |
|
||||||
{
|
{
|
||||||
"export-xlsx": {{ index . 0 | toJson }}
|
"export-excel": {{ (index . 1).result | toJson }}
|
||||||
}
|
}
|
||||||
x-direktiv-errors:
|
x-direktiv-errors:
|
||||||
io.direktiv.command.error: Command execution failed
|
io.direktiv.command.error: Command execution failed
|
||||||
@@ -137,26 +108,13 @@ paths:
|
|||||||
200:
|
200:
|
||||||
description: List of executed commands.
|
description: List of executed commands.
|
||||||
examples:
|
examples:
|
||||||
export-xlsx:
|
export-excel: "JVBERi0xLjUKJdDUxdgKNSAwIG9iago8PAov=="
|
||||||
- result: # EXAMPLE RESULT HERE
|
|
||||||
success: true
|
|
||||||
- result: # EXAMPLE RESULT HERE
|
|
||||||
success: true
|
|
||||||
schema:
|
schema:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
export-xlsx:
|
export-excel:
|
||||||
type: array
|
type: string
|
||||||
items:
|
additionalProperties: {}
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- success
|
|
||||||
- result
|
|
||||||
properties:
|
|
||||||
success:
|
|
||||||
type: boolean
|
|
||||||
result:
|
|
||||||
additionalProperties: {}
|
|
||||||
default:
|
default:
|
||||||
description: generic error response
|
description: generic error response
|
||||||
headers:
|
headers:
|
||||||
|
Reference in New Issue
Block a user