Few days back I wrote a post on how to create Replication policies in vCloud Availability via GUI. In this post I will walk through steps of creating the same via API.
Below are high level steps of API workflow.
1: Get Auth Token
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Method:POST URL:https://<vcav-fqdn>/sessions Auth:NoAuth Payload: { "type":"localUser", "localUser":"root", "localPassword":"Password" } |
2: Create a New Replication Policy
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Method:POST URL:https://<vcav-fqdn>/policies Headers:X-VCAV-Auth:<TokenValue> Payload: { "allowIncoming":true, "allowOutgoing":true, "displayName":"DR-Default", "maxIncoming":-1, "maxInstances":24, "minRpo":15 } |
Response Output: Make a note of the id of the policy from the response output.
|
1 2 3 4 5 6 7 8 9 10 |
{ "id":"8f563197-1ab6-48a8-af5c-bae2412e5756", "displayName":"DR-Default", "orgs":0, "minRpo":15, "maxInstances":24, "maxIncoming":-1, "allowIncoming":true, "allowOutgoing":true } |
3: Get vCD Organization Detail
Note: In below API call, Cloud-Site is my site name in SP side. Replace this with yours.
|
1 2 3 4 5 |
Method:GET URL:https://<vcav-fqdn>/inventory/orgs?site=Cloud-Site Headers:X-VCAV-Auth:<TokenValue> |
Response Output
|
1 2 3 4 5 6 |
{ "id":"b9fc81e0-058c-451d-947a-9268a32512b1", "name":"vStellar", "displayName":"vStellar,Inc", "enabled":true } |
4: Get Existing Policy Mapping Associated with an Org
|
1 2 3 4 5 |
Method:GET URL:https://<vcav-fqdn>/policy-mappings?site=Cloud-Site&orgs=vStellar Headers:X-VCAV-Auth:<TokenValue> |
Response Output: From the response output we can see org ‘vStellar’ is associated with policy ‘default’. This is vCAV default policy and its not configured with any replication attributes.
|
1 2 3 |
{ "vStellar":"default" } |
5: Update Policy Mapping Associated with an org:In this step we are associating an org with the new policy which we created in Step 2
|
1 2 3 4 5 6 7 8 9 |
Method:PATCH URL:https://<vcav-fqdn>/policies/<policy-id>/orgs/<org-name> Headers:X-VCAV-Auth:<TokenValue> Example: https://<vcav-fqdn>/policies/8f563197-1ab6-48a8-af5c-bae2412e5756/orgs/vStellar |
5: Verify Org-Policy Mapping
|
1 2 3 4 5 |
Method:GET URL:https://<vcavfqdn>/policy-mappings?site=Cloud-Site&orgs=vStellar Headers:X-VCAV-Auth:<TokenValue> |
Response Output: Below output shows that org ‘vStellar’ is now associated to policy ‘Dr-Default’ (uuid=8f563197-1ab6-48a8-af5c-bae2412e5756)
|
1 2 3 |
{ "vStellar":"8f563197-1ab6-48a8-af5c-bae2412e5756" } |
And that’s it for this post.
I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing 🙂