This commit is contained in:
@@ -24,9 +24,6 @@ type PostParamsBody struct {
|
|||||||
// File to create before running commands.
|
// File to create before running commands.
|
||||||
Files []apps.DirektivFile `json:"files"`
|
Files []apps.DirektivFile `json:"files"`
|
||||||
|
|
||||||
// json input to convert to spreadsheet
|
|
||||||
InData interface{} `json:"in-data,omitempty"`
|
|
||||||
|
|
||||||
// Name of the json input file to utilise
|
// Name of the json input file to utilise
|
||||||
Infile string `json:"infile,omitempty"`
|
Infile string `json:"infile,omitempty"`
|
||||||
|
|
||||||
|
@@ -80,10 +80,6 @@ func init() {
|
|||||||
"$ref": "#/definitions/direktivFile"
|
"$ref": "#/definitions/direktivFile"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"in-data": {
|
|
||||||
"description": "json input to convert to spreadsheet",
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"infile": {
|
"infile": {
|
||||||
"description": "Name of the json input file to utilise",
|
"description": "Name of the json input file to utilise",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -156,11 +152,11 @@ func init() {
|
|||||||
"x-direktiv-examples": [
|
"x-direktiv-examples": [
|
||||||
{
|
{
|
||||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
|
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
|
||||||
"title": "Rely on Direktiv to create input file"
|
"title": "Basic"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx\n in-data: jq(.array | tostring) ",
|
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.array | {input: . } | tostring ) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx ",
|
||||||
"title": "Use function to create input file"
|
"title": "Use jq to add a parent key 'input' containing array of objects"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"x-direktiv-function": "functions:\n- id: export-xlsx\n image: registry.coadcorp.com/export-xlsx:1.0\n type: knative-workflow",
|
"x-direktiv-function": "functions:\n- id: export-xlsx\n image: registry.coadcorp.com/export-xlsx:1.0\n type: knative-workflow",
|
||||||
@@ -319,11 +315,11 @@ func init() {
|
|||||||
"x-direktiv-examples": [
|
"x-direktiv-examples": [
|
||||||
{
|
{
|
||||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
|
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
|
||||||
"title": "Rely on Direktiv to create input file"
|
"title": "Basic"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx\n in-data: jq(.array | tostring) ",
|
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.array | {input: . } | tostring ) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx ",
|
||||||
"title": "Use function to create input file"
|
"title": "Use jq to add a parent key 'input' containing array of objects"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"x-direktiv-function": "functions:\n- id: export-xlsx\n image: registry.coadcorp.com/export-xlsx:1.0\n type: knative-workflow",
|
"x-direktiv-function": "functions:\n- id: export-xlsx\n image: registry.coadcorp.com/export-xlsx:1.0\n type: knative-workflow",
|
||||||
@@ -404,10 +400,6 @@ func init() {
|
|||||||
"$ref": "#/definitions/direktivFile"
|
"$ref": "#/definitions/direktivFile"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"in-data": {
|
|
||||||
"description": "json input to convert to spreadsheet",
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"infile": {
|
"infile": {
|
||||||
"description": "Name of the json input file to utilise",
|
"description": "Name of the json input file to utilise",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
14
readme.md
14
readme.md
@@ -24,7 +24,7 @@ functions:
|
|||||||
image: registry.coadcorp.com/export-xlsx:1.0
|
image: registry.coadcorp.com/export-xlsx:1.0
|
||||||
type: knative-workflow
|
type: knative-workflow
|
||||||
```
|
```
|
||||||
#### Rely on Direktiv to create input file
|
#### Basic
|
||||||
```yaml
|
```yaml
|
||||||
- id: export-xlsx
|
- id: export-xlsx
|
||||||
type: action
|
type: action
|
||||||
@@ -38,16 +38,19 @@ functions:
|
|||||||
worksheet-name: "TestSpreadsheet"
|
worksheet-name: "TestSpreadsheet"
|
||||||
out-filename: example.xlsx
|
out-filename: example.xlsx
|
||||||
```
|
```
|
||||||
#### Use function to create input file
|
#### Use jq to add a parent key 'input' containing array of objects
|
||||||
```yaml
|
```yaml
|
||||||
- id: export-xlsx
|
- id: export-xlsx
|
||||||
type: action
|
type: action
|
||||||
action:
|
action:
|
||||||
function: export-xlsx
|
function: export-xlsx
|
||||||
input:
|
input:
|
||||||
|
files:
|
||||||
|
- name: input.json
|
||||||
|
data: |
|
||||||
|
jq(.array | {input: . } | tostring )
|
||||||
worksheet-name: "TestSpreadsheet"
|
worksheet-name: "TestSpreadsheet"
|
||||||
out-filename: example.xlsx
|
out-filename: example.xlsx
|
||||||
in-data: jq(.array | tostring)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Secrets
|
### Secrets
|
||||||
@@ -113,7 +116,6 @@ functions:
|
|||||||
| Name | Type | Go type | Required | Default | Description | Example |
|
| Name | Type | Go type | Required | Default | Description | Example |
|
||||||
|------|------|---------|:--------:| ------- |-------------|---------|
|
|------|------|---------|:--------:| ------- |-------------|---------|
|
||||||
| files | [][DirektivFile](#direktiv-file)| `[]apps.DirektivFile` | | | File to create before running commands. | |
|
| files | [][DirektivFile](#direktiv-file)| `[]apps.DirektivFile` | | | File to create before running commands. | |
|
||||||
| in-data | [interface{}](#interface)| `interface{}` | | | json input to convert to spreadsheet | |
|
|
||||||
| infile | string| `string` | | | Name of the json input file to utilise | |
|
| infile | string| `string` | | | Name of the json input file to utilise | |
|
||||||
| out-filename | string| `string` | ✓ | `"output.xlsx"`| the filename of the output spreadsheet | |
|
| out-filename | string| `string` | ✓ | `"output.xlsx"`| the filename of the output spreadsheet | |
|
||||||
| worksheet-name | string| `string` | ✓ | `"Sheet1"`| Label for the worksheet created in the spreadsheet | |
|
| worksheet-name | string| `string` | ✓ | `"Sheet1"`| Label for the worksheet created in the spreadsheet | |
|
||||||
|
@@ -20,6 +20,8 @@ states:
|
|||||||
action:
|
action:
|
||||||
function: export-xlsx
|
function: export-xlsx
|
||||||
input:
|
input:
|
||||||
in-data: jq(.array | tostring)
|
files:
|
||||||
|
- data: "jq(.array | {input: . } | tostring ) \n"
|
||||||
|
name: input.json
|
||||||
out-filename: example.xlsx
|
out-filename: example.xlsx
|
||||||
worksheet-name: TestSpreadsheet
|
worksheet-name: TestSpreadsheet
|
||||||
|
Reference in New Issue
Block a user