Search in sources :

Example 6 with SpringCloudAppConfig

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

the class SpringCloudAppPropertiesEditor method getConfig.

@Nonnull
private SpringCloudAppConfig getConfig() {
    final SpringCloudAppConfig config = this.formConfig.getData();
    config.setSubscriptionId(this.app.subscriptionId());
    config.setClusterName(this.app.getCluster().name());
    config.setAppName(this.app.name());
    return config;
}
Also used : SpringCloudAppConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig) Nonnull(javax.annotation.Nonnull)

Example 7 with SpringCloudAppConfig

use of com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig 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 8 with SpringCloudAppConfig

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

the class SpringCloudDeploymentConfigurationPanel method getData.

@Nullable
public SpringCloudAppConfig getData() {
    SpringCloudAppConfig appConfig = this.selectorApp.getValue().entity().getConfig();
    if (Objects.isNull(appConfig)) {
        appConfig = SpringCloudAppConfig.builder().deployment(SpringCloudDeploymentConfig.builder().build()).build();
    }
    this.getData(appConfig);
    return appConfig;
}
Also used : SpringCloudAppConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig) Nullable(javax.annotation.Nullable)

Aggregations

SpringCloudAppConfig (com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig)8 SpringCloudApp (com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp)3 Nonnull (javax.annotation.Nonnull)3 Project (com.intellij.openapi.project.Project)2 AzureArtifactManager (com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager)2 SpringCloudCluster (com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster)2 SpringCloudDeploymentConfig (com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig)2 List (java.util.List)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 Nullable (javax.annotation.Nullable)2 javax.swing (javax.swing)2 Getter (lombok.Getter)2 Setter (lombok.Setter)2 Executor (com.intellij.execution.Executor)1 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)1 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)1 LocatableConfiguration (com.intellij.execution.configurations.LocatableConfiguration)1 LocatableConfigurationBase (com.intellij.execution.configurations.LocatableConfigurationBase)1 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1