use of com.azure.resourcemanager.appservice.fluent.models.ResourceNameAvailabilityInner in project azure-tools-for-java by Microsoft.
the class ValidationUtils method validateAppServiceName.
public static void validateAppServiceName(String subscriptionId, String appServiceName) {
final Pair<String, String> cacheKey = Pair.of(subscriptionId, appServiceName);
if (appServiceNameValidationCache.containsKey(cacheKey)) {
throwCachedValidationResult(appServiceNameValidationCache.get(cacheKey));
return;
}
if (StringUtils.isEmpty(subscriptionId)) {
cacheAndThrow(appServiceNameValidationCache, cacheKey, message("appService.subscription.validate.empty"));
}
if (!isValidAppServiceName(appServiceName)) {
cacheAndThrow(appServiceNameValidationCache, cacheKey, message("appService.subscription.validate.invalidName"));
}
final ResourceNameAvailabilityInner result = Azure.az(AzureAppService.class).getAppServiceManager(subscriptionId).webApps().manager().serviceClient().getResourceProviders().checkNameAvailability(appServiceName, CheckNameResourceTypes.MICROSOFT_WEB_SITES);
if (!result.nameAvailable()) {
cacheAndThrow(appServiceNameValidationCache, cacheKey, result.message());
}
appServiceNameValidationCache.put(cacheKey, null);
}
use of com.azure.resourcemanager.appservice.fluent.models.ResourceNameAvailabilityInner in project azure-maven-plugins by microsoft.
the class AzureAppService method checkNameAvailability.
@AzureOperation(name = "appservice.check_name", params = "name", type = AzureOperation.Type.SERVICE)
public CheckNameAvailabilityResultEntity checkNameAvailability(String subscriptionId, String name) {
final AppServiceManager azureResourceManager = getAppServiceManager(subscriptionId);
final ResourceNameAvailabilityInner result = azureResourceManager.webApps().manager().serviceClient().getResourceProviders().checkNameAvailability(name, CheckNameResourceTypes.MICROSOFT_WEB_SITES);
return new CheckNameAvailabilityResultEntity(result.nameAvailable(), result.reason().toString(), result.message());
}
use of com.azure.resourcemanager.appservice.fluent.models.ResourceNameAvailabilityInner in project azure-tools-for-java by microsoft.
the class ValidationUtils method validateAppServiceName.
public static void validateAppServiceName(String subscriptionId, String appServiceName) {
final Pair<String, String> cacheKey = Pair.of(subscriptionId, appServiceName);
if (appServiceNameValidationCache.containsKey(cacheKey)) {
throwCachedValidationResult(appServiceNameValidationCache.get(cacheKey));
return;
}
if (StringUtils.isEmpty(subscriptionId)) {
cacheAndThrow(appServiceNameValidationCache, cacheKey, message("appService.subscription.validate.empty"));
}
if (!isValidAppServiceName(appServiceName)) {
cacheAndThrow(appServiceNameValidationCache, cacheKey, message("appService.subscription.validate.invalidName"));
}
final ResourceNameAvailabilityInner result = Azure.az(AzureAppService.class).getAppServiceManager(subscriptionId).webApps().manager().serviceClient().getResourceProviders().checkNameAvailability(appServiceName, CheckNameResourceTypes.MICROSOFT_WEB_SITES);
if (!result.nameAvailable()) {
cacheAndThrow(appServiceNameValidationCache, cacheKey, result.message());
}
appServiceNameValidationCache.put(cacheKey, null);
}
Aggregations