Information
The SDDC Manager is the orchestration engine of VMware Cloud Foundation. While the UI provides a user-friendly way to view your environment, the SDDC Manager API allows you to treat your infrastructure as a programmable resource. In this post, we focus on Domain Management, the core of VCF operations.
What is a VCF Domain?
In VCF, a domain is a logical boundary for management or workloads.
-
Management Domain: Created during the "Bring-up" process to host the core VCF management components.
-
Workload Domain: Created by users to host business applications and customer workloads.
Essential Domain Endpoints
The SDDC Manager API exposes several endpoints under the /v1/domains path to manage these entities:
1. Inventory Discovery
To see what domains currently exist in your environment, use a simple GET request.
-
Endpoint: GET /v1/domains
-
Why use it: This is the starting point for any automation script that needs to verify the state of the data center before performing an update or expansion.
2. Domain Health Monitoring
Maintaining uptime requires constant monitoring. You can query the specific status of a domain to see if it is "Active" or if there are pending configuration issues.
-
Endpoint: GET /v1/domains/{id}
-
Key Data: This returns details on associated vCenter Servers, NSX Managers, and cluster configurations.
Automating Domain Creation
The most powerful use of the API is the automated provisioning of a VI (Virtual Infrastructure) Workload Domain. This process usually involves three distinct API steps:
Step A: The Validation Call
Never attempt to create a domain without validating the configuration first.
-
Endpoint: POST /v1/domains/validations
-
Action: This checks if the hosts are reachable, if the network settings are valid, and if the license keys are correct.
Step B: The Creation Request
Once validation passes, you send the main configuration payload.
-
Endpoint: POST /v1/domains
-
Payload: Includes the vcenterSpec, clusterSpecs, and networkSpec.
Step C: Task Tracking
Because domain creation is a "long-running" operation, the API returns a Task ID immediately.
-
Logic: Your script should poll GET /v1/tasks/{id} until the status changes from IN_PROGRESS to SUCCESSFUL.
Example: Quick Python Check
import requests
# Assuming 'token' was retrieved in Blog 01
headers = {'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'}
base_url = "https://<sddc-manager-fqdn>/v1/domains"
response = requests.get(base_url, headers=headers)
domains = response.json()
for domain in domains['elements']:
print(f"Domain Name: {domain['name']} | Status: {domain['status']}")
Conclusion
By mastering the /v1/domains endpoints, you move from managing individual servers to managing entire cloud environments. Automated domain management reduces the "human error" factor and ensures that every environment in your data center is built to the exact same specification.
Add comment
Comments