Some checks reported errors
continuous-integration/drone/push Build was killed
put files back into the input schema and adjust command list accordingly
169 lines
5.3 KiB
YAML
169 lines
5.3 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
|
|
required:
|
|
- worksheet-name
|
|
- out-filename
|
|
properties:
|
|
files:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/direktivFile'
|
|
description: File to create before running commands.
|
|
default: []
|
|
infile:
|
|
type: string
|
|
description: Name of the json input file to utilise
|
|
in-data:
|
|
type: object
|
|
description: json input to convert to spreadsheet
|
|
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: Rely on Direktiv to create input file
|
|
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
|
|
- title: Use function to create input file
|
|
content: |-
|
|
- id: export-xlsx
|
|
type: action
|
|
action:
|
|
function: export-xlsx
|
|
input:
|
|
worksheet-name: "TestSpreadsheet"
|
|
out-filename: example.xlsx
|
|
in-data: jq(.array | tostring)
|
|
x-direktiv-secrets:
|
|
- name: export-xlsxSecret
|
|
description: This is a secret value
|
|
x-direktiv:
|
|
cmds:
|
|
- action: exec
|
|
exec: /bin/json2excel -inputJson {{- if eq (deref .Infile) "" }} "input.json" {{- else }} {{ .Infile }} {{- end }} -worksheetName "{{ .WorksheetName }}" -outputFilename '{{ .OutFilename }}'
|
|
silent: false
|
|
print: true
|
|
- action: exec
|
|
exec: base64 -w 0 {{ .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: '{"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
|