|
1 | 1 | # CLI for Importing and Exporting APIs
|
2 |
| -## WSO2 API Manager 3.0.0 |
| 2 | +## For WSO2 API Manager 3.0.0 |
3 | 3 |
|
4 |
| -#### Usage |
| 4 | +Command Line tool for importing and exporting APIs between different API Environemnts |
| 5 | + |
| 6 | +## Getting Started |
| 7 | + |
| 8 | +- ### Setting up the development environment |
| 9 | + 1. Install [Go 1.8.x](https://golang.org/dl) |
| 10 | + 2. Setup `$GOROOT` and `$GOPATH` correctly : [Tutorial](https://www.goinggo.net/2016/05/installing-go-and-your-workspace.html) |
| 11 | + 3. [Install Glide](https://github.com/Masterminds/glide#install) - The Dependency manager for Go |
| 12 | + 4. Clone the [repository](https://github.com/wso2/product-apim-tooling) to your `$GOPATH` such that the project location is `$GOPATH/src/github.com/wso2/product-apim-tooling` (This is mandatory for Go's dependencies to identify each other) |
| 13 | + 5. `cd` into `product-apim-tooling/import-export-cli` |
| 14 | + 6. Execute `glide install` to download all the dependencies |
| 15 | + |
| 16 | +- ### Building |
| 17 | + `cd` into `product-apim-tooling/import-export-cli` |
| 18 | + |
| 19 | + Execute `./build.sh -t apimcli.go -v 1.0.0 -f` to build for all platforms. |
| 20 | + |
| 21 | + Created packages will be available at `build/target` directory |
| 22 | + |
| 23 | +- ### Running |
| 24 | + Extract the compressed archive generated to a desired location. |
| 25 | + |
| 26 | + Then execute `import-export-cli/apimcli` to start the application. |
| 27 | + |
| 28 | + Execute `import-export-cli/apimcli --help` for further instructions. |
| 29 | + |
| 30 | +- ### Adding Environments |
| 31 | + Add environments by either manually editing `import-export-cli/bin/main_config.yaml` or using the command |
| 32 | + `apimcli set` command. |
| 33 | + |
| 34 | + Type `apimcli set --help` for detailed instructions |
| 35 | + |
| 36 | + ### Command Autocompletion (For Bash Only) |
| 37 | + Copy the file `apimcli_bash_completion.sh` to `/etc/bash_completion.d/` and source it with |
| 38 | + `source /etc/bash_completion.d/apimcli_bash_completion.sh` to enable bash auto-completion. |
| 39 | + |
| 40 | +<hr/> |
| 41 | +<br/> |
| 42 | + |
| 43 | +## Usage |
5 | 44 | ```bash
|
6 |
| - wso2apim [command] |
| 45 | + apimcli [command] |
7 | 46 | ```
|
| 47 | + |
8 | 48 | ### Commands
|
9 | 49 | * #### export-api
|
10 | 50 | ```bash
|
|
17 | 57 | --username, -u
|
18 | 58 | --password, -p
|
19 | 59 | Examples:
|
20 |
| - wso2apim export-api -n TestAPI -v 1.0.1 -e staging |
21 |
| - wso2apim export-api -n TestAPI -v 1.0.1 -e staging -u admin -p 123456 |
22 |
| - wso2apim export-api -n TestAPI -v 1.0.1 -e staging -u admin |
23 |
| - wso2apim export-api -n TestAPI -v 1.0.1 -e staging -p 123456 |
| 60 | + apimcli export-api -n TestAPI -v 1.0.1 -e staging |
| 61 | + apimcli export-api -n TestAPI -v 1.0.1 -e staging -u admin -p 123456 |
| 62 | + apimcli export-api -n TestAPI -v 1.0.1 -e staging -u admin |
| 63 | + apimcli export-api -n TestAPI -v 1.0.1 -e staging -p 123456 |
24 | 64 | ```
|
25 | 65 |
|
26 | 66 |
|
|
29 | 69 | ```bash
|
30 | 70 | Flags:
|
31 | 71 | Required:
|
32 |
| - --name, -n |
| 72 | + --file, -f |
33 | 73 | --environment, -e
|
34 | 74 | Optional:
|
35 | 75 | --username, -u
|
36 | 76 | --password, -p
|
37 | 77 | Examples:
|
38 |
| - wso2apim import-api -n TestAPI.zip -e dev |
39 |
| - wso2apim import-api -n TestAPI.zip -e dev -u admin -p 123456 |
40 |
| - wso2apim import-api -n TestAPI.zip -e dev -u admin |
41 |
| - wso2apim import-api -n TestAPI.zip -e dev -p 123456 |
42 |
| - wso2apim import-api -n TestAPI -e dev |
| 78 | + apimcli import-api -f dev/TestAPI_1.0.0.zip -e dev |
| 79 | + apimcli import-api -f qa/TestAPI_1.2.1.zip -e dev -u admin -p 123456 |
| 80 | + apimcli import-api -f staging/TestAPI_2.1.3.zip -e dev -u admin |
| 81 | + apimcli import-api -f production/TestAPI_3.1.0.zip -e dev -p 123456 |
| 82 | + apimcli import-api -f TestAPI_1.2.1.zip -e dev |
43 | 83 | ```
|
44 |
| -* #### list |
| 84 | +* #### list apis |
45 | 85 | ```bash
|
46 | 86 | Flags:
|
47 | 87 | Required:
|
|
50 | 90 | --username, -u
|
51 | 91 | --password, -p
|
52 | 92 | Examples:
|
53 |
| - wso2apim list -e dev |
54 |
| - wso2apim list -e staging |
55 |
| - wso2apim list -e staging -u admin -p 123456 |
56 |
| - wso2apim list -e staging -u admin |
57 |
| - wso2apim list -e staging -p 123456 |
| 93 | + apimcli list -e dev |
| 94 | + apimcli list -e staging |
| 95 | + apimcli list -e staging -u admin -p 123456 |
| 96 | + apimcli list -e staging -u admin |
| 97 | + apimcli list -e staging -p 123456 |
58 | 98 | ```
|
| 99 | + |
| 100 | +* #### list envs |
| 101 | +```bash |
| 102 | + Flags: |
| 103 | + None |
| 104 | + Example: |
| 105 | + apimcli list envs |
| 106 | +``` |
| 107 | + |
59 | 108 | * #### add-env
|
60 | 109 | ```bash
|
61 | 110 | Flags:
|
62 | 111 | Required:
|
63 | 112 | --name, -n (Name of the environment)
|
64 |
| - --apim (API Manager endpoint) |
65 |
| - --registration (Registration Endpoint) |
66 |
| - --token (Token Endpoint) |
| 113 | + --publisher, -p (Publisher endpoint) |
| 114 | + --registration, -r (Registration Endpoint) |
| 115 | + --token, -t (Token Endpoint) |
67 | 116 | Examples:
|
68 |
| - wso2apim add-env -n dev \ |
| 117 | + apimcli add-env -n dev \ |
69 | 118 | --apim https://localhost:9292/api/am/publisher/v1.0 \
|
70 | 119 | --registration https://localhost:9443/identity/connect/register \
|
71 | 120 | --token https: https://localhost:9443/oauth2/token
|
|
76 | 125 | Required:
|
77 | 126 | --name, -n (Name of the environment)
|
78 | 127 | Examples:
|
79 |
| - wso2apim remove-env -n dev |
| 128 | + apimcli remove-env -n dev |
80 | 129 |
|
81 | 130 | ```
|
82 | 131 |
|
83 | 132 | * #### reset-user
|
84 | 133 | ```bash
|
85 | 134 | Flags
|
86 | 135 | --environment, -e
|
87 |
| - Example: |
88 |
| - wso2paim reset-user -e dev |
| 136 | + Examples: |
| 137 | + apimcli reset-user -e dev |
89 | 138 | ```
|
90 | 139 | * #### version
|
91 | 140 | ```bash
|
92 |
| - wso2apim version |
| 141 | + apimcli version |
93 | 142 | ```
|
| 143 | + |
| 144 | +* #### set |
| 145 | +```bash |
| 146 | + Flags |
| 147 | + --httpRequestTimeout |
| 148 | + --exportDirectory |
| 149 | + Examples: |
| 150 | + apimcli set --httpRequestTimeout 10000 |
| 151 | + apimcli set --exportDirectory /home/user/exported |
| 152 | +``` |
94 | 153 |
|
95 | 154 | #### Global Flags
|
96 | 155 | ```bash
|
97 | 156 | --verbose
|
| 157 | + --insecure, -k |
98 | 158 | --help, -h
|
99 | 159 | ```
|
0 commit comments