You can update a network partition using the CLI tool, REST API or the PPaaS Console as shown below:
Updating a network partition via the CLI
Overview
CLI command | update-network-partition |
Description | Update details of a network partition. |
Command format | update-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 of the JSON file where the network partition is defined. | Yes |
|
Example
Update a network partition based on the <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/network-partitions/mock/network-partition-mock.json
file.
update-network-partition -p <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/network-partitions/mock/network-partition-mock.json
Sample output
Network Partition updated successfully: [network-partition] network-partition-mock
Updating a network partition via the REST API
Overview
Description | Update a specific network partition. |
URL | /networkPartitions |
HTTP Method | PUT |
Request/Response Format | application/json |
Command format | curl -X PUT -H "Content-Type: application/json" -d "@<JSON_PAYLOAD>" -k -v -u <USERNAME>:<PASSWORD> https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/networkPartitions
|
Example
Update a network partition based on the <PRIVATE_PAAS_SAMPLES>/common/samples/network-partitions/mock/network-partition-mock.json
file.
cd <PRIVATE_PAAS_SAMPLES>/common/samples curl -X PUT -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
> PUT /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 200 OK < Date: Fri, 02 Oct 2015 09:08:18 GMT < Content-Type: application/json < Transfer-Encoding: chunked < Server: WSO2 Carbon Server < {"status":"success","message":"Network Partition updated successfully: [network-partition] network-partition-mock"}
You will come across the following HTTP status codes while updating a network partition:
HTTP status code | 200, 404, 500 See the descriptions of the HTTP status codes here. |
Updating a network partition via the PPaaS Console
Updating a network partition via the UI editor
Follow the instructions below to update a network partition:
- Click Configurations on the home page.
- Click Network Partitions.
- Hover your mouse pointer over the Network Partition that you wish to edit, for the Updatebutton to appear and then click Edit.
- Update the network partition definition. For property definitions, see the Network Partition Resource Definition.
- Click SAVE to save the changes of the updated network partition definition.
Updating a network partition via the JSON editor
Follow the instructions below to update a network partition:
- Click Configurations on the home page.
- Click Network Partitions.
- Hover your mouse pointer over the network partition definition you wish to update for the Edit button to appear and click Edit.
- Click on the editor control to switch to the JSON editor. The JSON code format to update a network partition appears.
- 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.
- Update the network partition definition using JSON. For property definitions, see the Network Partition Resource Definition.
- Click SAVE to save the changes of the updated 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" } ] } ] }