use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudDeployment in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfigurationState method execute.
@AzureOperation(name = "springcloud|app.create_update", params = { "this.config.getAppConfig().getAppName()" }, type = AzureOperation.Type.ACTION)
public SpringCloudDeployment execute(IAzureMessager messager) {
AzureMessager.getContext().setMessager(messager);
AzureTelemetry.getContext().setProperties(getTelemetryProperties());
final SpringCloudAppConfig appConfig = this.config.getAppConfig();
final DeploySpringCloudAppTask task = new DeploySpringCloudAppTask(appConfig);
final SpringCloudDeployment deployment = task.execute();
final SpringCloudApp app = deployment.app();
final SpringCloudCluster cluster = app.getCluster();
if (!deployment.waitUntilReady(GET_STATUS_TIMEOUT)) {
messager.warning(GET_DEPLOYMENT_STATUS_TIMEOUT, NOTIFICATION_TITLE);
}
printPublicUrl(app);
return deployment;
}
use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudDeployment in project azure-tools-for-java by Microsoft.
the class SpringCloudAppPropertiesEditor method refresh.
private void refresh() {
this.reset.setVisible(false);
this.saveButton.setEnabled(false);
AzureTaskManager.getInstance().runLater(() -> {
final String refreshTitle = String.format("Refreshing app(%s)...", Objects.requireNonNull(this.app).name());
AzureTaskManager.getInstance().runInBackground(refreshTitle, () -> {
this.app.refresh();
final SpringCloudDeployment deployment = Optional.ofNullable(this.app.activeDeployment()).map(AbstractAzureResource::refresh).orElse(null);
AzureTaskManager.getInstance().runLater(this::rerender);
});
});
}
use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudDeployment in project azure-tools-for-java by Microsoft.
the class CreateSpringCloudAppAction method createApp.
@AzureOperation(name = "springcloud|app.create", params = "config.getAppName()", type = AzureOperation.Type.ACTION)
private static void createApp(SpringCloudAppConfig config) {
AzureTaskManager.getInstance().runInBackground(AzureOperationBundle.title("springcloud|app.create", config.getAppName()), () -> {
final DeploySpringCloudAppTask task = new DeploySpringCloudAppTask(config);
final SpringCloudDeployment deployment = task.execute();
if (!deployment.waitUntilReady(GET_STATUS_TIMEOUT)) {
AzureMessager.getMessager().warning(GET_DEPLOYMENT_STATUS_TIMEOUT, NOTIFICATION_TITLE);
}
});
}
use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudDeployment in project azure-tools-for-java by Microsoft.
the class SpringCloudStreamingLogAction method startLogStreaming.
public static void startLogStreaming(@Nonnull SpringCloudApp app, @Nullable Project project) {
final IAzureMessager messager = AzureMessager.getMessager();
final AzureString title = AzureOperationBundle.title("springcloud|log_stream.open", app.name());
AzureTaskManager.getInstance().runInBackground(new AzureTask<>(project, title, false, () -> {
try {
final SpringCloudDeployment deployment = app.activeDeployment();
if (deployment == null || !deployment.exists()) {
messager.warning(NO_ACTIVE_DEPLOYMENT, FAILED_TO_START_LOG_STREAMING);
return;
}
final List<SpringCloudDeploymentInstanceEntity> instances = deployment.entity().getInstances();
if (CollectionUtils.isEmpty(instances)) {
messager.warning(NO_AVAILABLE_INSTANCES, FAILED_TO_START_LOG_STREAMING);
} else {
showLogStreamingDialog(instances, app, project);
}
} catch (final Exception e) {
final String errorMessage = StringUtils.isEmpty(e.getMessage()) ? FAILED_TO_LIST_INSTANCES : String.format(FAILED_TO_LIST_INSTANCES_WITH_MESSAGE, e.getMessage());
messager.error(errorMessage, FAILED_TO_START_LOG_STREAMING);
}
}));
}
Aggregations