use of com.microsoft.azure.toolkit.redis.RedisConfig in project azure-tools-for-java by Microsoft.
the class CreateRedisCacheForm method okPressed.
@Override
protected void okPressed() {
try {
RedisCacheUtil.doValidate(currentSub, dnsNameValue, selectedLocationValue, selectedResGrpValue, selectedPriceTierValue);
if (newResGrp) {
for (String resGrp : sortedGroups) {
if (selectedResGrpValue.equals(resGrp)) {
throw new InvalidFormDataException("The resource group " + selectedResGrpValue + " is not available");
}
}
}
} catch (InvalidFormDataException e) {
MessageDialog.openError(getShell(), "Form Validation Error", e.getMessage());
return;
}
RedisConfig config = getData();
final Runnable runnable = () -> {
final Operation operation = TelemetryManager.createOperation(REDIS, CREATE_REDIS);
try {
operation.start();
new CreateRedisTask(config).execute();
if (onCreate != null) {
onCreate.run();
}
} catch (Exception ex) {
EventUtil.logError(operation, ErrorType.userError, ex, null, null);
operation.complete();
MessageDialog.openError(getShell(), String.format(MessageHandler.getResourceString(resourceBundle, CREATING_ERROR_INDICATOR_FORMAT), dnsNameValue), ex.getMessage());
LOG.log(String.format(MessageHandler.getResourceString(resourceBundle, CREATING_ERROR_INDICATOR_FORMAT), dnsNameValue), ex);
}
};
String progressMessage = Node.getProgressMessage(AzureActionEnum.CREATE.getDoingName(), RedisCacheModule.MODULE_NAME, config.getName());
AzureTaskManager.getInstance().runInBackground(new AzureTask<>(null, progressMessage, false, runnable));
super.okPressed();
}
use of com.microsoft.azure.toolkit.redis.RedisConfig in project azure-tools-for-java by Microsoft.
the class CreateRedisCacheForm method getData.
private RedisConfig getData() {
RedisConfig redisConfig = new RedisConfig();
redisConfig.setSubscription(this.currentSub);
redisConfig.setRegion(Region.fromName(selectedLocationValue));
redisConfig.setResourceGroup(newResGrp ? new DraftResourceGroup(this.currentSub, selectedResGrpValue) : com.microsoft.azure.toolkit.lib.Azure.az(AzureGroup.class).get(this.currentSub.getId(), selectedResGrpValue));
redisConfig.setEnableNonSslPort(noSSLPort);
redisConfig.setPricingTier(PricingTier.values().stream().filter(pricingTier -> StringUtils.equalsIgnoreCase(pricingTier.toString(), selectedPriceTierValue)).findFirst().orElse(null));
redisConfig.setName(dnsNameValue);
return redisConfig;
}
use of com.microsoft.azure.toolkit.redis.RedisConfig in project azure-tools-for-java by Microsoft.
the class RedisCreationDialog method getData.
@Override
public RedisConfig getData() {
RedisConfig config = new RedisConfig();
config.setSubscription(subscriptionComboBox.getValue());
config.setResourceGroup(resourceGroupComboBox.getValue());
config.setName(redisNameTextField.getText());
config.setPricingTier(pricingComboBox.getValue());
config.setRegion(regionComboBox.getValue());
config.setEnableNonSslPort(enableNonSSLCheckBox.isSelected());
return config;
}
Aggregations