Use API to create configurations from StyleBooks
Example 1
POST
https://<MAS-DNS-or-IP>/stylebook/nitro/v1/config/stylebooks/com.example.stylebooks/0.1/lb-vserver/configpacks
Content-Type: application/json
Accept: application/json
{
"configpack":
{
"parameters": {
"name": "lb1",
"ip": "10.102.117.31"
},
"target_devices":
[
{
"id": "deecee30-f478-4446-9741-a85041903410"
}
]
}
}
GET https://<MAS-IP>/nitro/v1/config/ns?filter=ip_address:192.168.153.160Accept: application/json
200
OK
Content-Type: application/json
{
"errorcode": 0,
"message": "Done",
"operation": "get",
"resourceType": "ns",
"username": "nsroot",
"tenant_name": "Owner",
"resourceName": "",
"ns":
[
{
"is_grace": "false",
"hostname": "",
"std_bw_config": "0",
"gateway_deployment": "false",
…"id": "deecee30-f478-4446-9741-a85041903410",
...
}
]
}
200 OK
Content-Type: application/json
{
"configpack":
{
"config_id": "1460806080"
}
}
Example 2
POST
https://<MAS-DNS-or-IP>/stylebook/nitro/v1/config/stylebooks/com.example.stylebooks/0.1/lb-vserver/configpacksContent-Type: application/json
Accept: application/json
{
"configpack":
{
"parameters":
{
"name": "lb2",
"ip": "10.102.117.32",
"lb-alg": "LEASTCONNECTION"
},
"target_devices"
[
{"id": "deecee30-f478-4446-9741-a85041903410"},
{"id": "debecc60-d589-4557-8632-a74032802412"}
]
}
}
200 OK
Content-Type: application/json
{
"configpack":
{
"config_id": "1657696292"
}
}
Example 3
POST
http://<MAS-DNS-or-IP>/stylebook/nitro/v1/config/stylebooks/com.example.stylebooks/0.1/basic-lb-config/configpacksContent-Type: application/json
Accept: application/json
{
"configpack":
{
"parameters":
{
"name": "myapp",
"ip": "10.70.122.25",
"svc-servers":
["192.168.100.11","192.168.100.12"],
"svc-port": 8080
},
"target_devices":
[
{
"id": "deecee30-f478-4446-9741-a85041903410"
},
{
"id": "debecc60-d589-4557-8632-a74032802412"
}
]
}
}
Example 4
POST http://<MAS-DNS-or-IP>/stylebook/nitro/v1/config/stylebooks/com.example.stylebooks/0.1/composite-example/configpacksContent-Type: application/json
Accept: application/json
{
"configpack":
{
"parameters": {
"name": "myapp",
"ip": "2.2.2.2",
"svc-servers": ["10.102.29.52","10.102.29.53"]
},
"target_devices":
[
{
"id": "deecee30-f478-4446-9741-a85041903410"
},
{
"id": "debecc60-d589-4557-8632-a74032802412"
}
]
}
}
200 OK
Content-Type: application/json{
"configpack": {
"config_id": "4917276817"
}
}
Updating a configuration
PUT http://<MAS-DNS-or-IP>/stylebook/nitro/v1/config/stylebooks/com.example.stylebooks/0.1/composite-example/configpacks/4917276817Content-Type: application/json
Accept: application/json
{
"configpack": {
"parameters": {
"name": "myapp",
"ip": "2.2.2.2",
"svc-servers": ["10.102.29.52","10.102.29.53","10.102.29.54"]
},
"target_devices":
[
{
"id": "deecee30-f478-4446-9741-a85041903410"
},
{
"id": "debecc60-d589-4557-8632-a74032802412"
}
]
}
}
200 OK
Content-Type: application/json
{
"configpack": {
"config-id": "4917276817"
}
}
Deleting a configuration
DELETE http://<MAS-DNS-or-IP>/stylebook/nitro/v1/config/stylebooks/com.example.stylebooks/0.1/composite-example/configpacks/4917276817Accept: application/json
200 OK
Content-Type: application/json
{
"configpack": {
"config_id": "4917276817"
}
}