Skip to content

Commit

Permalink
Merge pull request #95 from dinusha92/master
Browse files Browse the repository at this point in the history
Updating docs and keys.go with minor improvements
  • Loading branch information
harsha89 authored Sep 20, 2019
2 parents 42a700f + f7cb2b7 commit 5e4e02d
Show file tree
Hide file tree
Showing 12 changed files with 345 additions and 23 deletions.
8 changes: 4 additions & 4 deletions import-export-cli/cmd/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ import (

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

var keyGenEnv string
var apiName string
Expand Down Expand Up @@ -603,8 +603,8 @@ func prepScopeValues(scope []string) string {
func init() {
RootCmd.AddCommand(genKeyCmd)
genKeyCmd.Flags().StringVarP(&keyGenEnv, "environment", "e", "", "Key generation environment")
genKeyCmd.Flags().StringVarP(&apiName, "apiName", "n", "", "API to be generated keys")
genKeyCmd.Flags().StringVarP(&apiName, "name", "n", "", "API to be generated keys")
genKeyCmd.Flags().StringVarP(&apiVersion, "version", "v", "", "Version of the API")
genKeyCmd.Flags().StringVarP(&apiProvider, "provider", "p", "", "Provider of the API")
genKeyCmd.Flags().StringVarP(&apiProvider, "provider", "r", "", "Provider of the API")
_ = genKeyCmd.MarkFlagRequired("environment")
}
4 changes: 2 additions & 2 deletions import-export-cli/cmd/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const setCmdExamples = utils.ProjectName + ` ` + setCmdLiteral + ` --http-reques
` + utils.ProjectName + ` ` + setCmdLiteral + ` --http-request-timeout 5000 --export-directory C:\Documents\exported
` + utils.ProjectName + ` ` + setCmdLiteral + ` --http-request-timeout 5000
` + utils.ProjectName + ` ` + setCmdLiteral + ` --mode kubernetes
` + utils.ProjectName + ` ` + setCmdLiteral + ` --mode none`
` + utils.ProjectName + ` ` + setCmdLiteral + ` --mode default`

// SetCmd represents the 'set' command
var SetCmd = &cobra.Command{
Expand Down Expand Up @@ -73,7 +73,7 @@ func executeSetCmd(mainConfigFilePath, exportDirectory string) {
if flagKubernetesMode != "" {
if strings.EqualFold(flagKubernetesMode, "kubernetes") || strings.EqualFold(flagKubernetesMode, "k8s") {
configVars.Config.KubernetesMode = true
} else if strings.EqualFold(flagKubernetesMode, "none") {
} else if strings.EqualFold(flagKubernetesMode, "default") {
configVars.Config.KubernetesMode = false
} else {
utils.HandleErrorAndExit("Error changing mode ",
Expand Down
8 changes: 7 additions & 1 deletion import-export-cli/docs/apimcli.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ CLI for Importing and Exporting APIs and Applications
apimcli is a Command Line Tool for Importing and Exporting APIs and Applications between different environments of WSO2 API Manager
(Dev, Production, Staging, QA etc.)

```
apimcli [flags]
```

### Options

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

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

35 changes: 35 additions & 0 deletions import-export-cli/docs/apimcli_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## apimcli add

Add an API to the kubernetes cluster

### Synopsis


Add an API from a Swagger file to the kubernetes cluster. JSON and YAML formats are accepted.
To execute kubernetes commands set mode to Kubernetes

### Examples

```
apimcli add api -n petstore --from-file=./Swagger.json --replicas=1 --namespace=wso2
apimcli add api -n petstore --from-file=./product-apim-tooling/import-export-cli/build/target/apimcli/myapi --replicas=1 --namespace=wso2
```

### Options

```
-h, --help help for add
```

### Options inherited from parent commands

```
-k, --insecure Allow connections to SSL endpoints without certs
--verbose Enable verbose mode
```

### SEE ALSO
* [apimcli](apimcli.md) - CLI for Importing and Exporting APIs and Applications
* [apimcli add api](apimcli_add_api.md) - handle APIs in kubernetes cluster

41 changes: 41 additions & 0 deletions import-export-cli/docs/apimcli_add_api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## apimcli add api

handle APIs in kubernetes cluster

### Synopsis


Add, Update and Delete APIs in kubernetes cluster. JSON and YAML formats are accepted.
available modes are as follows
* kubernetes

```
apimcli add api [flags]
```

### Examples

```
apimcli add/update api -n petstore --from-file=./Swagger.json --replicas=3 --namespace=wso2
```

### Options

```
-f, --from-file string Path to swagger file
-h, --help help for api
-n, --name string Name of the API
--namespace string namespace of API
--replicas int replica set (default 1)
```

### Options inherited from parent commands

```
-k, --insecure Allow connections to SSL endpoints without certs
--verbose Enable verbose mode
```

### SEE ALSO
* [apimcli add](apimcli_add.md) - Add an API to the kubernetes cluster

18 changes: 8 additions & 10 deletions import-export-cli/docs/apimcli_get-keys.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
## apimcli get-keys

Generate access token
Generate access token to invoke the API

### Synopsis


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

```
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]
apimcli get-keys [flags]
```

### Examples

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

### Options

```
-e, --environment string Environment to which the API should be exported
-h, --help help for export-api
-n, --name string Name of the API to be exported
--provider string Provider of the API
-v, --version string Version of the API to be exported
-e, --environment string Key generation environment
-h, --help help for get-keys
-n, --name string API to be generated keys
-r, --provider string Provider of the API
-v, --version string Version of the API
```

### Options inherited from parent commands
Expand Down
8 changes: 4 additions & 4 deletions import-export-cli/docs/apimcli_list_apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ apimcli list apis [flags]
### Examples

```
apimcli list apis -e dev
apimcli list apis -e dev -q version:1.0.0
apimcli list apis -e prod -q provider:admin
apimcli list apis-e staging
apimcli apis list -e dev
apimcli apis list -e dev -q version:1.0.0
apimcli apis list -e prod -q provider:admin
apimcli apis list -e staging
```

### Options
Expand Down
6 changes: 5 additions & 1 deletion import-export-cli/docs/apimcli_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Set configuration
Set configuration parameters. Use at least one of the following flags
* --http-request-timeout <time-in-milli-seconds>
* --export-directory <path-to-directory-where-apis-should-be-saved>
* --mode <mode-of-apimcli>

```
apimcli set [flags]
Expand All @@ -19,14 +20,17 @@ apimcli set [flags]
apimcli set --http-request-timeout 3600 --export-directory /home/user/exported-apis
apimcli set --http-request-timeout 5000 --export-directory C:\Documents\exported
apimcli set --http-request-timeout 5000
apimcli set --mode kubernetes
apimcli set --mode default
```

### Options

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

### Options inherited from parent commands
Expand Down
34 changes: 34 additions & 0 deletions import-export-cli/docs/apimcli_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## apimcli update

Update an API to the kubernetes cluster

### Synopsis


Update an existing API with Swagger file in the kubernetes cluster. JSON and YAML formats are accepted.

### Examples

```
apimcli update api -n petstore --from-file=./Swagger.json --replicas=1 --namespace=wso2
apimcli update api -n petstore --from-file=./product-apim-tooling/import-export-cli/build/target/apimcli/myapi --replicas=1 --namespace=wso2
```

### Options

```
-h, --help help for update
```

### Options inherited from parent commands

```
-k, --insecure Allow connections to SSL endpoints without certs
--verbose Enable verbose mode
```

### SEE ALSO
* [apimcli](apimcli.md) - CLI for Importing and Exporting APIs and Applications
* [apimcli update api](apimcli_update_api.md) - handle APIs in kubernetes cluster

41 changes: 41 additions & 0 deletions import-export-cli/docs/apimcli_update_api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## apimcli update api

handle APIs in kubernetes cluster

### Synopsis


Add, Update and Delete APIs in kubernetes cluster. JSON and YAML formats are accepted.
available modes are as follows
* kubernetes

```
apimcli update api [flags]
```

### Examples

```
apimcli add/update api -n petstore --from-file=./Swagger.json --replicas=3 --namespace=wso2
```

### Options

```
-f, --from-file string Path to swagger file
-h, --help help for api
-n, --name string Name of the API
--namespace string namespace of API
--replicas int replica set (default 1)
```

### Options inherited from parent commands

```
-k, --insecure Allow connections to SSL endpoints without certs
--verbose Enable verbose mode
```

### SEE ALSO
* [apimcli update](apimcli_update.md) - Update an API to the kubernetes cluster

Loading

0 comments on commit 5e4e02d

Please sign in to comment.