first commit

This commit is contained in:
Nathan Coad
2023-02-10 14:56:47 +11:00
commit d35934bff6
4 changed files with 416 additions and 0 deletions

185
swagger.yaml Normal file
View File

@@ -0,0 +1,185 @@
swagger: "2.0"
info:
description: Run export-xlsx in Direktiv
title: export-xlsx
version: "1.0"
x-direktiv-meta:
container: gcr.io/direktiv/functions/export-xlsx
maintainer: |-
[direktiv.io](https://www.direktiv.io)
issues: https://github.com/direktiv-apps/export-xlsx/issues
url: https://github.com/direktiv-apps/export-xlsx
categories:
- unknown
license: |-
[Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
long-description: >-
Run export-xlsx in Direktiv as a function
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:
files:
type: array
items:
$ref: '#/definitions/direktivFile'
description: File to create before running commands.
default: []
commands:
type: array
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
x-direktiv-function: |-
functions:
- id: export-xlsx
image: gcr.io/direktiv/functions/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:
commands:
- command: Example of running export-xlsx
- title: Advanced
content: |-
- id: export-xlsx
type: action
action:
function: export-xlsx
input:
files:
- name: hello.txt
data: Hello World
mode: '0755'
commands:
- command: Example of running export-xlsx
x-direktiv-secrets:
- name: export-xlsxSecret
description: This is a secret value
x-direktiv:
cmds:
- action: foreach
loop: .Commands
exec: '{{ .Item.Command }}'
silent: '{{ .Item.Silent }}'
print: '{{ .Item.Print }}'
continue: '{{ .Item.Continue }}'
output: |
{
"export-xlsx": {{ index . 0 | 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-xlsx:
- result: # EXAMPLE RESULT HERE
success: true
- result: # EXAMPLE RESULT HERE
success: true
schema:
type: object
properties:
export-xlsx:
type: array
items:
type: object
required:
- success
- result
properties:
success:
type: boolean
result:
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