Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
run: |
cd import-export-cli
# go vet ./...
./build.sh -t apictl.go -v 4.5.0
./build.sh -t apictl.go -v 4.6.0

- name: Start APIM
run: |
Expand All @@ -71,4 +71,4 @@ jobs:
- name: Test
run: |
cd import-export-cli/integration
go test -p 1 -timeout 0 -archive apictl-4.5.0-linux-x64.tar.gz -race -coverprofile=coverage.txt -covermode=atomic ./pkg/...
go test -p 1 -timeout 0 -archive apictl-4.6.0-linux-x64.tar.gz -race -coverprofile=coverage.txt -covermode=atomic ./pkg/...
4 changes: 2 additions & 2 deletions apim-apk-agent/pkg/managementserver/rest_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func createAPIYaml(apiCPEvent *APICPEvent) (string, string, string) {

data := map[string]interface{}{
"type": "api",
"version": "v4.5.0",
"version": "v4.6.0",
"data": map[string]interface{}{
"name": apiCPEvent.API.APIName,
"context": context,
Expand Down Expand Up @@ -589,7 +589,7 @@ func createAPIYaml(apiCPEvent *APICPEvent) (string, string, string) {
if prodCount > 1 || sandCount > 1 {
endpointsData = map[string]interface{}{
"type": "endpoints",
"version": "v4.5.0",
"version": "v4.6.0",
"data": dataArr,
}
}
Expand Down
8 changes: 4 additions & 4 deletions import-export-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CLI for Importing and Exporting APIs and Applications and Managing WSO2 Micro Integrator
## For WSO2 API Manager 4.5.0
## For WSO2 API Manager 4.6.0

Command Line tool for importing and exporting APIs/Applications/API Products in between different API environments of WSO2 API Manager and managing WSO2 Micro Integrator

Expand All @@ -17,7 +17,7 @@ Command Line tool for importing and exporting APIs/Applications/API Products in
- ### Building
`cd` into `product-apim-tooling/import-export-cli`

Execute `./build.sh -t apictl.go -v 4.5.0 -f` to build for all platforms.
Execute `./build.sh -t apictl.go -v 4.6.0 -f` to build for all platforms.

Created packages will be available at `build/target` directory

Expand Down Expand Up @@ -69,11 +69,11 @@ Command Line tool for importing and exporting APIs/Applications/API Products in

Usage: `docker build --build-arg version=<version> -t apictl:<version> .`

Example: `docker build --build-arg version=4.5.0.1 -t apictl:4.5.0.1 .`
Example: `docker build --build-arg version=4.6.0.1 -t apictl:4.6.0.1 .`

- ### Using the Docker Image

`docker run -it -v $(pwd):/git -v ~/.wso2apictl:/root/.wso2apictl -v ~/.wso2apictl.local:/root/.wso2apictl.local apictl:4.5.0.1 <apictl command>`
`docker run -it -v $(pwd):/git -v ~/.wso2apictl:/root/.wso2apictl -v ~/.wso2apictl.local:/root/.wso2apictl.local apictl:4.6.0.1 <apictl command>`

***

Expand Down
2 changes: 1 addition & 1 deletion import-export-cli/box/resources/init/default_api.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: api
version: v4.5.0
version: v4.6.0
data:
name:
context:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: deployment_environments
version: v4.5.0
version: v4.6.0
data:
-
displayOnDevportal: true
Expand Down
2 changes: 1 addition & 1 deletion import-export-cli/box/resources/init/document.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: document
version: v4.5.0
version: v4.6.0
data:
name: AWSSecurityDocs
type: OTHER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: api
version: v4.5.0
version: v4.6.0
data:
id: 39325037-1508-4398-a358-e551927ff075
name: PizzaShackAPI
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: api
version: v4.5.0
version: v4.6.0
data:
id: 39325037-1508-4398-a358-e551927ff075
name: PizzaShackAPI
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: api
version: v4.5.0
version: v4.6.0
data:
id: 39325037-1508-4398-a358-e551927ff075
name: PizzaShackAPI
Expand Down
19 changes: 10 additions & 9 deletions import-export-cli/docs/apictl_export_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ without deployment environments will be exported.
### Options

```
-e, --environment string Environment to which the API should be exported
--format string File format of exported archive(json or yaml) (default "YAML")
-h, --help help for api
--latest Export the latest revision of the API
-n, --name string Name of the API to be exported
--preserve-status Preserve API status when exporting. Otherwise API will be exported in CREATED status (default true)
-r, --provider string Provider of the API
--rev string Revision number of the API to be exported
-v, --version string Version of the API to be exported
-e, --environment string Environment to which the API should be exported
--format string File format of exported archive(json or yaml) (default "YAML")
-h, --help help for api
--latest Export the latest revision of the API
-n, --name string Name of the API to be exported
--preserve-credentials Preserve endpoint credentials when exporting. Otherwise credentials will not be exported
--preserve-status Preserve API status when exporting. Otherwise API will be exported in CREATED status (default true)
-r, --provider string Provider of the API
--rev string Revision number of the API to be exported
-v, --version string Version of the API to be exported
```

### Options inherited from parent commands
Expand Down
13 changes: 7 additions & 6 deletions import-export-cli/docs/apictl_export_apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ NOTE: The flag (--environment (-e)) is mandatory
### Options

```
--all Export working copy and all revisions for the APIs in the environments
-e, --environment string Environment from which the APIs should be exported
--force Clean all the previously exported APIs of the given target tenant, in the given environment if any, and to export APIs from beginning
--format string File format of exported archives(json or yaml) (default "YAML")
-h, --help help for apis
--preserve-status Preserve API status when exporting. Otherwise API will be exported in CREATED status (default true)
--all Export working copy and all revisions for the APIs in the environments
-e, --environment string Environment from which the APIs should be exported
--force Clean all the previously exported APIs of the given target tenant, in the given environment if any, and to export APIs from beginning
--format string File format of exported archives(json or yaml) (default "YAML")
-h, --help help for apis
--preserve-credentials Preserve endpoint credentials when exporting. Otherwise credentials will not be exported
--preserve-status Preserve API status when exporting. Otherwise API will be exported in CREATED status (default true)
```

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

Export Applications

### Synopsis

Export Applications of a given tenant from a specified environment

```
apictl export apps (--environment <environment-from-which-the-app-should-be-exported> --format <export-format> --force) [flags]
```

### Examples

```
apictl export apps -e dev --force
apictl export apps -e prod
NOTE: The flag (--environment (-e)) is mandatory
```

### Options

```
-e, --environment string Environment from which the Applications should be exported
--force Clean all the previously exported Apps of the given target tenant, in the given environment if any, and to export Apps from beginning
--format string File format of exported archive (json or yaml) (default "YAML")
-h, --help help for apps
--with-keys Export keys for the applications
```

### Options inherited from parent commands

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

### SEE ALSO

* [apictl export](apictl_export.md) - Export an API/API Product/Application/Policy in an environment

6 changes: 3 additions & 3 deletions import-export-cli/impl/importAPIProduct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestExtractAPIProductInfoWithCorrectJSON(t *testing.T) {
// Correct json
content := `{
"type": "api_product",
"version": "v4.5.0",
"version": "v4.6.0",
"data": {
"id": "e4d0c1be-44e9-43ad-b434-f8e2f02dad11",
"name": "APIProductName",
Expand All @@ -51,7 +51,7 @@ func TestExtractAPIProductInfoWhenDataTagMissing(t *testing.T) {
// When ID tag missing
content := `{
"type": "api_product",
"version": "v4.5.0"
"version": "v4.6.0"
}`
apiProduct, err := extractAPIProductDefinition([]byte(content))
assert.Nil(t, err, "Should return nil error")
Expand All @@ -62,7 +62,7 @@ func TestExtractAPIProductInfoWithMalformedJSON(t *testing.T) {
// Malformed json
content := `{
"type": "api_product",
"version": "v4.5.0",
"version": "v4.6.0",
"data": {
"id": "e4d0c1be-44e9-43ad-b434-f8e2f02dad11",
"name": "APIProductName",
Expand Down
4 changes: 2 additions & 2 deletions import-export-cli/impl/importAPI_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestExtractAPIInfoWithCorrectJSON(t *testing.T) {
// Correct json
content := `{
"type": "api",
"version": "v4.5.0",
"version": "v4.6.0",
"data": {
"id": "e4d0c1be-44e9-43ad-b434-f8e2f02dad11",
"name": "APIName",
Expand All @@ -52,7 +52,7 @@ func TestExtractAPIInfoWhenDataTagMissing(t *testing.T) {
// When ID tag missing
content := `{
"type": "api",
"version": "v4.5.0"
"version": "v4.6.0"
}`

api, err := extractAPIDefinition([]byte(content))
Expand Down
10 changes: 5 additions & 5 deletions import-export-cli/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ devops-rest-api-version: v0
The version of the apictl that is being integration tested.

```
apictl-version: 4.5.0
apictl-version: 4.6.0
```


Expand Down Expand Up @@ -95,7 +95,7 @@ apictl-version: 4.5.0
```
go test -p 1 -timeout 0 -archive <apictl archive name>

example: go test -p 1 -timeout 0 -archive apictl-4.5.0-linux-x64.tar.gz
example: go test -p 1 -timeout 0 -archive apictl-4.6.0-linux-x64.tar.gz

```

Expand All @@ -104,23 +104,23 @@ example: go test -p 1 -timeout 0 -archive apictl-4.5.0-linux-x64.tar.gz
```
go test -p 1 -timeout 0 -archive <apictl archive name> -run <Test function name or partial name regex>

example: go test -p 1 -timeout 0 -archive apictl-4.5.0-linux-x64.tar.gz -run TestVersion
example: go test -p 1 -timeout 0 -archive apictl-4.6.0-linux-x64.tar.gz -run TestVersion
```

- Print verbose output

```
go test -p 1 -timeout 0 -archive <apictl archive name> -v

example: go test -p 1 -timeout 0 -archive apictl-4.5.0-linux-x64.tar.gz -v
example: go test -p 1 -timeout 0 -archive apictl-4.6.0-linux-x64.tar.gz -v
```

- Print http transport request/responses

```
go test -p 1 -timeout 0 -archive <apictl archive name> -logtransport

example: go test -p 1 -timeout 0 -archive apictl-4.5.0-linux-x64.tar.gz -logtransport
example: go test -p 1 -timeout 0 -archive apictl-4.6.0-linux-x64.tar.gz -logtransport
```

---
Expand Down
4 changes: 2 additions & 2 deletions import-export-cli/integration/ci-resources/start-apim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ done

if [ -z "$DOWNLOAD_LINK" ]
then
APIM_DOWNLOAD='https://wso2.org/jenkins/job/products/job/product_apim/job/product-apim/lastStableBuild/org.wso2.am$wso2am/artifact/org.wso2.am/wso2am/4.5.0-SNAPSHOT/wso2am-4.5.0-SNAPSHOT.zip'
APIM_DOWNLOAD='https://wso2.org/jenkins/job/products/job/product_apim/job/product-apim/lastStableBuild/org.wso2.am$wso2am/artifact/org.wso2.am/wso2am/4.6.0-SNAPSHOT/wso2am-4.6.0-SNAPSHOT.zip'
else
APIM_DOWNLOAD=$DOWNLOAD_LINK
fi

if [ -z "$NAME" ]
then
APIM_PACK=wso2am-4.5.0-SNAPSHOT
APIM_PACK=wso2am-4.6.0-SNAPSHOT
else
APIM_PACK=$NAME
fi
Expand Down
2 changes: 1 addition & 1 deletion import-export-cli/integration/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ admin-rest-api-version: v4
devportal-rest-api-version: v3
publisher-rest-api-version: v4
devops-rest-api-version: v0
apictl-version: 4.5.0
apictl-version: 4.6.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: document
version: v4.5.0
version: v4.6.0
data:
documentId: 99343207-6374-4518-9ee2-91305feb2b69
name: Doc2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: operation_policy_specification
version: v4.5.0
version: v4.6.0
data:
category: Mediation
name: customAddLogMessage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: operation_policy_specification
version: v4.5.0
version: v4.6.0
data:
category: Mediation
name: customAddLogMessage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: document
version: v4.5.0
version: v4.6.0
data:
documentId: 5d79aead-eeb3-43b9-84eb-51a965e383ed
name: Doc1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: operation_policy_specification
version: v4.5.0
version: v4.6.0
data:
category: Mediation
name: customAddLogMessage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: operation_policy_specification
version: v4.5.0
version: v4.6.0
data:
name: customAddLogMessageTestOperationPolicy
version: v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: operation_policy_specification
version: v4.5.0
version: v4.6.0
data:
category: Mediation
name: customAddLogMessageTestOperationPolicy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: operation_policy_specification
version: v4.5.0
version: v4.6.0
data:
category: Mediation
name: customAddLogMessageTestOperationPolicy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: operation_policy_specification
version: v4.5.0
version: v4.6.0
data:
category: Mediation
name: customAddLogMessageTestOperationPolicy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: operation_policy_specification
version: v4.5.0
version: v4.6.0
data:
category: Mediation
name: dynamicAddLogMessage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: operation_policy_specification
version: v4.5.0
version: v4.6.0
data:
category: Mediation
name: testSynapseChoreoConnectPolicy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: operation_policy_specification
version: v4.5.0
version: v4.6.0
data:
category: Mediation
name: customAddLogMessageTestOperationPolicy
Expand Down
2 changes: 1 addition & 1 deletion import-export-cli/integration/testdata/sample-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

type: api # Type of the exported artifact using APICTL
version: v4.5.0 # API Manager version
version: v4.6.0 # API Manager version
data: # Contains the meta data of the API
id: 28114236-515c-4f40-82e4-6a016e632008 ## API UUID
name: PizzaShackAPI # Name of the API without Spaces [required]
Expand Down
Loading
Loading