Search in sources :

Example 1 with Preloader

use of com.microsoft.azure.toolkit.lib.common.cache.Preloader in project azure-maven-plugins by microsoft.

the class Account method selectSubscription.

public void selectSubscription(List<String> selectedSubscriptionIds) {
    requireAuthenticated();
    if (CollectionUtils.isEmpty(selectedSubscriptionIds)) {
        throw new IllegalArgumentException("You must select at least one subscription.");
    }
    if (CollectionUtils.isEmpty(getSubscriptions())) {
        throw new IllegalArgumentException("There are no subscriptions to select.");
    }
    if (entity.getSubscriptions().stream().anyMatch(s -> Utils.containsIgnoreCase(selectedSubscriptionIds, s.getId()))) {
        selectSubscriptionInner(this.getSubscriptions(), selectedSubscriptionIds);
        final AzureTaskManager manager = AzureTaskManager.getInstance();
        if (Objects.nonNull(manager)) {
            manager.runOnPooledThread(Preloader::load);
        }
    } else {
        throw new AzureToolkitAuthenticationException("no subscriptions are selected, " + "make sure you have provided valid subscription list");
    }
}
Also used : Preloader(com.microsoft.azure.toolkit.lib.common.cache.Preloader) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) AzureToolkitAuthenticationException(com.microsoft.azure.toolkit.lib.auth.exception.AzureToolkitAuthenticationException)

Aggregations

AzureToolkitAuthenticationException (com.microsoft.azure.toolkit.lib.auth.exception.AzureToolkitAuthenticationException)1 Preloader (com.microsoft.azure.toolkit.lib.common.cache.Preloader)1 AzureTaskManager (com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager)1