You can add a network partition using the CLI tool, REST API or the PPaaS Console as shown below:
Adding a network partition via the CLI
Overview
CLI command |
|
Description | Add a new network partition. |
Command format | add-network-partition -p <JSON_FILE_PATH> The path to the JSON file that defines the network partition needs to be defined as the |
Parameter definition
Short option | Long option | Description | Required | Example value |
---|---|---|---|---|
-p | --resource-path | Folder path where the JSON file that defines the network partition is stored. | yes |
<PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples |
Example
Add the network partition that has been defined in the <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/network-partitions/mock/network-partition-mock.json
file.
add-network-partition -p <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/network-partitions/mock/network-partition-mock.json
Sample output
Network partition added successfully: [network-partition] network-partition-mock
Adding a network partition via the REST API
Overview
Description | Add a network partition. |
URL | /networkPartitions |
HTTP Method | POST |
Request/Response Format | application/json |
Command format | curl -X POST -H "Content-Type: application/json" -d "@<JSON_PAYLOAD>" -k -v -u <USERNAME>:<PASSWORD> https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/networkPartitions
|
Example
Add the network partition that has been defined in the
<PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/network-partitions/mock/network-partition-mock.json
file.
cd <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/ curl -X POST -H "Content-Type: application/json" -d @'network-partitions/mock/network-partition-mock.json' -k -v -u admin:admin https://localhost:9443/api/networkPartitions
Sample output
> POST /api/networkPartitions HTTP/1.1 > Host: localhost:9443 > Authorization: Basic YWRtaW46YWRtaW4= > User-Agent: curl/7.43.0 > Accept: */* > Content-Type: application/json > Content-Length: 476 > < HTTP/1.1 201 Created < Date: Fri, 02 Oct 2015 06:11:43 GMT < Location: https://localhost:9443/api/networkPartitions/network-partition-mock < Content-Type: application/json < Transfer-Encoding: chunked < Server: WSO2 Carbon Server < {"status":"success","message":"Network partition added successfully: [network-partition] network-partition-mock"}
You will come across the following HTTP status codes while adding a network partition:
HTTP status code | 201, 400, 409, 500 See the descriptions of the HTTP status codes here. |
Location header URL |
|
Adding a network partition via the PPaaS Console
Adding a network partition via the UI editor
Follow the instructions below to add a network partition:
- Click Configurations on the home page.
- Click Network Partitions. The Network Partition Definitions page will appear.
- Click ADD NETWORK PARTITION.
- Enter the required details. For property definitions, see Network Partition Resource Definition.
- To define properties of items.
- Click Properties next to the respective item you wish to define.
Example: Partition 1 - Select the property fields that you wish to set at the property level.
- Optionally, if you wish to add a customized property at the property level, enter the property name and click +add to add it.
- Click Properties next to the respective item you wish to define.
- To define properties of items.
- Click SAVE NETWORK PARTITION DEFINITION.
Adding a network partition via the JSON editor
Follow the instructions below to add a network partition:
- Click Configurations on the home page.
- Click Network Partitions. The Network Partition Definitions page will appear.
- Click ADD NETWORK PARTITION. The form to add a new partition definition will appear in the UI editor.
- Click on the editor control to switch to the JSON editor. The JSON code format to add a network partition will appear.
- Optionally, check the Auto correct with schema option to ensure that you do not accidentally delete any mandatory fields from the network partition definition JSON code.
- Code the network partition definition using JSON. For property definitions, see the Network Partition Resource Definition.
- Click SAVE NETWORK PARTITION DEFINITION.
Sample network partition JSON
{ "id":"network-partition-1", "provider":"ec2", "partitions":[ { "id":"partition-1", "property":[ { "name":"region", "value":"default" } ] } ] }
{ "id": "network-partition-1", "provider": "mock", "partitions": [ { "id": "partition-1", "property": [ { "name": "region", "value": "default" } ] } ] }
{ "id":"network-partition-1", "provider":"kubernetes", "partitions":[ { "id":"partition-1", "property":[ { "name":"cluster", "value":"kubernetes-cluster-1" } ] } ] }