Management Plane API > Networking > Services > Loadbalancer

Update a load balancer virtual server with rules

It is used to update virtual servers, the associated rules and update the
binding of virtual server and rules.
To add new rules, make sure the rules which have no identifier specified,
the new rules are automatically generated and associated to the virtual
server.
To delete old rules, the rules should not be configured in new action, the
UUID of deleted rules should be also removed from rule_ids.
To update rules, the rules should be specified with new change and
configured with identifier.
If there are some rules which are not modified, those rule should not be
specified in the rules list, the UUID list of rules should be specified in
rule_ids of LbVirtualServer.

Request:

Method:
PUT
URI Path(s):
/api/v1/loadbalancer/virtual-servers/<virtual-server-id>?action=update_with_rules
Request Headers:
n/a
Query Parameters:
n/a
Request Body:
LbVirtualServerWithRule+

Example Request:

PUT https://<nsx-mgr>/api/v1/loadbalancer/virtual-servers/<virtual-server-id>?action=update_with_rules { "virtual_server": { "resource_type" : "LbVirtualServer", "description" : "LB_HTTP_VirtualServer", "id" : "801ebbb3-90bf-403b-b061-9ec6294813b2", "display_name" : "LB_HTTP_VirtualServer", "ip_address" : "123.123.123.123", "pool_id" : "356ab0ad-3fdc-48ef-b9df-8c05cedc0fc3", "enabled" : true, "rule_ids" : ["b6a5bffa-f6a9-447c-936f-4633f9eb43a7"], "ip_protocol" : "TCP", "default_pool_member_port" : "80", "port" : "80", "application_profile_id" : "5563bc87-799d-4340-9715-27e43cb1e60c", "_create_user" : "admin", "_create_time" : 1506659379394, "_last_modified_user" : "admin", "_last_modified_time" : 1506659379394, "_system_owned" : false, "_protection" : "NOT_PROTECTED", "_revision" : 0 }, "rules": [ { "resource_type" : "LbRule", "id" : "b6a5bffa-f6a9-447c-936f-4633f9eb43a7", "display_name": "LoginRouteRule", "description": "LbRule to route login requests to dedicated pool", "match_conditions" : [{ "type": "LbHttpRequestUriCondition", "match_type": "EQUALS", "uri": "/login", "inverse": false }], "match_strategy" : "ALL", "phase" : "HTTP_FORWARDING", "actions" : [{ "type": "LbSelectPoolAction", "pool_id": "b6a5bffa-f6a9-447c-6666-4633f9eb1234" }], "_create_time" : 1478304339963, "_create_user" : "admin", "_last_modified_user" : "admin", "_system_owned" : false, "_last_modified_time" : 1478304339963, "_revision" : 0 }, { "resource_type" : "LbRule", "display_name": "URIRewriteRule2", "description": "Sample URI rewrite rule2", "match_conditions" : [{ "type": "LbHttpRequestUriCondition", "match_type": "REGEX", "uri": "/news/(?<year>\\d+)/(?<month>\\d+)/(?<article>.*)", "inverse": false }], "match_strategy" : "ALL", "phase" : "HTTP_REQUEST_REWRITE", "actions" : [{ "type": "LbHttpRequestUriRewriteAction", "uri": "/news/$year-$month-$article", "uri_arguments": "" }] } ] }

Successful Response:

Response Code:
200 OK
Response Headers:
Content-type: application/json
Response Body:
LbVirtualServerWithRule+

Example Response:

{ "virtual_server": { "resource_type" : "LbVirtualServer", "description" : "LB_HTTP_VirtualServer", "id" : "801ebbb3-90bf-403b-b061-9ec6294813b2", "display_name" : "LB_HTTP_VirtualServer", "ip_address" : "123.123.123.123", "pool_id" : "356ab0ad-3fdc-48ef-b9df-8c05cedc0fc3", "enabled" : true, "rule_ids" : ["b6a5bffa-f6a9-447c-936f-4633f9eb43a7", "e6a5bffa-f6a9-447c-936f-4633f9eb43a7"], "ip_protocol" : "TCP", "default_pool_member_port" : "80", "port" : "80", "application_profile_id" : "5563bc87-799d-4340-9715-27e43cb1e60c", "_create_user" : "admin", "_create_time" : 1506659379394, "_last_modified_user" : "admin", "_last_modified_time" : 1506659379394, "_system_owned" : false, "_protection" : "NOT_PROTECTED", "_revision" : 1 }, "rules": [ { "resource_type" : "LbRule", "id" : "b6a5bffa-f6a9-447c-936f-4633f9eb43a7", "display_name": "LoginRouteRule", "description": "LbRule to route login requests to dedicated pool", "match_conditions" : [{ "type": "LbHttpRequestUriCondition", "match_type": "EQUALS", "uri": "/login", "inverse": false }], "match_strategy" : "ALL", "phase" : "HTTP_FORWARDING", "actions" : [{ "type": "LbSelectPoolAction", "pool_id": "b6a5bffa-f6a9-447c-6666-4633f9eb1234" }], "_create_time" : 1478304339963, "_create_user" : "admin", "_last_modified_user" : "admin", "_system_owned" : false, "_last_modified_time" : 1478304339963, "_revision" : 1 }, { "resource_type" : "LbRule", "id" : "e6a5bffa-f6a9-447c-936f-4633f9eb43a7", "display_name": "URIRewriteRule2", "description": "Sample URI rewrite rule2", "match_conditions" : [{ "type": "LbHttpRequestUriCondition", "match_type": "REGEX", "uri": "/news/(?<year>\\d+)/(?<month>\\d+)/(?<article>.*)", "inverse": false }], "match_strategy" : "ALL", "phase" : "HTTP_REQUEST_REWRITE", "actions" : [{ "type": "LbHttpRequestUriRewriteAction", "uri": "/news/$year-$month-$article", "uri_arguments": "" }], "_create_time" : 1478304339963, "_create_user" : "admin", "_last_modified_user" : "admin", "_system_owned" : false, "_last_modified_time" : 1478304339963, "_revision" : 0 } ] }

Required Permissions:

crud

Feature:

lb_virtual_servers

Additional Errors: