All URIs are relative to https://{{vc}}
Method | HTTP request | Description |
---|---|---|
restComVmwareCisSessionPost | POST /rest/com/vmware/cis/session | Login |
restVcenterFolderGet | GET /rest/vcenter/folder | Find folers to create the VM in |
restVcenterResourcePoolGet | GET /rest/vcenter/resource-pool | Find a resource pool to use |
restVcenterVmPost | POST /rest/vcenter/vm | Create VM |
restComVmwareCisSessionPost($authorization)
Login
Login to vCenter API and retrieve Session using username and password. The environment variables username and password are passed via the
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new Swagger\Client\Api\VMAddApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$authorization = "authorization_example"; // string |
try {
$apiInstance->restComVmwareCisSessionPost($authorization);
} catch (Exception $e) {
echo 'Exception when calling VMAddApi->restComVmwareCisSessionPost: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
authorization | string | [optional] |
void (empty response body)
No authorization required
- Content-Type: multipart/form-data
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
restVcenterFolderGet()
Find folers to create the VM in
This request can be called to get a list of folders. To create a VM, we need the datastore and vm folders. If not previously captured during the /datacenter/ details, the response can be parsed for the vm and datastore folders.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new Swagger\Client\Api\VMAddApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
try {
$apiInstance->restVcenterFolderGet();
} catch (Exception $e) {
echo 'Exception when calling VMAddApi->restVcenterFolderGet: ', $e->getMessage(), PHP_EOL;
}
?>
This endpoint does not need any parameter.
void (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
restVcenterResourcePoolGet()
Find a resource pool to use
Grab the first resource pool returned
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new Swagger\Client\Api\VMAddApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
try {
$apiInstance->restVcenterResourcePoolGet();
} catch (Exception $e) {
echo 'Exception when calling VMAddApi->restVcenterResourcePoolGet: ', $e->getMessage(), PHP_EOL;
}
?>
This endpoint does not need any parameter.
void (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
restVcenterVmPost($body, $content_type)
Create VM
This request will create a VM using the environment variables for storage, resource pool and folder.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new Swagger\Client\Api\VMAddApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \stdClass; // object |
$content_type = "content_type_example"; // string |
try {
$apiInstance->restVcenterVmPost($body, $content_type);
} catch (Exception $e) {
echo 'Exception when calling VMAddApi->restVcenterVmPost: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
body | object | [optional] | |
content_type | string | [optional] |
void (empty response body)
No authorization required
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]