Overview

DescriptionAdd a network partition.
URL/networkPartitions
HTTP MethodPOST
Request/Response Formatapplication/json

Sample request

{  
   "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"
            }
         ]
      }
   ]
}

For information on all the properties that can be used in a network partition definition, see the Network Partition Resource Definition.

> POST /api/networkPartitions HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8| zlib/1.2.5
> Host: localhost:9443
> Accept: */*
> Content-Type: application/json
> Content-Length: 278
>
* upload completely sent off: 278 out of 278 bytes
< HTTP/1.1 201 Created
< Date: Tue, 17 Mar 2015 16:34:13 GMT
< Location: https://localhost:9443/api/networkPartitions/network-partition-1
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
<

{"status":"success","message":"Network partition added successfully: [network-partition] network-partition-1"}

curl -X POST -H "Content-Type: application/json" -d "@<JSON_PAYLOAD>" -k -v -u admin:admin https://<STRATOS_HOST>:<STRATOS_HTTPS_PORT>/api/networkPartitions
  • The path to the JSON file that defines the network partition needs to be defined as the  <JSON_PAYLOAD> value.

  • By default, <STRATOS_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <STRATOS_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.

For example:

cd <STRATOS_SOURCE_HOME>/samples
curl -X POST -H "Content-Type: application/json" -d @'network-partitions/mock/network-partition-1.json' -k -v -u admin:admin https://localhost:9443/api/networkPartitions
 
CLI command

add-network-partition

DescriptionAdd 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 <JSON_FILE_PATH> value.


REST API response

HTTP status code

201, 400, 409, 500

See the descriptions of the HTTP status codes here.

Location header URLhttps://<STRATOS_HOST>:<PORT>/api/networkPartitions/<NETWORK_PARTITION_ID>
  • No labels