use of com.microsoft.azure.toolkit.intellij.arm.action.UpdateDeploymentAction.NOTIFY_UPDATE_DEPLOYMENT_SUCCESS in project azure-tools-for-java by Microsoft.
the class ResourceTemplateView method updateDeployment.
private void updateDeployment() {
String oldTemplate = this.originTemplate;
String oldParameters = this.originParameters;
final AzureString title = AzureOperationBundle.title("arm|deployment.update", node.getDeployment().name());
AzureTaskManager.getInstance().runInBackground(new AzureTask(project, title, false, () -> {
EventUtil.executeWithLog(ARM, UPDATE_DEPLOYMENT_SHORTCUT, (operation -> {
ResourceTemplateView.this.originTemplate = getTemplate();
ResourceTemplateView.this.originParameters = getParameters();
node.getDeployment().update().withTemplate(ResourceTemplateView.this.originTemplate).withParameters(ResourceTemplateView.this.originParameters).withMode(DeploymentMode.INCREMENTAL).apply();
UIUtils.showNotification(project, NOTIFY_UPDATE_DEPLOYMENT_SUCCESS, MessageType.INFO);
}), (e) -> {
// Fall back the origin value when update fail.
ResourceTemplateView.this.originTemplate = oldTemplate;
ResourceTemplateView.this.originParameters = oldParameters;
UIUtils.showNotification(project, NOTIFY_UPDATE_DEPLOYMENT_FAIL + ", " + e.getMessage(), MessageType.ERROR);
});
}));
}
use of com.microsoft.azure.toolkit.intellij.arm.action.UpdateDeploymentAction.NOTIFY_UPDATE_DEPLOYMENT_SUCCESS in project azure-tools-for-java by Microsoft.
the class UpdateDeploymentForm method doOKAction.
@Override
protected void doOKAction() {
String deploymentName = deploymentNode.getDeployment().name();
final AzureString title = AzureOperationBundle.title("arm|deployment.update", deploymentName);
AzureTaskManager.getInstance().runInBackground(new AzureTask(project, title, false, () -> {
EventUtil.executeWithLog(TelemetryConstants.ARM, TelemetryConstants.UPDATE_DEPLOYMENT, (operation -> {
Deployment.Update update = deploymentNode.getDeployment().update();
String templatePath = templateTextField.getText();
update = update.withTemplate(IOUtils.toString(new FileReader(templatePath)));
String parametersPath = parametersTextField.getText();
if (!StringUtils.isEmpty(parametersPath)) {
String parameters = IOUtils.toString(new FileReader(parametersPath));
update = update.withParameters(DeploymentUtils.parseParameters(parameters));
}
update.withMode(DeploymentMode.INCREMENTAL).apply();
UIUtils.showNotification(statusBar, NOTIFY_UPDATE_DEPLOYMENT_SUCCESS, MessageType.INFO);
}), (e) -> {
UIUtils.showNotification(statusBar, NOTIFY_UPDATE_DEPLOYMENT_FAIL + ", " + e.getMessage(), MessageType.ERROR);
});
}));
close(OK_EXIT_CODE, true);
}
Aggregations