Search in sources :

Example 1 with OperationStatusResponseInner

use of com.microsoft.azure.management.compute.implementation.OperationStatusResponseInner in project photon-model by vmware.

the class AzureInstanceService method deleteVirtualMachine.

private DeferredResult<AzureInstanceContext> deleteVirtualMachine(AzureInstanceContext ctx) {
    String msg = "Deleting virtual machine [" + ctx.vmName + "]";
    ComputeManagementClientImpl computeManager = getComputeManagementClientImpl(ctx);
    AzureDeferredResultServiceCallback<OperationStatusResponseInner> deleteVirtualMachineCallback = new AzureDeferredResultServiceCallback<OperationStatusResponseInner>(this, msg) {

        @Override
        protected DeferredResult<OperationStatusResponseInner> consumeSuccess(OperationStatusResponseInner result) {
            logInfo("Successfully deleted VM: " + ctx.vmName);
            return DeferredResult.completed(result);
        }
    };
    computeManager.virtualMachines().deleteAsync(ctx.resourceGroupName, ctx.vmName, deleteVirtualMachineCallback);
    return deleteVirtualMachineCallback.toDeferredResult().thenApply(result -> ctx);
}
Also used : OperationStatusResponseInner(com.microsoft.azure.management.compute.implementation.OperationStatusResponseInner) AzureDeferredResultServiceCallback(com.vmware.photon.controller.model.adapters.azure.utils.AzureDeferredResultServiceCallback) ComputeManagementClientImpl(com.microsoft.azure.management.compute.implementation.ComputeManagementClientImpl)

Aggregations

ComputeManagementClientImpl (com.microsoft.azure.management.compute.implementation.ComputeManagementClientImpl)1 OperationStatusResponseInner (com.microsoft.azure.management.compute.implementation.OperationStatusResponseInner)1 AzureDeferredResultServiceCallback (com.vmware.photon.controller.model.adapters.azure.utils.AzureDeferredResultServiceCallback)1