use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp in project azure-tools-for-java by Microsoft.
the class AbstractSpringCloudAppInfoPanel method onClusterChanged.
private void onClusterChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.DESELECTED) {
final SpringCloudCluster c = (SpringCloudCluster) e.getItem();
final String appName = StringUtils.firstNonBlank(this.getTextName().getName(), this.defaultAppName);
final SpringCloudApp app = c.app(new SpringCloudAppEntity(appName, c.entity()));
this.onAppChanged(app);
}
}
use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp 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.SpringCloudApp in project azure-tools-for-java by Microsoft.
the class SpringCloudActionsContributor method registerActions.
@Override
public void registerActions(AzureActionManager am) {
final AzureTaskManager tm = AzureTaskManager.getInstance();
final Consumer<SpringCloudApp> openPublicUrl = s -> am.getAction(ResourceCommonActionsContributor.OPEN_URL).handle(s.publicUrl());
final ActionView.Builder openPublicUrlView = new ActionView.Builder("Access Public Endpoint", "/icons/action/browser.svg").title(s -> Optional.ofNullable(s).map(r -> title("springcloud|app.open_public_url", ((SpringCloudApp) r).name())).orElse(null)).enabled(s -> s instanceof SpringCloudApp && ((SpringCloudApp) s).entity().isPublic());
am.registerAction(OPEN_PUBLIC_URL, new Action<>(openPublicUrl, openPublicUrlView));
final Consumer<SpringCloudApp> openTestUrl = s -> am.getAction(ResourceCommonActionsContributor.OPEN_URL).handle(s.testUrl());
final ActionView.Builder openTestUrlView = new ActionView.Builder("Access Test Endpoint", "/icons/action/browser.svg").title(s -> Optional.ofNullable(s).map(r -> title("springcloud|app.open_test_url", ((SpringCloudApp) r).name())).orElse(null)).enabled(s -> s instanceof SpringCloudApp);
am.registerAction(OPEN_TEST_URL, new Action<>(openTestUrl, openTestUrlView));
final ActionView.Builder streamLogView = new ActionView.Builder("Streaming Log", "/icons/action/log.svg").title(s -> Optional.ofNullable(s).map(r -> title("springcloud|app.stream_log", ((SpringCloudApp) r).name())).orElse(null)).enabled(s -> s instanceof SpringCloudApp);
am.registerAction(STREAM_LOG, new Action<>(streamLogView));
}
use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfigurationPanel method setData.
public synchronized void setData(SpringCloudAppConfig appConfig) {
final SpringCloudCluster cluster = Azure.az(AzureSpringCloud.class).cluster(appConfig.getClusterName());
if (Objects.nonNull(cluster) && !cluster.app(appConfig.getAppName()).exists()) {
this.selectorApp.addLocalItem(cluster.app(appConfig));
}
final SpringCloudDeploymentConfig deploymentConfig = appConfig.getDeployment();
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
Optional.ofNullable(deploymentConfig.getArtifact()).map(a -> ((WrappedAzureArtifact) a)).ifPresent((a -> this.selectorArtifact.setArtifact(a.getArtifact())));
Optional.ofNullable(appConfig.getSubscriptionId()).ifPresent((id -> this.selectorSubscription.setValue(new ItemReference<>(id, Subscription::getId))));
Optional.ofNullable(appConfig.getClusterName()).ifPresent((id -> this.selectorCluster.setValue(new ItemReference<>(id, SpringCloudCluster::name))));
Optional.ofNullable(appConfig.getAppName()).ifPresent((id -> this.selectorApp.setValue(new ItemReference<>(id, SpringCloudApp::name))));
}
use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp in project azure-tools-for-java by Microsoft.
the class SpringCloudAppComboBox method showAppCreationPopup.
private void showAppCreationPopup() {
final SpringCloudAppCreationDialog dialog = new SpringCloudAppCreationDialog(this.cluster);
dialog.setOkActionListener((config) -> {
final SpringCloudApp app = cluster.app(config);
this.addLocalItem(app);
dialog.close();
this.setValue(app);
});
dialog.show();
}
Aggregations