Search in sources :

Example 1 with SpringCloudCluster

use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster 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 SpringCloudCluster

use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster 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 SpringCloudCluster

use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster in project azure-tools-for-java by Microsoft.

the class SpringCloudExplorerContributor method getModuleNode.

@Override
public Node<?> getModuleNode() {
    final AzureActionManager am = AzureActionManager.getInstance();
    final IAzureMessager messager = AzureMessager.getDefaultMessager();
    final AzureSpringCloud service = az(AzureSpringCloud.class);
    return new Node<>(service).view(new AzureServiceLabelView<>(service, "Spring Cloud", ICON)).actions(SpringCloudActionsContributor.SERVICE_ACTIONS).addChildren(AzureSpringCloud::clusters, (cluster, ascNode) -> new Node<>(cluster).view(new AzureResourceLabelView<>(cluster)).actions(SpringCloudActionsContributor.CLUSTER_ACTIONS).addChildren(SpringCloudCluster::apps, (app, clusterNode) -> new Node<>(app).view(new AzureResourceLabelView<>(app)).actions(SpringCloudActionsContributor.APP_ACTIONS)));
}
Also used : IExplorerContributor(com.microsoft.azure.toolkit.ide.common.IExplorerContributor) AzureResourceLabelView(com.microsoft.azure.toolkit.ide.common.component.AzureResourceLabelView) AzureServiceLabelView(com.microsoft.azure.toolkit.ide.common.component.AzureServiceLabelView) SpringCloudCluster(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster) Azure.az(com.microsoft.azure.toolkit.lib.Azure.az) IAzureMessager(com.microsoft.azure.toolkit.lib.common.messager.IAzureMessager) AzureActionManager(com.microsoft.azure.toolkit.lib.common.action.AzureActionManager) AzureMessager(com.microsoft.azure.toolkit.lib.common.messager.AzureMessager) AzureSpringCloud(com.microsoft.azure.toolkit.lib.springcloud.AzureSpringCloud) Node(com.microsoft.azure.toolkit.ide.common.component.Node) IAzureMessager(com.microsoft.azure.toolkit.lib.common.messager.IAzureMessager) Node(com.microsoft.azure.toolkit.ide.common.component.Node) AzureResourceLabelView(com.microsoft.azure.toolkit.ide.common.component.AzureResourceLabelView) AzureActionManager(com.microsoft.azure.toolkit.lib.common.action.AzureActionManager) AzureSpringCloud(com.microsoft.azure.toolkit.lib.springcloud.AzureSpringCloud)

Example 4 with SpringCloudCluster

use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster in project azure-tools-for-java by Microsoft.

the class SpringCloudDeploymentConfigurationPanel method onClusterChanger.

private void onClusterChanger(final ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.DESELECTED) {
        final SpringCloudCluster cluster = (SpringCloudCluster) e.getItem();
        this.selectorApp.setCluster(cluster);
    }
}
Also used : SpringCloudCluster(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster)

Example 5 with SpringCloudCluster

use of com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster 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)

Aggregations

SpringCloudCluster (com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster)5 SpringCloudApp (com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp)3 AzureSpringCloud (com.microsoft.azure.toolkit.lib.springcloud.AzureSpringCloud)2 SpringCloudAppConfig (com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig)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 IExplorerContributor (com.microsoft.azure.toolkit.ide.common.IExplorerContributor)1 AzureResourceLabelView (com.microsoft.azure.toolkit.ide.common.component.AzureResourceLabelView)1 AzureServiceLabelView (com.microsoft.azure.toolkit.ide.common.component.AzureServiceLabelView)1 Node (com.microsoft.azure.toolkit.ide.common.component.Node)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