Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cli): add examples #1052

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/file_addplugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ order they are given:
}
`,
RunE: executeAddPlugins,
Example: "# adds 2 plugins to all services in a deck file, except if they are already present\n" +
"cat kong.yml | deck file add-plugins --selector='services[*]' plugin1.json plugin2.yml\n" +
"\n" +
"# same, but now overwriting plugins if they already exist\n" +
"cat kong.yml | deck file add-plugins --overwrite --selector='services[*]' plugin1.json plugin2.yml",
Args: cobra.MinimumNArgs(0),
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/file_addtags.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func newAddTagsCmd() *cobra.Command {
The tags are added to all objects that match the selector expressions. If no
selectors are given, all Kong entities are tagged.`,
RunE: executeAddTags,
Example: "# adds tags 'tag1' and 'tag2' to all services in file 'kong.yml'\n" +
"cat kong.yml | deck file add-tags --selector='services[*]' tag1 tag2",
Args: cobra.MinimumNArgs(1),
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/file_listtags.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ func newListTagsCmd() *cobra.Command {
The tags are collected from all objects that match the selector expressions. If no
selectors are given, all Kong entities will be scanned.`,
RunE: executeListTags,
Example: "# list all tags used on services\n" +
"cat kong.yml | deck file list-tags --selector='services[*]'",
Args: cobra.NoArgs,
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/file_merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Doesn't perform any checks on content, e.g. duplicates, or any validations.
If the input files are not compatible, returns an error. Compatibility is
determined by the '_transform' and '_format_version' fields.`,
RunE: executeMerge,
Example: "# Merge 3 files\n" +
"deck file patch -o merged.yaml file1.yaml file2.yaml file3.yaml",
Args: cobra.MinimumNArgs(1),
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/file_openapi2kong.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ The example file at https://github.com/Kong/go-apiops/blob/main/docs/learnservic
has extensive annotations explaining the conversion process, as well as all supported
custom annotations (x-kong-... directives).`,
RunE: executeOpenapi2Kong,
Example: "# Convert an OAS file, adding 2 tags, and namespacing the UUIDs to a unique name\n" +
"cat service_oas.yml | deck file openapi2kong --select-tag=serviceA,teamB --uuid-base=unique-service-name",
Args: cobra.NoArgs,
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/file_patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ If the 'values' object instead is an array, then any arrays returned by the sele
will get the 'values' appended to them.
`,
RunE: executePatch,
Example: "# update the read-timeout on all services\n" +
"cat kong.yml | deck file patch --selector=\"$..services[*]\" --value=\"read_timeout:10000\"",
}

patchCmd.Flags().StringVarP(&cmdPatchInputFilename, "state", "s", "-",
Expand Down
Loading