Search in sources :

Example 1 with AzureSqlServer

use of com.microsoft.azure.toolkit.lib.sqlserver.AzureSqlServer in project azure-tools-for-java by Microsoft.

the class SqlServerRegionValidator method apply.

@Override
public AzureValidationInfo apply(RegionComboBox comboBox) {
    AzureSqlServer service = Azure.az(AzureSqlServer.class);
    try {
        if (service.checkRegionCapability(comboBox.getSubscription().getId(), comboBox.getValue().getName())) {
            return AzureValidationInfo.OK;
        }
    } catch (ManagementException e) {
        return AzureValidationInfo.builder().input(comboBox).message(e.getMessage()).type(AzureValidationInfo.Type.ERROR).build();
    }
    final AzureValidationInfo.AzureValidationInfoBuilder builder = AzureValidationInfo.builder();
    return builder.input(comboBox).message(REGION_UNAVAILABLE_MESSAGE).type(AzureValidationInfo.Type.ERROR).build();
}
Also used : AzureValidationInfo(com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo) AzureSqlServer(com.microsoft.azure.toolkit.lib.sqlserver.AzureSqlServer) ManagementException(com.azure.core.management.exception.ManagementException)

Aggregations

ManagementException (com.azure.core.management.exception.ManagementException)1 AzureValidationInfo (com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo)1 AzureSqlServer (com.microsoft.azure.toolkit.lib.sqlserver.AzureSqlServer)1