Files
export-xlsx/swagger.yaml
nathan f3e19a8937
Some checks reported errors
continuous-integration/drone/push Build was killed
Update 'swagger.yaml'
2023-02-10 15:49:48 +11:00

144 lines
4.2 KiB
YAML

swagger: "2.0"
info:
description: Transform json input to xlsx spreadsheet
title: export-xlsx
version: "1.0"
x-direktiv-meta:
container: registry.coadcorp.com/export-xlsx:1.0
maintainer: |-
[nathan.coad@dell.com](nathan.coad@dell.com)
issues: https://git.coadcorp.com/nathan/export-xlsx/issues
url: https://git.coadcorp.com/nathan/export-xls
categories:
- unknown
license: |-
[Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
long-description: >-
Transform json input to excel spreadsheet via json2excel command
consumes:
- application/json
produces:
- application/json
schemes:
- http
paths:
/:
delete:
parameters:
- name: Direktiv-ActionID
in: header
type: string
description: |
On cancel Direktiv sends a DELETE request to
the action with id in the header
x-direktiv:
cancel: echo 'cancel {{ .DirektivActionID }}'
responses:
200:
post:
parameters:
- name: Direktiv-ActionID
in: header
type: string
default: development
description: |
direktiv action id is an UUID.
For development it can be set to 'development'
- name: Direktiv-TempDir
in: header
type: string
default: /tmp
description: |
direktiv temp dir is the working directory for that request
For development it can be set to e.g. '/tmp'
- name: body
in: body
schema:
type: object
properties:
worksheet-name:
type: string
description: Label for the worksheet created in the spreadsheet
default: "Sheet1"
out-filename:
type: string
description: the filename of the output spreadsheet
default: "output.xlsx"
# direktiv code generation is configured here
x-direktiv-function: |-
functions:
- id: export-xlsx
image: registry.coadcorp.com/export-xlsx:1.0
type: knative-workflow
x-direktiv-examples:
# ADD MORE EXAMPLES HERE
- title: Basic
content: |-
- id: export-xlsx
type: action
action:
function: export-xlsx
input:
files:
- name: input.json
data: |
jq(.input)
worksheet-name: "TestSpreadsheet"
out-filename: example.xlsx
x-direktiv-secrets:
- name: export-xlsxSecret
description: This is a secret value
x-direktiv:
cmds:
- action: exec
exec: /bin/json2excel -inputJson input.json -worksheetName "{{ .WorksheetName }}" -outputFilename '{{ .OutFilename }}'
silent: false
print: true
- action: exec
exec: base64 -w 0 /tmp/{{ .OutFilename }}
output: |
{
"export-excel": {{ (index . 1).result | toJson }}
}
x-direktiv-errors:
io.direktiv.command.error: Command execution failed
io.direktiv.output.error: Template error for output generation of the service
io.direktiv.ri.error: Can not create information object from request
responses:
200:
description: List of executed commands.
examples:
export-excel: "JVBERi0xLjUKJdDUxdgKNSAwIG9iago8PAov=="
schema:
type: object
properties:
export-excel:
type: string
additionalProperties: {}
default:
description: generic error response
headers:
Direktiv-ErrorCode:
type: string
Direktiv-ErrorMessage:
type: string
schema:
$ref: "#/definitions/error"
definitions:
direktivFile:
type: object
x-go-type:
type: DirektivFile
import:
package: github.com/direktiv/apps/go/pkg/apps
error:
type: object
required:
- errorCode
- errorMessage
properties:
errorCode:
type: string
errorMessage:
type: string