diff --git a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccounts.java b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccounts.java index f6dd57abcb45..362c9deb73e8 100644 --- a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccounts.java +++ b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccounts.java @@ -1,6 +1,7 @@ package com.microsoft.azure.management.batch; import com.microsoft.azure.management.apigeneration.LangDefinition; +import com.microsoft.azure.management.resources.fluentcore.arm.Region; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsDeletingByGroup; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByGroup; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; @@ -23,4 +24,11 @@ public interface BatchAccounts extends SupportsDeleting, SupportsDeletingByGroup, SupportsBatchCreation { + /** + * Queries the number of the batch account can be created in specified region`. + * + * @param region the region in for which to check quota + * @return whether the number of batch accounts can be created in specified region. + */ + int getBatchAccountQuotaByLocation(Region region); } diff --git a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountsImpl.java b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountsImpl.java index faa2be0e05db..2cc81f659573 100644 --- a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountsImpl.java +++ b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchAccountsImpl.java @@ -4,6 +4,7 @@ import com.microsoft.azure.management.apigeneration.LangDefinition; import com.microsoft.azure.management.batch.BatchAccount; import com.microsoft.azure.management.batch.BatchAccounts; +import com.microsoft.azure.management.resources.fluentcore.arm.Region; import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl; import com.microsoft.azure.management.storage.implementation.StorageManager; import rx.Observable; @@ -18,12 +19,20 @@ public class BatchAccountsImpl private final StorageManager storageManager; private ApplicationsInner applicationsClient; private ApplicationPackagesInner applicationPackagesClient; + private LocationsInner locationClient; - protected BatchAccountsImpl(BatchAccountsInner innerCollection, BatchManager manager, ApplicationsInner applicationsClient, ApplicationPackagesInner applicationPackagesClient, StorageManager storageManager) { + protected BatchAccountsImpl( + BatchAccountsInner innerCollection, + BatchManager manager, + ApplicationsInner applicationsClient, + ApplicationPackagesInner applicationPackagesClient, + LocationsInner locationClient, + StorageManager storageManager) { super(innerCollection, manager); this.storageManager = storageManager; this.applicationsClient = applicationsClient; this.applicationPackagesClient = applicationPackagesClient; + this.locationClient = locationClient; } @Override @@ -76,4 +85,9 @@ public BatchAccount.DefinitionStages.Blank define(String name) { public BatchAccount getByGroup(String groupName, String name) { return wrapModel(this.innerCollection.get(groupName, name)); } + + @Override + public int getBatchAccountQuotaByLocation(Region region) { + return this.locationClient.getQuotas(region.toString()).accountQuota(); + } } diff --git a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchManager.java b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchManager.java index 387d3d686a2f..1a5628ab7a48 100644 --- a/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchManager.java +++ b/azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/implementation/BatchManager.java @@ -93,6 +93,7 @@ public BatchAccounts batchAccounts() { this, super.innerManagementClient.applications(), super.innerManagementClient.applicationPackages(), + super.innerManagementClient.locations(), this.storageManager); }