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: # - out-filename properties: out-filename: type: string description: the filename of the output spreadsheet default: "output.xlsx" sheets: type: array description: Array of worksheets to create in spreadsheet items: type: object properties: name: type: string description: Label for the worksheet created in the spreadsheet default: "Sheet1" infile: type: string description: Name of the json input file to utilise input-file: type: array items: $ref: '#/definitions/direktivFile' description: File to create before running commands default: [] # 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: out-filename: example.xlsx sheets: - name: "TestSpreadsheet" input-file: - name: input.json data: | jq(.input) - title: Use jq to add a parent key 'input' containing array of objects content: |- - id: export-xlsx type: action action: function: export-xlsx input: out-filename: example.xlsx sheets: - name: "TestSpreadsheet" input-file: - name: input.json data: | jq(.array | {input: . } | tostring ) x-direktiv-secrets: - name: export-xlsxSecret description: This is a secret value x-direktiv: cmds: - action: foreach loop: .Sheets #exec: /bin/json2excel -inputJson {{- if eq (deref .Infile) "" }} "input.json" {{- else }} {{ .Infile }} {{- end }} -worksheetName "{{ .WorksheetName }}" -outputFilename '{{ .OutFilename }}' exec: /bin/json2excel -inputJson {{- if eq (deref .Item.Infile) "" }} "input.json" {{- else }} {{ .Item.Infile }} {{- end }} -worksheetName "{{ .Item.Name }}" -outputFilename '{{ .Body.OutFilename }}' #exec: ls -la /bin && echo "test" > {{ .Body.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