NSX-T Data Center REST API
Create or update tenant Constraint
Create tenant constraint if not exists, otherwise update the existing constraint.Request:
Method:
PATCH
URI Path(s):
/policy/api/v1/infra/constraints/{constraint-id}
/policy/api/v1/orgs/{org-id}/projects/{project-id}/infra/constraints/{constraint-id}
/policy/api/v1/orgs/{org-id}/projects/{project-id}/infra/constraints/{constraint-id}
Request Headers:
n/a
Query Parameters:
n/a
Request Body:
Constraint+
Example Request:
1. { "targets":[{ "target_resource_type":"CommunicationEntry", "attribute":"services", "path_prefix": "/infra/domains/{{DOMAIN}}/edge-communication-maps/default/communication-entries/" }], "constraint_expressions": [{ "resource_type": "RelatedAttributeConditionalExpression", "related_attribute":{ "attribute":"destinationGroups" }, "condition" : { "operator":"INCLUDES", "rhs_value": ["/infra/domains/mgw/groups/VCENTER"], "value_constraint": { "resource_type": "ValueConstraintExpression", "operator":"INCLUDES", "values":["/infra/services/HTTP", "/infra/services/HTTPS"] } } }] } 2. { "targets": [{ "target_resource_type": "DnsForwarderZone", "attribute": "upstreamServers", "path_prefix": "/infra/dns-forwarder-zones/" }], "constraint_expressions": [{ "resource_type": "FieldSanityConstraintExpression", "operator": "OR", "checks": ["ALL_PUBLIC_IPS", "ALL_PRIVATE_IPS"] }] } 3. { "display_name": "Vpc-1 Quota", "constraint_expressions": [{ "resource_type": "EntityInstanceCountConstraintExpression", "target_resource_type": "Group", "count": 100, "operator": "<=" }, { "resource_type": "EntityInstanceCountConstraintExpression", "target_resource_type": "VpcSubnet", "count": 10, "operator": "<=" }], "targets": [{ "path_prefix": "/orgs/default/projects/project-1/vpcs/vpc-1/" }] } 4. { "targets":[{ "target_resource_type":"SecurityPolicy.Rule", "attribute":"services", "path_prefix": "/infra/domains/{{DOMAIN}}/security-policies/default/rules/rule1" }], "constraint_expressions": [{ "resource_type": "RelatedAttributeConditionalExpression", "related_attribute":{ "attribute":"destinationGroups" }, "condition" : { "operator":"INCLUDES", "rhs_value": ["/infra/domains/mgw/groups/VCENTER"], "value_constraint": { "resource_type": "ValueConstraintExpression", "operator":"INCLUDES", "values":["/infra/services/HTTP", "/infra/services/HTTPS"] } } }] }Successful Response:
Response Code:
200 OK
Response Headers:
n/a
Response Body:
n/a