Search in sources :

Example 1 with AvailabilitySetInner

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

the class AzureInstanceService method getAvailabilitySets.

private DeferredResult<AzureInstanceContext> getAvailabilitySets(AzureInstanceContext ctx) {
    String msg = "Getting availability sets. ResourceGroup [" + ctx.resourceGroupName + "]";
    ComputeManagementClientImpl computeManager = getComputeManagementClientImpl(ctx);
    AzureDeferredResultServiceCallbackWithRetry<List<AvailabilitySetInner>> getAvailabilitySetsCallback = new AzureDeferredResultServiceCallbackWithRetry<List<AvailabilitySetInner>>(this, msg) {

        @Override
        protected DeferredResult<List<AvailabilitySetInner>> consumeSuccess(List<AvailabilitySetInner> result) {
            ctx.availabilitySetInners = result;
            return DeferredResult.completed(result);
        }

        @Override
        protected Runnable retryServiceCall(ServiceCallback<List<AvailabilitySetInner>> retryCallback) {
            return () -> computeManager.availabilitySets().listByResourceGroupAsync(ctx.resourceGroupName, retryCallback);
        }
    };
    computeManager.availabilitySets().listByResourceGroupAsync(ctx.resourceGroupName, getAvailabilitySetsCallback);
    return getAvailabilitySetsCallback.toDeferredResult().thenApply(result -> ctx);
}
Also used : ServiceCallback(com.microsoft.rest.ServiceCallback) AzureDeferredResultServiceCallback(com.vmware.photon.controller.model.adapters.azure.utils.AzureDeferredResultServiceCallback) ComputeManagementClientImpl(com.microsoft.azure.management.compute.implementation.ComputeManagementClientImpl) ArrayList(java.util.ArrayList) List(java.util.List) AvailabilitySetInner(com.microsoft.azure.management.compute.implementation.AvailabilitySetInner) AzureDeferredResultServiceCallbackWithRetry(com.vmware.photon.controller.model.adapters.azure.utils.AzureDeferredResultServiceCallbackWithRetry)

Aggregations

AvailabilitySetInner (com.microsoft.azure.management.compute.implementation.AvailabilitySetInner)1 ComputeManagementClientImpl (com.microsoft.azure.management.compute.implementation.ComputeManagementClientImpl)1 ServiceCallback (com.microsoft.rest.ServiceCallback)1 AzureDeferredResultServiceCallback (com.vmware.photon.controller.model.adapters.azure.utils.AzureDeferredResultServiceCallback)1 AzureDeferredResultServiceCallbackWithRetry (com.vmware.photon.controller.model.adapters.azure.utils.AzureDeferredResultServiceCallbackWithRetry)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1