NSX-T Data Center REST API
Update the infra including all the nested entities
Patch API at infra level can be used in two flavours1. Like a regular API to update Infra object
2. Hierarchical API: To create/update/delete entire or part of intent
hierarchy
Hierarchical API: Provides users a way to create entire or part of
intent in single API invocation. Input is expressed in a tree format.
Each node in tree can have multiple children of different types.
System will resolve the dependencies of nodes within the intent tree
and will create the model. Children for any node can be specified using
ChildResourceReference or ChildPolicyConfigResource.
If a resource is specified using ChildResourceReference then it will
not be updated only its children will be updated. If Object is specified
using ChildPolicyConfigResource, object along with its children will be
updated.
Hierarchical API can also be used to delete any sub-branch of entire tree.
Hierarchical API supports up to 5000 intent creation on LM and 1000 on GM.
This API is available when using VMware Cloud (AWS, Dell-EMC, Outpost, Hyperscalers) or VMware NSX.
Request:
Method:
PATCH
URI Path(s):
/policy/api/v1/infra
/policy/api/v1/global-infra
/policy/api/v1/orgs/{org-id}/projects/{project-id}/infra
/policy/api/v1/global-infra
/policy/api/v1/orgs/{org-id}/projects/{project-id}/infra
Request Headers:
n/a
Query Parameters:
ForceRevisionCheckRequestParameter+
Request Body:
Infra+
Example Request:
Example 1: ---------- { "display_name": "infra", "path": "/infra", "relative_path": "infra", "connectivity_strategy": "NONE" } Example 2: ---------- # Below sample creates domain, groups, services and and security-policies in one call { "resource_type":"Infra", "children": [ { "resource_type":"ChildDomain", "Domain": { "id":"domain-test", "resource_type":"Domain", "description":"domain-test", "display_name":"domain-test", "children":[ { "resource_type":"ChildGroup", "Group":{ "resource_type":"Group", "description":"g1", "display_name":"g1", "id":"g1", "expression":[ { "member_type":"VirtualMachine", "value":"webvm", "key":"Tag", "operator":"EQUALS", "resource_type":"Condition" } ] } }, { "resource_type":"ChildGroup", "Group":{ "resource_type":"Group", "description":"g2", "display_name":"g2", "id":"g2", "expression":[ { "member_type":"VirtualMachine", "value":"dbvm", "key":"Tag", "operator":"EQUALS", "resource_type":"Condition" } ] } }, { "resource_type":"ChildSecurityPolicy", "SecurityPolicy":{ "id":"sp1", "resource_type":"SecurityPolicy", "description":"SecurityPolicy", "display_name":"SecurityPolicy", "rules":[ { "resource_type":"Rule", "description":"Rule", "display_name":"r1", "sequence_number":1, "source_groups":[ "/infra/domains/domain-test/groups/g2" ], "destination_groups":[ "/infra/domains/domain-test/groups/g1" ], "services": [ "/infra/services/HTTP", "/infra/services/AD_Server", "/infra/services/CIM-HTTP" ], "action": "ALLOW" } ] } } ] } }, { "resource_type":"ChildService", "Service": { "id":"s1", "resource_type":"Service", "description":"L4Service", "display_name":"L4Service", "service_entries": [ { "resource_type":"L4PortSetServiceEntry", "display_name":"L4ServiceEntry", "destination_ports": [ "464" ], "l4_protocol":"TCP" } ] } } ] } Example 3: ---------- #Hierarchical delete example #Below example deletes domain-test including all its #children(groups, security policies, services) { "resource_type":"Infra", "children":[ { "resource_type":"ChildDomain", "marked_for_delete": true, "Domain":{ "id":"domain-test", "resource_type":"Domain" } } ] } Example 4: ---------- #Example using ChildResourceReference in hierarchical API #Below example updates group g1 in 'domain-test' without updating domain and without #requiring to populate domain object completely in request payload. { "resource_type":"Infra", "children":[ { "resource_type":"ChildResourceReference", "id":"domain-test", "target_type":"Domain", "children":[ { "resource_type":"ChildGroup", "Group":{ "resource_type":"Group", "description":"web group update", "display_name":"webgroup", "id":"g1", "expression":[ { "member_type":"VirtualMachine", "value":"web", "key":"Tag", "operator":"EQUALS", "resource_type":"Condition" } ] } } ] } ] }Successful Response:
Response Code:
200 OK
Response Headers:
n/a
Response Body:
n/a