use of com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfiguration method readExternal.
@Override
public void readExternal(Element element) throws InvalidDataException {
super.readExternal(element);
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.getProject());
this.appConfig = Optional.ofNullable(element.getChild("SpringCloudAppConfig")).map(e -> XmlSerializer.deserialize(e, SpringCloudAppConfig.class)).orElse(SpringCloudAppConfig.builder().deployment(SpringCloudDeploymentConfig.builder().build()).build());
Optional.ofNullable(element.getChild("Artifact")).map(e -> e.getAttributeValue("identifier")).map(manager::getAzureArtifactById).map(a -> new WrappedAzureArtifact(a, this.getProject())).ifPresent(a -> this.appConfig.getDeployment().setArtifact(a));
}
use of com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig 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.config.SpringCloudAppConfig in project azure-tools-for-java by Microsoft.
the class SpringCloudAppConfigPanel method onDataChanged.
private void onDataChanged() {
if (Objects.nonNull(this.originalConfig) && Objects.nonNull(this.listener)) {
final SpringCloudAppConfig newConfig = this.getData();
this.listener.accept(newConfig);
}
}
use of com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig in project azure-tools-for-java by Microsoft.
the class SpringCloudAppConfigPanel method getData.
@Nonnull
public SpringCloudAppConfig getData() {
final SpringCloudAppConfig appConfig = SpringCloudAppConfig.builder().deployment(SpringCloudDeploymentConfig.builder().build()).build();
this.getData(appConfig);
return appConfig;
}
use of com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfigurationState method getTelemetryProperties.
protected Map<String, String> getTelemetryProperties() {
final Map<String, String> props = new HashMap<>();
final SpringCloudAppConfig cfg = config.getAppConfig();
props.put("runtime", String.valueOf(cfg.getRuntimeVersion()));
props.put("subscriptionId", String.valueOf(cfg.getSubscriptionId()));
props.put("public", String.valueOf(cfg.isPublic()));
props.put("jvmOptions", String.valueOf(StringUtils.isNotEmpty(cfg.getDeployment().getJvmOptions())));
props.put("instanceCount", String.valueOf(cfg.getDeployment().getInstanceCount()));
props.put("memory", String.valueOf(cfg.getDeployment().getMemoryInGB()));
props.put("cpu", String.valueOf(cfg.getDeployment().getCpu()));
props.put("persistentStorage", String.valueOf(cfg.getDeployment().getEnablePersistentStorage()));
return props;
}
Aggregations