Skip to content

Commit 5e4e02d

Browse files
authored
Merge pull request #95 from dinusha92/master
Updating docs and keys.go with minor improvements
2 parents 42a700f + f7cb2b7 commit 5e4e02d

12 files changed

+345
-23
lines changed

import-export-cli/cmd/keys.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ import (
3232

3333
// keys command related Info
3434
const genKeyCmdLiteral = "get-keys"
35-
const genKeyCmdShortDesc = "Generate keys to invoke the API"
35+
const genKeyCmdShortDesc = "Generate access token to invoke the API"
3636
const genKeyCmdLongDesc = `Generate JWT token to invoke the API by subscribing to a default application for testing purposes`
37-
const genKeyCmdExamples = utils.ProjectName + genKeyCmdLiteral + ` -n TwitterAPI -v 1.0.0 -e dev --provider admin`
37+
const genKeyCmdExamples = utils.ProjectName + " " + genKeyCmdLiteral + ` -n TwitterAPI -v 1.0.0 -e dev --provider admin`
3838

3939
var keyGenEnv string
4040
var apiName string
@@ -603,8 +603,8 @@ func prepScopeValues(scope []string) string {
603603
func init() {
604604
RootCmd.AddCommand(genKeyCmd)
605605
genKeyCmd.Flags().StringVarP(&keyGenEnv, "environment", "e", "", "Key generation environment")
606-
genKeyCmd.Flags().StringVarP(&apiName, "apiName", "n", "", "API to be generated keys")
606+
genKeyCmd.Flags().StringVarP(&apiName, "name", "n", "", "API to be generated keys")
607607
genKeyCmd.Flags().StringVarP(&apiVersion, "version", "v", "", "Version of the API")
608-
genKeyCmd.Flags().StringVarP(&apiProvider, "provider", "p", "", "Provider of the API")
608+
genKeyCmd.Flags().StringVarP(&apiProvider, "provider", "r", "", "Provider of the API")
609609
_ = genKeyCmd.MarkFlagRequired("environment")
610610
}

import-export-cli/cmd/set.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const setCmdExamples = utils.ProjectName + ` ` + setCmdLiteral + ` --http-reques
4343
` + utils.ProjectName + ` ` + setCmdLiteral + ` --http-request-timeout 5000 --export-directory C:\Documents\exported
4444
` + utils.ProjectName + ` ` + setCmdLiteral + ` --http-request-timeout 5000
4545
` + utils.ProjectName + ` ` + setCmdLiteral + ` --mode kubernetes
46-
` + utils.ProjectName + ` ` + setCmdLiteral + ` --mode none`
46+
` + utils.ProjectName + ` ` + setCmdLiteral + ` --mode default`
4747

4848
// SetCmd represents the 'set' command
4949
var SetCmd = &cobra.Command{
@@ -73,7 +73,7 @@ func executeSetCmd(mainConfigFilePath, exportDirectory string) {
7373
if flagKubernetesMode != "" {
7474
if strings.EqualFold(flagKubernetesMode, "kubernetes") || strings.EqualFold(flagKubernetesMode, "k8s") {
7575
configVars.Config.KubernetesMode = true
76-
} else if strings.EqualFold(flagKubernetesMode, "none") {
76+
} else if strings.EqualFold(flagKubernetesMode, "default") {
7777
configVars.Config.KubernetesMode = false
7878
} else {
7979
utils.HandleErrorAndExit("Error changing mode ",

import-export-cli/docs/apimcli.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ CLI for Importing and Exporting APIs and Applications
88
apimcli is a Command Line Tool for Importing and Exporting APIs and Applications between different environments of WSO2 API Manager
99
(Dev, Production, Staging, QA etc.)
1010

11+
```
12+
apimcli [flags]
13+
```
14+
1115
### Options
1216

1317
```
@@ -17,18 +21,20 @@ apimcli is a Command Line Tool for Importing and Exporting APIs and Applications
1721
```
1822

1923
### SEE ALSO
24+
* [apimcli add](apimcli_add.md) - Add an API to the kubernetes cluster
2025
* [apimcli add-env](apimcli_add-env.md) - Add Environment to Config file
2126
* [apimcli export-api](apimcli_export-api.md) - Export API
2227
* [apimcli export-apis](apimcli_export-apis.md) - Export APIs for migration
2328
* [apimcli export-app](apimcli_export-app.md) - Export App
29+
* [apimcli get-keys](apimcli_get-keys.md) - Generate access token to invoke the API
2430
* [apimcli import-api](apimcli_import-api.md) - Import API
2531
* [apimcli import-app](apimcli_import-app.md) - Import App
26-
* [apimcli get-keys](apimcli_get-keys.md) - Generate access token
2732
* [apimcli init](apimcli_init.md) - Initialize a new project in given path
2833
* [apimcli list](apimcli_list.md) - List APIs/Applications in an environment or List the environments
2934
* [apimcli login](apimcli_login.md) - Login to an API Manager
3035
* [apimcli logout](apimcli_logout.md) - Logout to from an API Manager
3136
* [apimcli remove-env](apimcli_remove-env.md) - Remove Environment from Config file
3237
* [apimcli set](apimcli_set.md) - Set configuration
38+
* [apimcli update](apimcli_update.md) - Update an API to the kubernetes cluster
3339
* [apimcli version](apimcli_version.md) - Display Version on current apimcli
3440

import-export-cli/docs/apimcli_add.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## apimcli add
2+
3+
Add an API to the kubernetes cluster
4+
5+
### Synopsis
6+
7+
8+
Add an API from a Swagger file to the kubernetes cluster. JSON and YAML formats are accepted.
9+
To execute kubernetes commands set mode to Kubernetes
10+
11+
### Examples
12+
13+
```
14+
apimcli add api -n petstore --from-file=./Swagger.json --replicas=1 --namespace=wso2
15+
16+
apimcli add api -n petstore --from-file=./product-apim-tooling/import-export-cli/build/target/apimcli/myapi --replicas=1 --namespace=wso2
17+
```
18+
19+
### Options
20+
21+
```
22+
-h, --help help for add
23+
```
24+
25+
### Options inherited from parent commands
26+
27+
```
28+
-k, --insecure Allow connections to SSL endpoints without certs
29+
--verbose Enable verbose mode
30+
```
31+
32+
### SEE ALSO
33+
* [apimcli](apimcli.md) - CLI for Importing and Exporting APIs and Applications
34+
* [apimcli add api](apimcli_add_api.md) - handle APIs in kubernetes cluster
35+
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## apimcli add api
2+
3+
handle APIs in kubernetes cluster
4+
5+
### Synopsis
6+
7+
8+
Add, Update and Delete APIs in kubernetes cluster. JSON and YAML formats are accepted.
9+
available modes are as follows
10+
* kubernetes
11+
12+
```
13+
apimcli add api [flags]
14+
```
15+
16+
### Examples
17+
18+
```
19+
apimcli add/update api -n petstore --from-file=./Swagger.json --replicas=3 --namespace=wso2
20+
```
21+
22+
### Options
23+
24+
```
25+
-f, --from-file string Path to swagger file
26+
-h, --help help for api
27+
-n, --name string Name of the API
28+
--namespace string namespace of API
29+
--replicas int replica set (default 1)
30+
```
31+
32+
### Options inherited from parent commands
33+
34+
```
35+
-k, --insecure Allow connections to SSL endpoints without certs
36+
--verbose Enable verbose mode
37+
```
38+
39+
### SEE ALSO
40+
* [apimcli add](apimcli_add.md) - Add an API to the kubernetes cluster
41+

import-export-cli/docs/apimcli_get-keys.md

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
## apimcli get-keys
22

3-
Generate access token
3+
Generate access token to invoke the API
44

55
### Synopsis
66

77

8-
Get API subscribed to a default application and generate access token
8+
Generate JWT token to invoke the API by subscribing to a default application for testing purposes
99

1010
```
11-
apimcli get-keys (--name <name-of-the-api> --version <version-of-the-api> --environment <environment-from-which-the-api-should-be-exported> --provider <API provider name>) [flags]
11+
apimcli get-keys [flags]
1212
```
1313

1414
### Examples
1515

1616
```
1717
apimcli get-keys -n TwitterAPI -v 1.0.0 -e dev --provider admin
18-
apimcli get-keys -n FacebookAPI -v 2.1.0 -e production --provider admin
19-
NOTE: all three flags (--name (-n), --version (-v), --provider (-r)) are mandatory
2018
```
2119

2220
### Options
2321

2422
```
25-
-e, --environment string Environment to which the API should be exported
26-
-h, --help help for export-api
27-
-n, --name string Name of the API to be exported
28-
--provider string Provider of the API
29-
-v, --version string Version of the API to be exported
23+
-e, --environment string Key generation environment
24+
-h, --help help for get-keys
25+
-n, --name string API to be generated keys
26+
-r, --provider string Provider of the API
27+
-v, --version string Version of the API
3028
```
3129

3230
### Options inherited from parent commands

import-export-cli/docs/apimcli_list_apis.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ apimcli list apis [flags]
1414
### Examples
1515

1616
```
17-
apimcli list apis -e dev
18-
apimcli list apis -e dev -q version:1.0.0
19-
apimcli list apis -e prod -q provider:admin
20-
apimcli list apis-e staging
17+
apimcli apis list -e dev
18+
apimcli apis list -e dev -q version:1.0.0
19+
apimcli apis list -e prod -q provider:admin
20+
apimcli apis list -e staging
2121
```
2222

2323
### Options

import-export-cli/docs/apimcli_set.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Set configuration
88
Set configuration parameters. Use at least one of the following flags
99
* --http-request-timeout <time-in-milli-seconds>
1010
* --export-directory <path-to-directory-where-apis-should-be-saved>
11+
* --mode <mode-of-apimcli>
1112

1213
```
1314
apimcli set [flags]
@@ -19,14 +20,17 @@ apimcli set [flags]
1920
apimcli set --http-request-timeout 3600 --export-directory /home/user/exported-apis
2021
apimcli set --http-request-timeout 5000 --export-directory C:\Documents\exported
2122
apimcli set --http-request-timeout 5000
23+
apimcli set --mode kubernetes
24+
apimcli set --mode default
2225
```
2326

2427
### Options
2528

2629
```
27-
--export-directory string Path to directory where APIs should be saved (default "/home/kasun/.wso2apimcli/exported")
30+
--export-directory string Path to directory where APIs should be saved (default "/home/dinusha/.wso2apimcli/exported")
2831
-h, --help help for set
2932
--http-request-timeout int Timeout for HTTP Client (default 10000)
33+
-m, --mode string mode of apimcli
3034
```
3135

3236
### Options inherited from parent commands
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## apimcli update
2+
3+
Update an API to the kubernetes cluster
4+
5+
### Synopsis
6+
7+
8+
Update an existing API with Swagger file in the kubernetes cluster. JSON and YAML formats are accepted.
9+
10+
### Examples
11+
12+
```
13+
apimcli update api -n petstore --from-file=./Swagger.json --replicas=1 --namespace=wso2
14+
15+
apimcli update api -n petstore --from-file=./product-apim-tooling/import-export-cli/build/target/apimcli/myapi --replicas=1 --namespace=wso2
16+
```
17+
18+
### Options
19+
20+
```
21+
-h, --help help for update
22+
```
23+
24+
### Options inherited from parent commands
25+
26+
```
27+
-k, --insecure Allow connections to SSL endpoints without certs
28+
--verbose Enable verbose mode
29+
```
30+
31+
### SEE ALSO
32+
* [apimcli](apimcli.md) - CLI for Importing and Exporting APIs and Applications
33+
* [apimcli update api](apimcli_update_api.md) - handle APIs in kubernetes cluster
34+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## apimcli update api
2+
3+
handle APIs in kubernetes cluster
4+
5+
### Synopsis
6+
7+
8+
Add, Update and Delete APIs in kubernetes cluster. JSON and YAML formats are accepted.
9+
available modes are as follows
10+
* kubernetes
11+
12+
```
13+
apimcli update api [flags]
14+
```
15+
16+
### Examples
17+
18+
```
19+
apimcli add/update api -n petstore --from-file=./Swagger.json --replicas=3 --namespace=wso2
20+
```
21+
22+
### Options
23+
24+
```
25+
-f, --from-file string Path to swagger file
26+
-h, --help help for api
27+
-n, --name string Name of the API
28+
--namespace string namespace of API
29+
--replicas int replica set (default 1)
30+
```
31+
32+
### Options inherited from parent commands
33+
34+
```
35+
-k, --insecure Allow connections to SSL endpoints without certs
36+
--verbose Enable verbose mode
37+
```
38+
39+
### SEE ALSO
40+
* [apimcli update](apimcli_update.md) - Update an API to the kubernetes cluster
41+

0 commit comments

Comments
 (0)