Search in sources :

Example 1 with SpringCloudApp

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);
    }
}
Also used : SpringCloudCluster(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster) SpringCloudAppEntity(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudAppEntity) SpringCloudApp(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp)

Example 2 with SpringCloudApp

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;
}
Also used : DeploySpringCloudAppTask(com.microsoft.azure.toolkit.lib.springcloud.task.DeploySpringCloudAppTask) SpringCloudDeployment(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudDeployment) SpringCloudCluster(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster) SpringCloudAppConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig) SpringCloudApp(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)

Example 3 with SpringCloudApp

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));
}
Also used : ActionGroup(com.microsoft.azure.toolkit.lib.common.action.ActionGroup) Consumer(java.util.function.Consumer) AzureActionManager(com.microsoft.azure.toolkit.lib.common.action.AzureActionManager) IActionsContributor(com.microsoft.azure.toolkit.ide.common.IActionsContributor) ActionView(com.microsoft.azure.toolkit.lib.common.action.ActionView) ResourceCommonActionsContributor(com.microsoft.azure.toolkit.ide.common.action.ResourceCommonActionsContributor) Action(com.microsoft.azure.toolkit.lib.common.action.Action) AzureOperationBundle.title(com.microsoft.azure.toolkit.lib.common.operation.AzureOperationBundle.title) Optional(java.util.Optional) SpringCloudApp(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) ActionView(com.microsoft.azure.toolkit.lib.common.action.ActionView) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) SpringCloudApp(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp)

Example 4 with SpringCloudApp

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))));
}
Also used : SpringCloudCluster(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster) FileNameUtils(org.apache.commons.compress.utils.FileNameUtils) Azure(com.microsoft.azure.toolkit.lib.Azure) Setter(lombok.Setter) Arrays(java.util.Arrays) AzureFormInput(com.microsoft.azure.toolkit.lib.common.form.AzureFormInput) SpringCloudDeploymentConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig) DataContext(com.intellij.openapi.actionSystem.DataContext) Getter(lombok.Getter) SpringCloudAppComboBox(com.microsoft.azure.toolkit.intellij.springcloud.component.SpringCloudAppComboBox) SpringCloudAppConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig) StringUtils(org.apache.commons.lang3.StringUtils) SpringCloudClusterComboBox(com.microsoft.azure.toolkit.intellij.springcloud.component.SpringCloudClusterComboBox) Project(com.intellij.openapi.project.Project) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) AzureArtifactComboBox(com.microsoft.azure.toolkit.intellij.common.AzureArtifactComboBox) AzureFormPanel(com.microsoft.azure.toolkit.intellij.common.AzureFormPanel) DataManager(com.intellij.ide.DataManager) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) ItemEvent(java.awt.event.ItemEvent) AzureArtifact(com.microsoft.azure.toolkit.intellij.common.AzureArtifact) SpringCloudApp(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp) BeforeRunTaskUtils(com.microsoft.intellij.util.BeforeRunTaskUtils) AzureSpringCloud(com.microsoft.azure.toolkit.lib.springcloud.AzureSpringCloud) Objects(java.util.Objects) List(java.util.List) ItemReference(com.microsoft.azure.toolkit.intellij.common.AzureComboBox.ItemReference) Optional(java.util.Optional) ConfigurationSettingsEditorWrapper(com.intellij.execution.impl.ConfigurationSettingsEditorWrapper) SubscriptionComboBox(com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox) javax.swing(javax.swing) SpringCloudCluster(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster) SpringCloudDeploymentConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) AzureSpringCloud(com.microsoft.azure.toolkit.lib.springcloud.AzureSpringCloud)

Example 5 with SpringCloudApp

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();
}
Also used : SpringCloudAppCreationDialog(com.microsoft.azure.toolkit.intellij.springcloud.creation.SpringCloudAppCreationDialog) SpringCloudApp(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp)

Aggregations

SpringCloudApp (com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp)6 SpringCloudCluster (com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster)3 SpringCloudAppConfig (com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig)2 Optional (java.util.Optional)2 ConfigurationSettingsEditorWrapper (com.intellij.execution.impl.ConfigurationSettingsEditorWrapper)1 DataManager (com.intellij.ide.DataManager)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 Project (com.intellij.openapi.project.Project)1 IActionsContributor (com.microsoft.azure.toolkit.ide.common.IActionsContributor)1 ResourceCommonActionsContributor (com.microsoft.azure.toolkit.ide.common.action.ResourceCommonActionsContributor)1 AzureArtifact (com.microsoft.azure.toolkit.intellij.common.AzureArtifact)1 AzureArtifactComboBox (com.microsoft.azure.toolkit.intellij.common.AzureArtifactComboBox)1 AzureArtifactManager (com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager)1 ItemReference (com.microsoft.azure.toolkit.intellij.common.AzureComboBox.ItemReference)1 AzureFormPanel (com.microsoft.azure.toolkit.intellij.common.AzureFormPanel)1 SubscriptionComboBox (com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox)1 SpringCloudAppComboBox (com.microsoft.azure.toolkit.intellij.springcloud.component.SpringCloudAppComboBox)1 SpringCloudClusterComboBox (com.microsoft.azure.toolkit.intellij.springcloud.component.SpringCloudClusterComboBox)1 SpringCloudAppCreationDialog (com.microsoft.azure.toolkit.intellij.springcloud.creation.SpringCloudAppCreationDialog)1 Azure (com.microsoft.azure.toolkit.lib.Azure)1