Mirage API has 33 methods.
Method |
Description |
|---|---|
Login |
Authenticates the user. |
Logout |
Logs out and terminates the current session. |
Policy_Query |
Queries all the policies in the Mirage Management Server. |
Volume_Query |
Queries the volumes in the Mirage Management Server. |
PendingDevice_Query |
Queries the devices that are in the pending assignment state. |
Cvd_Query |
Queries the CVDs that are in the Mirage Management Server. |
Cvd_Get |
Gets a CVD by Id. |
BaseLayer_Query |
Queries all the base layer images in the Mirage Management Server. |
AppLayer_Query |
Queries all the application layer images in Mirage Management Server. |
PendingDevice_CreateNewCvd |
Creates a new CVD for the pending devices. |
OsMigration_Begin |
Starts migration for the migration targets. |
OsMigration_BeginDownloadOnly |
Starts to download the base layer and app layers for the migration targets. |
OsMigration_ApplyDownloadOnlyMigration |
Starts to apply the base layer and app layers for the migration targets. |
OsMigration_QueryDownloadOnlyInProgress (Deprecated) |
Queries the CVDs which are downloading the base layer or app layers. |
OsMigration_QueryDownloadOnlyCompleted (Deprecated) |
Queries the CVDs which are finished downloading the base layer or app layers. |
Cvd_Archive |
Archives the CVDs in the Mirage Management system. |
Cvd_Delete |
Deletes the CVDs in the Mirage Management system. |
Cvd_Sync |
Synchronizes device information for the CVDs in the Mirage Management system. |
Cvd_ApplyPolicy |
Applies a policy to the specified CVDs. |
PendingDevice_Provision |
Provisions the specified devices with a base layer and app layers. |
Collection_Query |
Queries all CVD collections in the Mirage Management system. |
CollectionCvd_Query |
Queries all CVDs in the specific collection in the Mirage Management system. |
OsMigrationCvd_QueryDownloadOnly |
Queries the CVD Ids for download only migration. |
Assignment_ApplyDownloadOnly |
Applies the downloaded assignments in the Mirage Management system. |
Assignment_Query |
Queries the assignments in the Mirage Management system. |
Cvd_AssignBaseLayer |
Assigns a base layer to a CVD. |
Cvd_AssignBaseLayerDownloadOnly |
Downloads a base layer for a CVD. |
Cvd_UpdateAppLayer |
Updates app layers on a CVD. |
Cvd_UpdateAppLayerDownloadOnly |
Downloads app layers for a CVD. |
PendingDevice_ProvisionWithProvisionTarget |
Provision the pending devices. It provide the ability to change each device's machine name and join domain. |
Cvd_EnforceAllLayers |
Enforce all the layers on the CVDs. |
Cvd_AllowNetworkOperations |
Suspend/resume device network operations. |
Cvd_Restart |
Reboot the device. |
For more information about each method, including input parameters, return value, and faults, see the Mirage API Reference.
Login
Login logs a user in to Mirage. You must call this before calling any other method. Otherwise, Mirage returns the NotAuthenticated fault. The client must not log in again if its session is still valid. Otherwise, it will get the InvalidLogin fault. The user must have the Administrator, Web Help Desk, or Web Protection Manager role to log in successfully. For more information about roles, see the Managing Role-Based Access Control and Active Directory Groups section in the VMware Mirage Administrator's Guide.
Input:
username
password
Return:
ServerInformation
Note:If you update the Mirage API server to version 5.3 or later, you must update the client proxy.
Logout
Logout logs off the current user and invalidates the session.
Input:
None
Return:
None
Policy_Query
Policy_Query queries policies.
Input:
queryDefinition
Filter
Field
Type
Description
POLICY_ID
Id
Id of the policy.
POLICY_NAME
string
The name of the policy.
POLICY_IMAGEID
ImageId
ImageId of the policy.
Page
Starts at 1.
Return:
QueryResult
The type of element is PolicyDetails.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = new QueryFilterBeginsWith
{
Field = FilterField.POLICY_NAME,
Value = "VMware Mirage default CVD policy"
},
Page = 1 // Page starts from 1, not 0
};
QueryResult result = Client.Policy_Query(queryDefinition);
Volume_Query
Volume_Query queries a volume.
Input:
queryDefinition
Filter
Field
Type
Description
VOLUME_ID
Id
Id of the volume.
VOLUME_NAME
string
The name of the volume.
VOLUME_PATH
string
The path of the volume.
Page
Starts at 1.
Return:
QueryResult
The type of element is VolumeDetails.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.VOLUME_PATH,
Value = @"C:\MirageStorage"
},
Page = 1 // Page starts from 1, not 0
};
QueryResult result = Client.Volume_Query(queryDefinition);
PendingDevice_Query
PendingDevice_Query queries pending devices.
Input:
queryDefinition
Filter
Field
Type
Description
DEVICE_CONNECTION_STATE
bool
The connection state of the device.
DEVICE_ID
Id
The Id of the device.
DEVICE_MODEL_NAME
string
The model name of the device.
DEVICE_NAME
string
The name of the device.
DEVICE_OS
string
The OS version of the device.
DEVICE_OS_VERSION (Deprecated)
OsVersion
The OS version of the device.
DEVICE_USER_NAME
string
The user name of the device.
DEVICE_VENDOR_NAME
string
The vendor name of the device.
The DEVICE_OS filter field supports the following string filter values:
Value
Description
"XP"
Windows XP
"XP_EMBEDDED"
Windows XP Embedded
"VISTA"
Windows Vista x86
"VISTAX64"
Windows Vista x64
"WIN7"
Windows 7 x86
"WIN7_EMBEDDED"
Windows 7 x86 Embedded
"WIN7X64"
Windows 7 x64
"WIN7_EMBEDDEDX64"
Windows 7 x64 Embedded
"WIN8_0"
Windows 8 x86
"WIN8_0X64"
Windows 8 x64
"WIN8_1"
Windows 8.1 x86
"WIN8_1X64"
Windows 8.1 x64
"WINPE"
Windows PE 5
"Win10 x64"
Windows 10 x64
"Win10"
Windows 10
"Win Server 2012 R2"
Windows Server 2012 R2
Page
Starts at 1.
Return:
QueryResult
The type of element is DeviceDetails.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.DEVICE_OS_VERSION,
Value = OsVersion.WIN7X64
},
Page = 1 // Page starts from 1, not 0
};
QueryResult queryResult = Client.PendingDevice_Query(queryDefinition);
Cvd_Query
Cvd_Query queries CVDs.
Input:
queryDefinition
Filter
Field
Type
Description
CVD_CLIENT_STATE
string
The client state of the CVD.
CVD_DEVICE_CLIENT_STATUS (Deprecated)
ClientState
To filter by client state, see CVD_CLIENT_STATE.
CVD_DEVICE_CONNECTION_STATE
bool
The connection state of the CVD.
CVD_DEVICE_ID
Id
The device Id of the CVD.
CVD_DEVICE_OS
string
The device OS version of the CVD.
CVD_ID
Id
The Id of the CVD.
CVD_MACHINE_VERSION
ImageVersion
The machine version of the CVD.
CVD_NAME
string
The name of the CVD.
CVD_POLICY_ID
Id
The policy Id of the CVD.
CVD_POLICY_IMAGEID
ImageId
The policy ImageId of the CVD.
CVD_POLICY_NAME
string
The policy name of the CVD.
CVD_PROGRESS
long
The operation progress of the CVD.
CVD_USER_NAME
string
The user name of the CVD.
The CVD_CLIENT_STATE filter field supports the following string filter values:
Value
Description
"Idle"
Idle state.
"PendingRebbot"
Pending reboot state.
"ForceReboot"
Force reboot state.
"UploadInitializing"
Upload initializing state.
"Uploading"
Uploading state.
"RestorePrefetch"
Restore pre-fetching states.
"RestoreStreaming"
Restore streaming states.
"UpdateLayers"
Downloading image states.
"RebasePrefetching"
Restore and base layer update pre-fetching states.
"Migration"
Migration states.
"DriverLibraryUpdate"
Driver library updating states.
"RestoreUserData"
Restore and profile pre-fetching states.
"DeviceProvisioning"
Device provisioning states.
"AppLayerRecording"
App layer recording states.
"AppLayerCapture"
App layer capture states.
"Synchronizing"
Synchronizing states.
"PendingUpgrade"
Pending upgrade states.
"PendingRestore"
Pending restore states.
"PendingAssignment"
Pending assignment states.
"Suspended"
Suspended states.
"WaitingForService"
Waiting for service states.
"Throttled"
Throttled states.
"PendingUserAuthentication"
Pending user authentication states.
"Snoozed"
Snoozed states.
"BranchReflectorIsBusy"
Branch reflector is busy states.
"WaitingDeviceProvisioning"
Waiting for device provisioning states.
"RecordingAppLayer"
Recording app ;ayer states.
"NoPotentialBranchReflectors"
No Potential Branch Reflectors states.
"BranchReflectorIsCaching"
Branch Reflector Is Caching states.
"PendingGatewayLogin"
Pending authentication from Gateway states.
"PendingRebootStreaming"
Pending reboot for restore streaming states.
"RestoreInitializing"
Restore initializing states.
"UpdateLayersInitializing"
Download image initializing states.
"RebasePrefetchInitializing"
Restore and base layer update initializing states.
"MigrationInitializing"
Migration initializing states.
"DriverLibraryUpdateInitializing"
Driver library update initializing states.
"RestoreUserDataInitializing"
Restore user data initializing states.
"DeviceProvisoningInitializing"
Device provisioning initializing states.
"AppLayerRecordingInitializing"
App layer recording initializing states.
"AppLayerCaptureInitializing"
App layer capture initializing states.
"SynchronizingInitializing"
Synchronize initializing states.
"RecordingAppLayerInitializing"
Record app layer initializing states.
"RestoreStreamingInitializing"
Restore streaming initializing states.
"UploadChangesFinalizing"
Upload changes finalizing states.
"RestorePrefetchFinalizing"
Restore prefetching finalizing states.
"UpdateLayersFinalizing"
Download image finalizing states.
"RebasePrefetchFinalizing"
Restore and base layer update prefetching finalizing states.
"MigrationFinalizing"
Migration finalizing states.
"DriverLibraryUpdateFinalizing"
Driver library update finalizing states.
"RestoreUserDataFinalizing"
Restore user data finalizing states.
"DeviceProvisioningFinalizing"
Device provisioning finalizing states.
"AppLayerRecordingFinalizing"
App layer recording finalizing states.
"AppLayerCaptureFinalizing"
App layer capture finalizing states.
"RecordingAppLayerFinalizing"
Recording App Layer finalizing states.
"RestoreStreamingFinalizing"
Restore streaming finalizing states.
"SynchronizingFinalizing"
Synchronizing finalizing states.
The CVD_DEVICE_OS filter field supports the following string filter values:
Value
Description
"XP"
Windows XP
"XP_EMBEDDED"
Windows XP Embedded
"VISTA"
Windows Vista x86
"VISTAX64"
Windows Vista x64
"WIN7"
Windows 7 x86
"WIN7_EMBEDDED"
Windows 7 x86 Embedded
"WIN7X64"
Windows 7 x64
"WIN7X64_EMBEDDED"
Windows 7 x64 Embedded
"WIN8_0"
Windows 8 x86
"WIN8_0X64"
Windows 8 x64
"WIN8_1"
Windows 8.1 x86
"WIN8_1X64"
Windows 8.1 x64
"WINPE"
Windows PE 5
"Win10 x64"
Windows 10 x64
"Win10"
Windows 10
"Win Server 2012 R2"
Windows Server 2012 R2
Page
Starts at 1.
Return:
QueryResult
The type of element is CvdDetails.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.CVD_DEVICE_CONNECTION_STATE,
Value = true
},
Page = 1 // Page starts from 1, not 0
};
QueryResult queryResult = Client.Cvd_Query(queryDefinition);
Cvd_Get
Cvd_Get gets a CVD by Id.
Input:
Id
The Id of the CVD.
Return:
CvdDetails
The details of the CVD.
Example:
Id id = new Id
{
IdValue = 10024
};
CvdDetails cvdDetails = Client.Cvd_Get(id);
Note: If the queried Id does not exist, Cvd_Get will return an InvalidArgument fault.
BaseLayer_Query
BaseLayer_Query queries base layers from Mirage management server.
Input:
queryDefinition
Filter
Field
Type
Description
BASE_IMAGE_LAYER_NAME
string
The name of the base layer.
BASE_IMAGE_LAYER_ID
Id
The Id of the ImageId of the base layer.
BASE_IMAGE_LAYER_IMAGEID
ImageId
The ImageId of the base layer.
Page
Starts at 1.
Return:
QueryResult
The type of element is LayerDetails.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.BASE_IMAGE_LAYER_NAME,
Value = "Windows 7 x64"
},
Page = 1 // Page starts from 1, not 0
};
QueryResult result = Client.BaseLayer_Query(queryDefinition);
AppLayer_Query
AppLayer_Query queries app layers from Mirage management server.
Input:
queryDefinition
Filter
Field
Type
Description
BASE_IMAGE_LAYER_NAME
string
The name of the app layer.
BASE_IMAGE_LAYER_ID
Id
The Id of the ImageId of the app layer.
BASE_IMAGE_LAYER_IMAGEID
ImageId
The ImageId of the app layer.
Page
Starts at 1.
Return:
QueryResult
The type of element is LayerDetails.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.BASE_IMAGE_LAYER_NAME,
Value = "VMware View Agent-5.3.0-EN"
},
Page = 1 // Page starts from 1, not 0
};
QueryResult result = Client.AppLayer_Query(queryDefinition);
PendingDevice_CreateNewCvd
PendingDevice_CreateNewCvd creates new CVDs from existing pending devices.
Input:
deviceIds
A list of pending device Ids. These Ids can be queried from PendingDevice_Query. If there are invalid Ids in the list, they will be skipped and faults will be set in BatchResult. New CVDs will be created for devices whose Id is valid.
policyId
The imageId of a policy.
volumeId
The Id of the volume that is used to store the CVDs. If this parameter is null, the system automatically selects a volume to store the CVD.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which presents the result of creating the CVD. If OperationResult’s Success is true, it means that Mirage starts to create the CVD, and Result is the IdValue of the Id of the new CVD. Otherwise, check OperationResult’s MethodFault to get the error message that indicates why Mirage failed to create the CVD.
Example:
DeviceDetails[] deviceDetailsArr = GetDeviceDetailsArr(); Id[] deviceIds = deviceDetailsArr.Select(deviceDetails => deviceDetails.Id).ToArray(); PolicyDetails policyDetails = GetPolicyDetails(); VolumeDetails volumeDetails = GetVolumeDetails(); BatchResult result = client.PendingDevice_CreateNewCvd(cvdIds, policyDetails.ImageId, volumeDetails.Id);
OsMigrationBegin
OsMigration_Begin starts a migration.
Input:
migrationTargets
An array of MigrationTarget, which contains information for migration, such as Id of CVD, domain name, user, password, and so on. This method validates migration targets first, then starts to download the base layer and app layers. then it migrates. If some migration target fail to validate for some reasons, such as incorrect domain name, invalid CVD Id, and so on, they will be skipped, and other migration targets will continue to be processed.
baseLayerId
The imageId of the base layer.
appLayerIds
The ImageIds of app layers.
ignoreWarnings
Whether to ignore validation warnings. When ignoreWarnings is true, migration will start even if there are validation warnings. Otherwise, migration will not start.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which presents the result of calling this method. If OperationResult’s Success is true, it means that the migration is started. Otherwise, check OperationResult’s MethodFault to get the error message.
Example:
LayerDetails baseLayer = GetBaseLayer();
LayerDetails[] appLayers = GetAppLayers();
MigrationTarget migrationTarget = new MigrationTarget
{
CvdId = cvd.Id,
IdentityInfo = new MachineIdentityInfo
{
DomainMember = true,
DomainOrWorkgroupName = "mydomain.com",
User = "bob",
Password = "password"
}
};
client.OsMigration_Begin(new MigrationTarget[] { migrationTarget }, baseLayer.ImageId, appLayers.Select(appLayer => appLayer.ImageId).ToArray(), true /* ignore warnings */);
OsMigration_BeginDownloadOnly
OsMigration_BeginDownloadOnly starts to download the base layer and the app layers for a migration.
Input:
migrationTargets
An array of MigrationTargets, which contains information for migration, such as the Id of CVD, domain name, user, password, and so on. This method validates the migration targets first, and then starts to download the base layer and app layers. Validation includes domain name, CVD Id, and so on. If some migration targets fail to validate, they will be skipped, and other migration targets will continue to be processed.
baseLayerId
The imageId of the base layer.
appLayerIds
The ImageIds of app layers.
ignoreWarnings
Whether to ignore validation warnings. When ignoreWarnings is true, migration will start even if there are validation warnings. Otherwise, migration will not start.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which presents the result of calling this method. When OperationResult’s Success is true, it means that Mirage starts to download the base layer and app layers. Otherwise, check OperationResult’s MethodFault to get the error message.
Example:
LayerDetails baseLayer = GetBaseLayer();
LayerDetails[] appLayers = GetAppLayers();
MigrationTarget migrationTarget = new MigrationTarget
{
CvdId = cvd.Id,
IdentityInfo = new MachineIdentityInfo
{
DomainMember = true,
DomainOrWorkgroupName = "mydomain.com",
User = "bob",
Password = "password"
}
};
client.OsMigration_BeginDownloadOnly(new MigrationTarget[] { migrationTarget }, baseLayer.ImageId, appLayers.Select(appLayer => appLayer.ImageId).ToArray(), true /* ignore warnings */);
OsMigration_ApplyDownloadOnlyMigration
OsMigration_ApplyDownloadOnlyMigration applies the downloaded base layer and app layers.
Input:
CvdIds
A list of CVD Ids that are to be migrated. This method validates the cvdIds first and then starts to apply migration. If some CVDs are not valid for applying migration, they are skipped while other CVDs will migrate.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult that presents the result of calling this method. When OperationResult’s Success is true, it means that migration starts successfully. Otherwise, it means that migration fails.
Example:
Id[] cvdIds = GetCvdIds(); BatchResult results = client.OsMigration_ApplyDownloadOnlyMigration(cvdIds);
OsMigration_QueryDownloadOnlyInProgress (Deprecated)
OsMigration_QueryDownloadOnlyInProgress queries CVDs which are downloading base and app layers.
Input:
queryDefinition
Filter
Must be null.
Page
Starts at 1.
Return:
QueryResult
The type of element is CvdDetails.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = null,
Page = 1 //Page starts from 1, not 0
};
QueryResult queryResult = Client.OsMigration_QueryDownloadOnlyInProgress(queryDefinition);
Note: If the filter is not null, OsMigration_QueryDownloadOnlyInProgress will throw the NotSupportedFault exception.
OsMigration_QueryDownloadOnlyCompleted (Deprecated)
OsMigration_QueryDownloadOnlyCompleted queries CVDs which have finished downloading base and app layers.
Input:
queryDefinition
Filter
Must be null.
Page
Starts at 1.
Return:
QueryResult
The type of element is CvdDetails.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = null,
Page = 1 //Page starts from 1, not 0
};
QueryResult queryResult = Client.OsMigration_QueryDownloadOnlyCompleted(queryDefinition);
Note: If the filter is not null, OsMigration_QueryDownloadOnlyCompleted will throw the NotSupportedFault exception.
Cvd_Archive
Cvd_Archive archives the CVDs in the Mirage Management system.
Input:
cvdIds
The ids of the requested CVDs, The list should not contain more than 500 entries. When there are invalid CVDs in the list, this method only archives the valid CVD Ids. Invalid CVD Ids are skipped.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which presents the result of archiving the CVD. When OperationResult's Success is true, it means the Mirage starts to archive the CVD, and the Result is the IdValue of Id of the CVD. Otherwise, please check OperationResult's MethodFault to get message why it is failed to archive the CVD.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.CVD_USER_NAME,
Value = "ObsoleteUser"
},
Page = 1
};
QueryResult cvdQuery = client.Cvd_Query(queryDefinition);
int length = cvdQuery.Elements.Length;
if (length <= 0)
return;
Id[] ids = new Id[length];
for (int i = 0; i < length; ++i)
{
ids[i] = ((CvdDetails)cvdQuery.Elements[i]).Id;
}
BatchResult batchResult = client.Cvd_Archive(ids);
for(int i = 0; i < length; ++i)
{
OperationResult opResult = batchResult.results[i];
if (!opResult.Success)
Console.WriteLine("failed to archive CVD {0}, error: {1}", ids[i].IdValue, opResult.Fault.Message);
}
Cvd_Delete
Cvd_Delete deletes the CVDs in the Mirage Management system.
Input:
cvdIds
The ids of the requested CVDs. The list should not contain more than 500 entries. When there are invalid CVDs in the list, this method only deletes the valid CVD Ids. Invalid CVD Ids are skipped.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which presents the result of deleting the CVD. When OperationResult's Success is true, it means the Mirage starts to delete the CVD, and the Result is the IdValue of Id of the CVD. Otherwise, please check OperationResult's MethodFault to get message why it is failed to delete the CVD.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.CVD_USER_NAME,
Value = "ObsoleteUser"
},
Page = 1
};
QueryResult cvdQuery = client.Cvd_Query(queryDefinition);
int length = cvdQuery.Elements.Length;
if (length <= 0)
return;
Id[] ids = new Id[length];
for (int i = 0; i < length; ++i)
{
ids[i] = ((CvdDetails)cvdQuery.Elements[i]).Id;
}
BatchResult batchResult = client.Cvd_Delete(ids);
for(int i = 0; i < length; ++i)
{
OperationResult opResult = batchResult.results[i];
if (!opResult.Success)
Console.WriteLine("failed to delete CVD {0}, error: {1}", ids[i].IdValue, opResult.Fault.Message);
}
Cvd_Sync
Cvd_Sync synchronizes the device information of the CVDs in the Mirage Management system.
Input:
cvdIds
The ids of the requested CVDs. The list should not contain more than 500 entries. When there are invalid CVDs in the list, this method only synchronizes the valid CVD Ids. Invalid CVD Ids are skipped.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which presents the result of synchronizing the CVD. When OperationResult's Success is true, it means the Mirage starts to synchronize the CVD, and the Result is the IdValue of Id of the CVD. Otherwise, please check OperationResult's MethodFault to get message why it is failed to synchronize the CVD.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.CVD_USER_NAME,
Value = "John"
},
Page = 1
};
QueryResult cvdQuery = client.Cvd_Query(queryDefinition);
int length = cvdQuery.Elements.Length;
if (length <= 0)
return;
Id[] ids = new Id[length];
for (int i = 0; i < length; ++i)
{
ids[i] = ((CvdDetails)cvdQuery.Elements[i]).Id;
}
BatchResult batchResult = client.Cvd_Sync(ids);
for(int i = 0; i < length; ++i)
{
OperationResult opResult = batchResult.results[i];
if (!opResult.Success)
Console.WriteLine("failed to sync CVD {0}, error: {1}", ids[i].IdValue, opResult.Fault.Message);
}
Cvd_ApplyPolicy
Cvd_ApplyPolicy applies a policy to the given CVDs.
Input:
cvdIds When there
The ids of the requested CVDs. The list should not contain more than 500 entries. When there are invalid CVDs in the list, this method only applies a policy for valid CVD Ids. Invalid CVD Ids are skipped.
policyId
The ImageId of the target policy.
Return Value:
BatchResult
For each CVD, BatchResult has an OperationResult, which presents the result of applying the CVD policies. When OperationResult's Success is true, it means the policy of CVD has been applied, and the Result is the IdValue of Id of the CVD. Otherwise, please check OperationResult's MethodFault to get message why it is failed to apply the CVD policies.
Example:
QueryDefinition queryDefinition = new QueryDefinition
{
Page = 1
};
QueryResult queryResult = Client.Cvd_Query(queryDefinition);
CvdDetails[] cvds = queryResult.Elements.Cast<CvdDetails>().ToArray();
if (!cvds.Any())
{
return;
}
Id[] ids = cvds.Select(cvd => cvd.Id).ToArray();
int length = ids.Length;
queryDefinition = new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.POLICY_NAME,
Value = "Win7 Policy"
},
Page = 1
};
queryResult = Client.Policy_Query(queryDefinition);
PolicyDetails[] policies = queryResult.Elements.Cast<PolicyDetails>().ToArray();
if (!policies.Any())
{
return;
}
BatchResult result = Client.Cvd_ApplyPolicy(ids, policies[0].ImageId);
for (int i = 0; i < length; i++)
{
OperationResult opResult = result.results[i];
if (opResult.Success == false)
{
Console.WriteLine("failed to apply policy for Cvd {0}, error: {1}", ids[i].IdValue, opResult.Fault.Message);
}
}
PendingDevice_Provision
PendingDevice_Provision provisions the devices with a base layer and app layers.
Input:
pendingDevices
pendindDevices is a list of Ids of pending devices. The list should not contain more than 500 entries. When there are invalid devices in the list, this method only provisions the valid device Ids. Invalid device Ids are skipped.
policyImageId
The policy ImageId that is applied.
baseLayerImageId
The base layer ImageId that is used to provision the devices.
appLayerImageIds
The app layer ImageId that is used to provision the devices.
identityInfo
The machine identity used to join domain or workgroup.
volumeId
The volume Id in which the CVD is stored. If this parameter is null, the system automatically selects a volume to store the CVD.
ignoreWarnings
Ignore validation warnings or not. When ignoreWarnings is true, provisioning will start even if there are warnings of validation, otherwise provisioning will not start when there is a warning.
Return Value:
BatchResult
For each CVD, BatchResult has an OperationResult, which presents the result of provision the device. When OperationResult's Success is true, it means the Mirage starts to provision the device, and the Result is the IdValue of Id of the new CVD. Otherwise, please check OperationResult's MethodFault to get message why it is failed to provision the device.
Example:
QueryResult pendingDeviceQuery = client.PendingDevice_Query(new QueryDefinition { Page = 1 });
int length = pendingDeviceQuery.Elements.Length;
if (length <= 0)
return;
QueryResult baseLayerQuery = client.BaseLayer_Query(new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.BASE_IMAGE_LAYER_IMAGEID,
Value = new ImageId
{
Id = new Id
{
IdValue = 1
},
Version = new ImageVersion
{
Major = 1,
Minor = 0
}
}
},
Page = 1
});
if (baseLayerQuery.Elements.Length <= 0)
return;
LayerDetails baseLayer = (LayerDetails)baseLayerQuery.Elements[0];
QueryResult appLayerQuery = client.AppLayer_Query(new QueryDefinition {Page = 1});
ImageId[] appLayers = null;
if (appLayerQuery.Elements.Length > 0)
appLayers = appLayerQuery.Elements.Select(layer => ((LayerDetails)layer).ImageId).ToArray();
QueryResult policyQuery = client.Policy_Query(new QueryDefinition { Page = 1 });
if (policyQuery.Elements.Length <= 0)
return;
PolicyDetails policy = (PolicyDetails)policyQuery.Elements[0];
QueryResult volumeQuery = client.Volume_Query(new QueryDefinition { Page = 1 });
if (volumeQuery.Elements.Length <= 0)
return;
VolumeDetails volume = (VolumeDetails)volumeQuery.Elements[0];
Id[] ids = new Id[length];
for (int i = 0; i < length; ++i)
ids[i] = ((DeviceDetails) pendingDeviceQuery.Elements[i]).Id;
MachineIdentityInfo identityInfo = new MachineIdentityInfo
{
DomainMember = true,
DomainOrWorkgroupName = "domainName",
User = "user",
Password = "password"
};
BatchResult batchResult = client.PendingDevice_Provision(ids, policy.ImageId, baseLayer.ImageId, appLayers, identityInfo, volume.Id, false);
for(int i = 0; i < length; ++i)
{
OperationResult opResult = batchResult.results[i];
if (!opResult.Success)
{
Console.WriteLine("failed to provision device {0}, error: {1}", ids[i].IdValue, opResult.Fault.Message);
}
}
Collection_Query
Collection_Query queries all CVD collections in the Mirage Management system.
Input:
queryDefinition
Filter
Filter
Type
Description
COLLECTION_DESCRIPTION
string
The description of the collection.
COLLECTION_ID
Id
The Id of the collection.
COLLECTION_NAME
string
The name of the collection.
Page
Starts at 1.
Return Value:
QueryResult
The type of element is CollectionDetails.
Example:
QueryResult queryResult = Client.Collection_Query(new QueryDefinition{Filter = null, Page = 1});
if (!queryResult.Elements.Any())
{
return;
}
CollectionDetails[] collections = queryResult.Elements.Cast<CollectionDetails>().ToArray();
// do work with collections
CollectionCvd_Query
Queries all CVDs in the specific collection in the Mirage Management system.
Input:
collectionId
The Id of the collection.
queryDefinition
Filter
Field
Type
Description
CVD_CLIENT_STATE
string
The client state of the CVD.
CVD_DEVICE_CLIENT_STATUS (Deprecated)
ClientState
To filter with client state, see CVD_CLIENT_STATE.
CVD_DEVICE_CONNECTION_STATE
bool
The connection state of the CVD.
CVD_DEVICE_ID
Id
The device Id of the CVD.
CVD_DEVICE_OS
string
The device OS version of the CVD.
CVD_ID
Id
The Id of the CVD.
CVD_MACHINE_VERSION
ImageVersion
The machine version of the CVD.
CVD_NAME
string
The name of the CVD.
CVD_POLICY_ID
Id
The policy Id of the CVD.
CVD_POLICY_IMAGEID
ImageId
The policy ImageId of the CVD.
CVD_POLICY_NAME
string
The policy name of the CVD.
CVD_PROGRESS
long
The operation progress of the CVD.
CVD_USER_NAME
string
The user name of the CVD.
The CVD_CLIENT_STATE filter field supports the following string filter values:
Value
Description
"Idle"
Idle state.
"PendingReboot"
Pending reboot state.
"ForceReboot"
Force reboot state.
"UploadInitializing"
Upload initializing state.
"RestorePrefetch"
Restore prefetching states.
"RestoreStreaming"
Restore streaming states.
"UpdateLayers"
Downloading image states.
"RebasePrefetching"
Restore and base layer update prefetching states.
"Migration"
Migration states.
"DriverLibraryUpdate"
Driver library updating states.
"RestoreUserData"
Restore and profile prefetching states.
"DeviceProvisioning"
Device provisioning states.
"AppLayerCapture"
App layer capture states.
"Synchronizing"
Synchronizing states.
"PendingUpgrade"
Pending upgrade states.
"PendingRestore"
Pending restore states.
"PendingAssignment"
Pending assignment states.
"Suspended"
Suspended states.
"WaitingForService"
Waiting for service states.
"Throttled"
Throttled states.
"PendingUserAuthentication"
Pending user authentication states.
"Snoozed"
Snoozed states.
"BranchReflectorIsBusy"
Branch reflector is busy states.
"WaitingDeviceProvisioning"
Waiting for device provision states.
"RecordingAppLayer"
Recording app layer states.
"NoPotentialBranchReflectors"
No potential branch reflectors states.
"BranchReflectorIsCaching"
Branch reflector is caching states.
"PendingGatewayLogin"
Pending authentication from Gateway states.
"PendingRebootStreaming"
Pending reboot for restore streaming states.
"RestoreInitializing"
Restore initializing states.
"UpdateLayersInitializing"
Download image initializing states.
"RebasePrefetchInitializing"
Restore and base layer update initializing states.
"MigrationInitializing"
Migration initializing states.
"DriverLibraryUpdateInitializing"
Driver library update initializing states.
"RestoreUserDataInitializing"
Restore user data initializing states.
"DeviceProvisoningInitializing"
Device provisioning initializing states.
"AppLayerRecordingInitializing"
App layer recording initializing states.
"AppLayerCaptureInitializing"
App layer capture initializing states.
"SynchronizingInitializing"
Synchronizing initializing states.
"RecordingAppLayerInitializing"
Record app layer initializing states.
"RestoreStreamingInitializing"
Restore streaming initializing states.
"UploadChangesFinalizing"
Upload changes finalizing states.
"RestorePrefetchFinalizing"
Restore prefetch finalizing states.
"UpdateLayersFinalizing"
Download image finalizing states.
"RebasePrefetchFinalizing"
Restore and base layer update prefetch finalizing states.
"MigrationFinalizing"
Migration finalizing states.
"DriverLibraryUpdateFinalizing"
Driver library update finalizing states.
"RestoreUserDataFinalizing"
Restore user data finalizing states.
"DeviceProvisioningFinalizing"
Device provisioning finalizing states.
"AppLayerRecordingFinalizing"
App layer recording finalizing states.
"AppLayerCaptureFinalizing"
App layer capture finalizing states.
"RecordingAppLayerFinalizing"
Recording app layer finalizing states.
"RestoreStreamingFinalizing"
Restore streaming finalizing states.
"SynchronizingFinalizing"
Synchronizing finalizing states.
The CVD_DEVICE_OS filter field supports the following string filter values:
Value
Description
"XP"
Windows XP
"XP_EMBEDDED"
Windows XP Embedded
"VISTA"
Windows Vista x86
"VISTAX64"
Windows Vista x64
"WIN7"
Windows 7 x86
"WIN7_EMBEDDED"
Windows 7 x86 Embedded
"WIN7X64"
Windows 7 x64
"WIN7_EMBEDDEDX64"
Windows 7 x64 Embedded
"WIN8_0"
Windows 8 x86
"WIN8_0X64"
Windows 8 x64
"WIN8_1"
Windows 8.1 x86
"WIN8_1X64"
Windows 8.1 x64
"WINPE"
Windows PE 5
"Win10 x64"
Windows 10 x64
"Win10"
Windows 10
"Win Server 2012 R2"
Windows Server 2012 R2
Page
Starts at 1.
Return:
QueryResult
The type of element is CvdDetails.
Example:
QueryResult queryResult = Client.Collection_Query(new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.COLLECTION_NAME,
Value = "static collection"
},
Page = 1
});
if (queryResult == null || queryResult.Elements == null || !queryResult.Elements.Any())
{
return;
}
CollectionDetails collection = queryResult.Elements.Cast<CollectionDetails>().ToArray()[0];
queryResult = Client.CollectionCvd_Query(collection.Id, new QueryDefinition { Page = 1 });
if (queryResult != null && queryResult.Elements != null)
{
if (!queryResult.Elements.Any())
{
return;
}
CvdDetails[] cvds = queryResult.Elements.Cast<CvdDetails>().ToArray();
foreach (CvdDetails cvdDetails in cvds)
{
Console.WriteLine("ID: {0}, device ID: {1}, policy ID: {2}, machine version: {3}.{4}",
cvdDetails.Id.IdValue, cvdDetails.DeviceId.IdValue, cvdDetails.PolicyId.IdValue,
cvdDetails.MachineVersion.Major, cvdDetails.MachineVersion.Minor);
}
}
OsMigrationCvd_QueryDownloadOnly
OsMigrationCvd_QueryDownloadOnly queries the CVD Ids for download only migration.
Input:
QueryDefinition
Filter
Field
Type
Description
CVD_ID
Id
The Id of the CVD.
DOWNLOAD_ONLY_MIGRATION_STATUS
string
The status of the download only migration
Page
Starts at 1.
Return:
QueryResult
The type of element is CvdDownloadOnlyMigrationDetails.
Example:
int page = 1;
int total = 0;
while (true)
{
QueryDefinition query = new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.DOWNLOAD_ONLY_MIGRATION_STATUS,
Value = "Failed"
},
Page = page
};
QueryResult result = Client.MigrationCvd_QueryDownloadOnly(query);
if (result != null && result.Elements != null)
{
if (result.Elements.Length == 0)
{
return;
}
foreach (CvdDownloadOnlyMigrationDetails migration in result.Elements)
{
Console.WriteLine("ID: {0}, Status: {1}", migration.CvdId.IdValue, migration.DownloadOnlyMigrationStatus);
}
total += result.Elements.Length;
page ++;
continue;
}
break;
}
Console.WriteLine("Total number: {0}", total);
Assignment_ApplyDownloadOnly
Assignment_ApplyDownloadOnly applies the downloaded assignments.
Input:
assignmentIds
The id(s) of the assignment(s). The list should not contain more than 500 entries.
onlyCompleted
Only apply the assignments that completed downloading or not.
Return:
BatchResult
For each assignment, BatchResult has an OperationResult, which displays the result of applying assignment. If OperationResult's Success is true, Mirage applies the assignment, and the Result is the IdValue of Id of the assignment. If the Success is false, refer to the MethodFault of OperationResult. Use Assignment_Query to get detailed information of new generated assignments.
Example:
Id[] assignmentIds = GetDownloadOnlyAssignmentIds();
BatchResult results = Assignment_ApplyDownloadOnly(assignmentIds, false);
QueryFilter filter = new QueryFilterEquals
{
Field = FilterField.ASSIGNMENT_TASK_NAME,
Value = "ApplyLayers"
};
QueryResult queryResult = Client.Assignment_Query(new QueryDefinition { Filter = filter, Page = 1 });
//check detailed status of apply layers assignment.
Assignment_Query
Assignment_Query queries assignments in the Mirage Management system.
Input:
queryDefinition
Filter
Field
Type
Description
ASSIGNMENT_CVD_ID
Id
The CVD Id of the assignment.
ASSIGNMENT_CVD_NAME
string
The CVD Name of the assignment.
ASSIGNMENT_ID
Id
The Id of the assignment.
ASSIGNMENT_LAYER_NAME
string
The layer name of the assignment.
ASSIGNMENT_STATUS
string
The status of the assignment.
ASSIGNMENT_TASK_NAME
string
The task name of the assignment.
ASSIGNMENT_TYPE
string
The type of the assignment.
ASSIGNMENT_USERNAME
string
The name of the user that initiates the assignment.
The ASSIGNMENT_STATUS filter field supports the following string filter values.
Value
Description
"Pending"
Pending status.
"Downloading"
Downloading status.
"Committing"
Committing status.
"Done"
Done status.
"Blocked"
Blocked status.
"Throttled"
Throttled status.
"Rejected"
Rejected status.
"Cancelled"
Canceled status.
"Total"
Total status.
"PendingBiCopy"
PendingBiCopy status.
The ASSIGNMENT_TASK_NAME filter field supports the following string filter values.
Value
Description
"AssignBaseImage"
AssignBaseImage task.
"Migration"
Migration task.
"DeviceProvisioning"
DeviceProvisioning task.
"AssignAppLayer"
AssignAppLayer task.
"Enforce"
Enforce task.
"RemoveApp"
RemoveApp task.
"MigrateDownloadOnly"
MigrateDownloadOnly task.
"BaseImageDownloadOnly"
BaseImageDownloadOnly task.
"AppLayerDownloadOnly"
AppLayerDownloadOnly task.
"ApplyLayers"
ApplyLayers task.
The ASSIGNMENT_TYPE filter field supports the following string filter values.
Value
Description
"AssignBaseLayer"
AssignBaseLayer type.
"RemoveBaseLayer"
RemoveBaseLayer type.
"MigrationBaseLayer"
MigrationBaseLayer type.
"DeviceProvisioningBaseLayer"
DeviceProvisioningBaseLayer type.
"DownloadOnlyBaseLayer"
DownloadOnlyBaseLayer type.
"DownloadOnlyRemoveBaseLayer"
DownloadOnlyRemoveBaseLayer type.
"MigrationBaseLayerDownloadOnly"
MigrationBaseLayerDownloadOnly type
"AssignAppLayer"
AssignAppLayer type.
"RemoveAppLayer"
RemoveAppLayer type.
"MigrationAppLayer"
MigrationAppLayer type.
"DeviceProvisioningAppLayer"
DeviceProvisioningAppLayer type.
"DownloadOnlyAppLayer"
DownloadOnlyAppLayer type.
"DownloadOnlyRemoveAppLayer"
DownloadOnlyRemoveAppLayer type
"MigrationAppLayerDownloadOnly"
MigrationAppLayerDownloadOnly type
Page
Starts at 1.
Return:
QueryResult
The type of element is AssignmentDetails.
Example:
QueryFilter filter = new QueryFilterEquals
{
Field = FilterField.ASSIGNMENT_TYPE,
Value = "DownloadOnlyBaseLayer"
};
QueryResult queryResult = Client.Assignment_Query(new QueryDefinition { Filter = filter, Page = 1 });
if (!queryResult.Elements.Any())
{
return;
}
AssignmentDetails[] assignments = queryResult.Elements.Cast<AssignmentDetails>().ToArray();
Cvd_AssignBaseLayer
Cvd_AssignBaseLayer assigns a base layer to a CVD. This method first validates the CVD and base layer, then it assigns the base layer to the CVD.
Input:
cvdIds
cvdIds is a list of the CVD Ids. The list should not contain more than 500 entries. In the event that there are invalid CVD Ids in the list, this method only processes the valid CVD Ids.
baseLayerImageId
The base layer ImageId that is assigned to the CVD.
ignoreWarnings
Ignore validation warnings or not. If ignoreWarnings is true, base layer assignment procedures proceed even if there are validation warnings. Otherwise, base layer assignment procedures do not proceed.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which displays the result of assigning a base layer to a CVD. If OperationResult's Success is true, Mirage assigns the base layer, and the Result is the IdValue of Id of the CVD. If the Success is false, refer to the MethodFault of OperationResult.
Example:
Id[] cvdIds = GetCvdIds(); ImageId baseLayerId = GetBaseLayerImageId(); Client.Cvd_AssignBaseLayer(cvdIds, baseLayerId, true);
Cvd_AssignBaseLayer creates the assignment of type "AssignBaseLayer". You can query assignment for detailed operation status.
Cvd_AssignBaseLayerDownloadOnly
Cvd_AssignBaseLayerDownloadOnly downloads a base layer for a CVD. This method first validates the CVD and base layer, then it downloads the base layer.
Input:
cvdIds
cvdIds is a list of the CVD Ids. The list should not contain more than 500 entries. In the event that there are invalid CVD Ids in the list, this method only processes the valid CVD Ids.
baseLayerImageId
The base layer ImageId that is assigned to the CVD.
ignoreWarnings
Ignore validation warnings or not. If ignoreWarnings is true, base layer download procedures proceed even if there are validation warnings. If ignoreWarnings is false, base layer download procedures do not proceed.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which displays the result of updating app layers on a CVD. If the OperationResult's Success is true, Mirage downloads the base layer, and the Result is the IdValue of Id of the CVD. If the Success is false, refer to the MethodFault of OperationResult.
Example:
Id[] cvdIds = GetCvdIds(); ImageId baseLayerId = GetBaseLayerImageId(); Client.Cvd_AssignBaseLayerDownloadOnly(cvdIds, baseLayerId, true);
Cvd_AssignBaseLayerDownloadOnly creates the assignments of type "DownloadOnlyBaseLayer". You can query assignment for detailed operation status.
Cvd_UpdateAppLayer
Cvd_UpdateAppLayer updates app layers on a CVD. This method first validates the CVD and app layers, then it updates the app layers.
Input:
cvdIds
cvdIds is a list of the CVD Ids. The list should not contain more than 500 entries. In the event that there are invalid CVD Ids in the list, this method only processes the valid CVD Ids.
addAppLayerImageIds
The ImageId of the app layers that are assigned to the CVD.
removeAppLayerImageIds
The ImageId of the app layers that are removed from the CVD.
ignoreWarnings
Ignore validation warnings or not. If ignoreWarnings is true, app layers update procedures proceed even if there are validation warnings. If ignoreWarnings is false, app layers update procedures do not proceed.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which displays the result of updating app layers on a CVD. If OperationResult's Success is true, Mirage updates the app layers, and the Result is the IdValue of Id of the CVD. If Success is false, refer to the MethodFault of OperationResult.
Example:
Id[] cvdIds = GetCvdId(); ImageId[] addLayerIds = GetAddAppLayerImageIds(); ImageId[] removeLayerIds = GetRemoveAppLayerImageIds(); Client.Cvd_UpdateAppLayer(cvdIds, addLayerIds, removeLayerIds, true);
Cvd_UpdateAppLayer creates the assignments of type "AssignAppLayer" and "RemoveAppLayer". You can query assignment for detailed operation status.
Cvd_UpdateAppLayerDownloadOnly
Cvd_UpdateAppLayerDownloadOnly downloads app layers for a CVD. This method first validates the CVD and app layers, then it downloads the app layers.
Input:
cvdIds
cvdIds is a list of the CVD Ids. The list should not contain more than 500 entries. In the event that there are invalid CVD Ids in the list, this method only processes the valid CVD Ids.
addAppLayerImageIds
The ImageId of the app layers that are assigned to the CVD.
removeAppLayerImageIds
The ImageId of the app layers that removed from the CVD.
ignoreWarnings
Ignore validation warnings or not. If ignoreWarnings is true, app layers download procedures proceed even if there are validation warnings. If ignoreWarnings is false, app layers download procedures do not proceed.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which displays the result of downloading app layers on a CVD. If the OperationResult's Success is true, Mirage downloads the app layers, and the Result is the IdValue of Id of the CVD. If the Success is false, refer to the MethodFault of OperationResult.
Example:
Id[] cvdIds = GetCvdId(); ImageId[] addLayerIds = GetAddAppLayerImageIds(); ImageId[] removeLayerIds = GetRemoveAppLayerImageIds (); Client.Cvd_UpdateAppLayerDownloadOnly(cvdIds, addLayerIds, removeLayerIds, true);
Cvd_UpdateAppLayerDownloadOnly creates the assignments of type "DownloadOnlyAppLayer" and "DownloadOnlyRemoveAppLayer". You can query assignment for detailed operation status.
PendingDevice_ProvisionWithProvisionTarget
PendingDevice_ProvisionWithProvisionTarget provisions the pending devices. It provides the ability to change each device's machine name and join domain.
Input:
pendingDevices
pendingDevices is a list of the pending devices. Each element of the list contains the pending device ID and the desired machine name and domain information after provision.
policyImageId
The policy ImageId that is applied.
baseLayerImageId
The base layer ImageId that is used to provision the devices.
appLayerImageIds
The app layer ImageId that is used to provision the devices.
volumeId
The volume Id in which the CVD is stored. If this parameter is null, the system automatically selects a volume to store the CVD.
ignoreWarnings
Ignore validation warnings or not. When ignoreWarnings is true, provisioning will start even if there are warnings of validation, otherwise provisioning will not start when there is a warning.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which displays the result of downloading app layers on a CVD. If the OperationResult's Success is true, Mirage downloads the app layers, and the Result is the IdValue of Id of the CVD. If the Success is false, refer to the MethodFault of OperationResult.
Example:
QueryResult pendingDeviceQuery = client.PendingDevice_Query(new QueryDefinition{ Page = 1 });
int length = pendingDeviceQuery.Elements.Length;
if (length < 0)
return;
QueryResult baseLayerQuery = client.BaseLayer_Query(new QueryDefinition
{
Filter = new QueryFilterEquals
{
Field = FilterField.BASE_IMAGE_LAYER_ID,
Value = new ImageId
{
Id = new Id
{
IdValue = 1
},
Version = new ImageVersion
{
Major = 1,
Minor = 0
}
}
},
Page = 1
});
if (baseLayerQuery.Elements.Length <= 0)
return;
LayerDetails baseLayer = (LayerDetails)baseLayerQuery.Elements[0];
QueryResult appLayerQuery = client.AppLayer_Query(new QueryDefinition { Page = 1 });
ImageId[] appLayers = null;
if (appLayerQuery.Elements.Length > 0)
appLayers = appLayerQuery.Elements.Select(layer => ((LayerDetails)layer).ImageId).ToArray();
QueryResult policyQuery = client.Policy_Query(new QueryDefinition { Page = 1 });
if (policyQuery.Elements.Length <= 0)
return;
PolicyDetails policy = (PolicyDetails)policyQuery.Elements[0];
QueryResult volumeQuery = client.Volume_Query(new QueryDefinition { Page = 1 });
if (volumeQuery.Elements.Length <= 0)
return;
VolumeDetails volume = (VolumeDetails)volumeQuery.Elements[0];
ProvisionTarget[] targets = new ProvisionTarget[length];
for (int i = 0; i < length; ++i)
{
targets[i].PendingDeviceId = ((DeviceDetails)pendingDeviceQuery.Elements[i]).Id;
targets[i].IdentityInfo = new MachineIdentityInfo
{
DomainMember = true,
DomainOrWorkgroupName = "domainName",
User = "user",
Password = "password",
MachineName = string.Format("Machine-{0}", i)
};
}
BatchResult batchResult = client.PendingDevice_ProvisionWithProvisionTarget(targets, policy.ImageId, baseLayer.ImageId, appLayers, volume.Id, false);
for (int i = 0; i < length; ++i)
{
OperationResult opResult = batchResult.results[i];
if (!opResult.Success)
{
Console.WriteLine("failed to provision device {0}, error: {1}", targets[i].PendingDeviceId.IdValue,
opResult.Fault.Message);
}
}
Cvd_EnforceAllLayers
Cvd_EnforceAllLayers enforce all the layers on the CVDs.
Input:
cvdIds
cvdIds is a list of the CVD ids. The list should not contain more than 500 entries. In the event that there are invalid CVD Ids in the list, this method only processes the valid CVD Ids.
cleanUserData
cleanUserData indicates to remove the user's data.
ignoreWarnings
ignoreWarnings used to ignore the validation warnings.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which displays the result of enforcing layers to a CVD. If OperationResult's Success is true, Mirage will create assignment for each layer of the CVD, and the Result is the IdValue of Id of the CVD. If the Success is false, refer to the MethodFault of OperationResult.
Example:
Id[] cvdIds = GetCvdId(); Client.Cvd_EnforceAllLayers(cvdIds, false, true);
Cvd_AllowNetworkOperations
Cvd_AllowNetworkOperations can be used to suspend or resume the device's network operations.
Input:
cvdIds
cvdIds is a list of the CVD Ids. The list should not contain more than 500 entries. In the event that there are invalid CVD Ids in the list, this method only processes the valid CVD Ids.
allow
If this parameter is false, the network operations will be halt, or the network operations will be resumed.
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which displays the result of the CVD. If the Success is false, refer to the MethodFault of OperationResult.
Example:
Id[] cvdIds = GetCvdId(); Client.Cvd_AllowNetworkOperations(cvdIds, false);
Cvd_Restart
Cvd_Restart is used to reboot the device.
Input:
cvdIds
cvdIds is a list of the CVD Ids. The list should not contain more than 500 entries. In the event that there are invalid CVD Ids in the list, this method only processes the valid CVD Ids..
Return:
BatchResult
For each CVD, BatchResult has an OperationResult, which displays the result of the CVD. If the Success is false, refer to the MethodFault of OperationResult.
Example:
Id[] cvdIds = GetCvdId(); Client.Cvd_Restart(cvdIds);