use of com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig in project azure-tools-for-java by Microsoft.
the class SpringCloudAppConfigPanel method getData.
@Contract("_->_")
public SpringCloudAppConfig getData(@Nonnull SpringCloudAppConfig appConfig) {
// get config from form
final SpringCloudDeploymentConfig deploymentConfig = appConfig.getDeployment();
final String javaVersion = this.useJava11.isSelected() ? SpringCloudJavaVersion.JAVA_11 : SpringCloudJavaVersion.JAVA_8;
appConfig.setIsPublic("disable".equals(this.toggleEndpoint.getActionCommand()));
deploymentConfig.setRuntimeVersion(javaVersion);
deploymentConfig.setEnablePersistentStorage("disable".equals(this.toggleStorage.getActionCommand()));
deploymentConfig.setCpu(numCpu.getItem());
deploymentConfig.setMemoryInGB(numMemory.getItem());
deploymentConfig.setInstanceCount(numInstance.getValue());
deploymentConfig.setJvmOptions(Optional.ofNullable(this.txtJvmOptions.getText()).map(String::trim).orElse(""));
deploymentConfig.setEnvironment(Optional.ofNullable(envTable.getEnvironmentVariables()).orElse(new HashMap<>()));
return appConfig;
}
use of com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig in project azure-tools-for-java by Microsoft.
the class SpringCloudAppConfigPanel method setData.
@Override
public synchronized void setData(SpringCloudAppConfig config) {
this.originalConfig = config;
final SpringCloudDeploymentConfig deployment = config.getDeployment();
this.toggleStorage(deployment.getEnablePersistentStorage());
this.toggleEndpoint(config.getIsPublic());
final boolean java11 = StringUtils.equalsIgnoreCase(deployment.getRuntimeVersion(), SpringCloudJavaVersion.JAVA_11);
this.useJava11.setSelected(java11);
this.useJava8.setSelected(!java11);
this.txtJvmOptions.setText(deployment.getJvmOptions());
final Map<String, String> env = deployment.getEnvironment();
this.envTable.setEnvironmentVariables(ObjectUtils.firstNonNull(env, Collections.emptyMap()));
this.numCpu.setItem(Optional.ofNullable(deployment.getCpu()).orElse(1));
this.numMemory.setItem(Optional.ofNullable(deployment.getMemoryInGB()).orElse(1));
this.numInstance.setValue(Optional.ofNullable(deployment.getInstanceCount()).orElse(1));
}
use of com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfigurationPanel method getData.
public SpringCloudAppConfig getData(SpringCloudAppConfig appConfig) {
final SpringCloudDeploymentConfig deploymentConfig = appConfig.getDeployment();
appConfig.setSubscriptionId(this.selectorSubscription.getValue().getId());
appConfig.setClusterName(this.selectorCluster.getValue().name());
appConfig.setAppName(this.selectorApp.getValue().name());
final AzureArtifact artifact = this.selectorArtifact.getValue();
deploymentConfig.setArtifact(new WrappedAzureArtifact(this.selectorArtifact.getValue(), this.project));
return appConfig;
}
use of com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig 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))));
}
Aggregations