Skip to content

Commit

Permalink
readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickcping committed Sep 4, 2024
1 parent decfdd7 commit c59c498
Showing 1 changed file with 94 additions and 17 deletions.
111 changes: 94 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,27 @@ The `--export-file-path` / `-e` parameter can be used to specify the path locati
Examples:

```shell
dvtf-pingctl generate --export-file-path /path/to/my/export.json
dvtf-pingctl generate -e /path/to/my/export.json
dvtf-pingctl generate --export-file-path /path/to/my/main_flow_export.json --export-file-path /path/to/my/sub_flow_export.json
dvtf-pingctl generate -e /path/to/my/main_flow_export.json -e /path/to/my/sub_flow_export.json
dvtf-pingctl validate --export-file-path /path/to/my/export.json --export-file-path /path/to/my/sub_flow_export.json
dvtf-pingctl generate \
--export-file-path /path/to/my/export.json
```
```shell
dvtf-pingctl generate \
-e /path/to/my/export.json
```
```shell
dvtf-pingctl generate \
--export-file-path /path/to/my/main_flow_export.json \
--export-file-path /path/to/my/sub_flow_export.json
```
```shell
dvtf-pingctl generate \
-e /path/to/my/main_flow_export.json \
-e /path/to/my/sub_flow_export.json
```
```shell
dvtf-pingctl validate \
--export-file-path /path/to/my/export.json \
--export-file-path /path/to/my/sub_flow_export.json
```

### Providing the Export JSON through Pipe
Expand All @@ -65,7 +81,11 @@ Examples:

```shell
cat /path/to/my/export.json | dvtf-pingctl generate
```
```shell
jq '.name = "abcde"' ./path/to/my/export.json | dvtf-pingctl generate
```
```shell
jq '.name = "abcde"' ./path/to/my/export.json | dvtf-pingctl validate
```

Expand All @@ -82,16 +102,34 @@ If the output directory already exists and the `--overwrite` parameter is not se
Examples:

```shell
dvtf-pingctl generate --export-file-path /path/to/my/export.json -o ./my/output/dir
dvtf-pingctl generate -e /path/to/my/export.json -o ./my/output/dir
dvtf-pingctl generate --export-file-path /path/to/my/export.json -o ./my/output/dir --overwrite
dvtf-pingctl generate -e /path/to/my/export.json -o ./my/output/dir --overwrite
dvtf-pingctl generate \
--export-file-path /path/to/my/export.json \
-o ./my/output/dir
```
```shell
dvtf-pingctl generate \
-e /path/to/my/export.json \
-o ./my/output/dir
```
```shell
dvtf-pingctl generate \
--export-file-path /path/to/my/export.json \
-o ./my/output/dir \
--overwrite
```
```shell
dvtf-pingctl generate \
-e /path/to/my/export.json \
-o ./my/output/dir \
--overwrite
```

Examples where the JSON payload is provided via pipe:

```shell
cat /path/to/my/export.json | dvtf-pingctl generate -o ./my/output/dir
```
```shell
cat /path/to/my/export.json | dvtf-pingctl generate -o ./my/output/dir --overwrite
```

Expand All @@ -104,17 +142,31 @@ Individual resources can be selected for generation using the `--resource` flag
Examples where the JSON is provided as a parameter:

```shell
dvtf-pingctl generate --export-file-path /path/to/my/export.json -o ./my/output/dir
dvtf-pingctl generate -e /path/to/my/export.json -o ./my/output/dir
dvtf-pingctl generate --export-file-path /path/to/my/export.json -o ./my/output/dir --resource davinci_flow --resource davinci_variable --resource davinci_connector
dvtf-pingctl generate -e /path/to/my/export.json -o ./my/output/dir -r davinci_flow -r davinci_variable -r davinci_connector
dvtf-pingctl generate \
--export-file-path /path/to/my/export.json \
-o ./my/output/dir \
--resource davinci_flow \
--resource davinci_variable \
--resource davinci_connector
```
```shell
dvtf-pingctl generate \
-e /path/to/my/export.json \
-o ./my/output/dir \
-r davinci_flow \
-r davinci_variable \
-r davinci_connector
```

Examples where the JSON payload is provided via pipe:

```shell
cat /path/to/my/export.json | dvtf-pingctl generate -o ./my/output/dir
```
```shell
cat /path/to/my/export.json | dvtf-pingctl generate -o ./my/output/dir --resource davinci_flow --resource davinci_variable --resource davinci_connector
```
```shell
cat /path/to/my/export.json | dvtf-pingctl generate -o ./my/output/dir -r davinci_flow -r davinci_variable -r davinci_connector
```

Expand All @@ -127,8 +179,12 @@ The Terraform provider expects single flows only, and this command contains a va
Examples where the JSON is provided as a parameter:

```shell
dvtf-pingctl validate --export-file-path /path/to/my/export.json
dvtf-pingctl validate -e /path/to/my/export.json
dvtf-pingctl validate \
--export-file-path /path/to/my/export.json
```
```shell
dvtf-pingctl validate \
-e /path/to/my/export.json
```

Example where the JSON is provided via pipe:
Expand All @@ -144,14 +200,22 @@ To validate the JSON input for a specific `davinci_flow` field in the case of de
Examples where the JSON is provided as a parameter:

```shell
dvtf-pingctl validate --export-file-path /path/to/my/export.json --field flow_configuration_json
dvtf-pingctl validate -e /path/to/my/export.json -f flow_configuration_json
dvtf-pingctl validate \
--export-file-path /path/to/my/export.json \
--field flow_configuration_json
```
```shell
dvtf-pingctl validate \
-e /path/to/my/export.json \
-f flow_configuration_json
```

Example where the JSON is provided via pipe:

```shell
cat /path/to/my/export.json | dvtf-pingctl validate --field flow_configuration_json
```
```shell
cat /path/to/my/export.json | dvtf-pingctl validate -f flow_configuration_json
```

Expand All @@ -163,6 +227,19 @@ The `dvtf-pingctl validate ...` command will return the following return status
- `1` - Unsuccessful validation
- `2` - Successful validation, with warnings

## Logging

The logging level can be set using the `DVTF_LOG` environment variable. The possible values that can be set are `DEBUG`, `INFO`, `WARN`, `ERROR` and `NOLEVEL`. By default, extra log output is disabled.

A log file can be created using the `DVTF_PATH` environment variable. This redirects the log output to a file of choice. If not set, the debug output will be printed alongside the command output (stdout).

The following example logs debug output to the file called `dvtf.log`:
```shell
DVTF_LOG=DEBUG DVTF_PATH=`pwd`/dvtf.log dvtf-pingctl validate \
--export-file-path /path/to/my/export.json \
--field flow_configuration_json
```

## Configuration File

The parameters described above can be configured in a static configuration file, expected to be named `.dvtf-pingctl.yaml` in the same directory that the CLI tool is run. The following describe the properties that can be set, and an example can be found at [./dvtf-pingctl.yaml.example](./blob/main/.dvtf-pingctl.yaml.example)
Expand Down

0 comments on commit c59c498

Please sign in to comment.