diff --git a/modules/api/src/main/java/org/eclipse/xpanse/api/controllers/ServiceMigrationApi.java b/modules/api/src/main/java/org/eclipse/xpanse/api/controllers/ServiceMigrationApi.java index ad264775d..494c76144 100644 --- a/modules/api/src/main/java/org/eclipse/xpanse/api/controllers/ServiceMigrationApi.java +++ b/modules/api/src/main/java/org/eclipse/xpanse/api/controllers/ServiceMigrationApi.java @@ -29,6 +29,7 @@ import org.eclipse.xpanse.modules.deployment.ServiceDeploymentEntityHandler; import org.eclipse.xpanse.modules.deployment.ServiceOrderManager; import org.eclipse.xpanse.modules.deployment.migration.consts.MigrateConstants; +import org.eclipse.xpanse.modules.logging.CustomRequestIdGenerator; import org.eclipse.xpanse.modules.models.service.deploy.exceptions.BillingModeNotSupported; import org.eclipse.xpanse.modules.models.service.deploy.exceptions.EulaNotAccepted; import org.eclipse.xpanse.modules.models.service.deploy.exceptions.ServiceLockedException; @@ -148,7 +149,7 @@ private void validateData(MigrateRequest migrateRequest) { private DeployTask getMigrateTask(MigrateRequest migrateRequest) { DeployTask migrateTask = new DeployTask(); - migrateTask.setOrderId(UUID.randomUUID()); + migrateTask.setOrderId(CustomRequestIdGenerator.generateOrderId()); migrateTask.setTaskType(ServiceOrderType.MIGRATE); migrateTask.setServiceId(migrateRequest.getOriginalServiceId()); migrateTask.setOriginalServiceId(migrateRequest.getOriginalServiceId()); diff --git a/modules/api/src/main/java/org/eclipse/xpanse/api/controllers/ServiceRecreateApi.java b/modules/api/src/main/java/org/eclipse/xpanse/api/controllers/ServiceRecreateApi.java index 3bf1e577c..534064a52 100644 --- a/modules/api/src/main/java/org/eclipse/xpanse/api/controllers/ServiceRecreateApi.java +++ b/modules/api/src/main/java/org/eclipse/xpanse/api/controllers/ServiceRecreateApi.java @@ -27,6 +27,7 @@ import org.eclipse.xpanse.modules.deployment.ServiceDeploymentEntityHandler; import org.eclipse.xpanse.modules.deployment.ServiceOrderManager; import org.eclipse.xpanse.modules.deployment.recreate.consts.RecreateConstants; +import org.eclipse.xpanse.modules.logging.CustomRequestIdGenerator; import org.eclipse.xpanse.modules.models.service.deploy.exceptions.InvalidServiceStateException; import org.eclipse.xpanse.modules.models.service.deploy.exceptions.ServiceLockedException; import org.eclipse.xpanse.modules.models.service.enums.ServiceDeploymentState; @@ -135,7 +136,7 @@ public ServiceOrder recreateService(@Valid @PathVariable("serviceId") String ser private DeployTask getRecreateTask(ServiceDeploymentEntity serviceDeploymentEntity) { DeployTask recreateTask = new DeployTask(); - recreateTask.setOrderId(UUID.randomUUID()); + recreateTask.setOrderId(CustomRequestIdGenerator.generateOrderId()); recreateTask.setTaskType(ServiceOrderType.RECREATE); recreateTask.setServiceId(serviceDeploymentEntity.getId()); recreateTask.setOriginalServiceId(serviceDeploymentEntity.getId()); diff --git a/modules/api/src/main/java/org/eclipse/xpanse/api/exceptions/handler/DeploymentExceptionHandler.java b/modules/api/src/main/java/org/eclipse/xpanse/api/exceptions/handler/DeploymentExceptionHandler.java index 4a24d50cb..463475826 100644 --- a/modules/api/src/main/java/org/eclipse/xpanse/api/exceptions/handler/DeploymentExceptionHandler.java +++ b/modules/api/src/main/java/org/eclipse/xpanse/api/exceptions/handler/DeploymentExceptionHandler.java @@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.xpanse.modules.deployment.deployers.terraform.exceptions.TerraformBootRequestFailedException; import org.eclipse.xpanse.modules.deployment.deployers.terraform.exceptions.TerraformExecutorException; +import org.eclipse.xpanse.modules.deployment.exceptions.DeploymentScriptsCreationFailedException; import org.eclipse.xpanse.modules.models.billing.exceptions.ServicePriceCalculationFailed; import org.eclipse.xpanse.modules.models.common.exceptions.InvalidDeployerToolException; import org.eclipse.xpanse.modules.models.response.Response; @@ -270,4 +271,16 @@ public Response handleInvalidDeployerToolException(InvalidDeployerToolException return getErrorResponse(ResultType.INVALID_DEPLOYER_TOOL, Collections.singletonList(ex.getMessage())); } + + /** + * Exception handler for DeploymentScriptsCreationFailedException. + */ + @ExceptionHandler({DeploymentScriptsCreationFailedException.class}) + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseBody + public Response handleDeploymentScriptsCreatedException( + DeploymentScriptsCreationFailedException ex) { + return getErrorResponse(ResultType.DEPLOYMENT_SCRIPTS_CREATION_FAILED, + Collections.singletonList(ex.getMessage())); + } } diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/DeployResultManager.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/DeployResultManager.java index 1dbe183ed..54ed31a2a 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/DeployResultManager.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/DeployResultManager.java @@ -6,6 +6,8 @@ package org.eclipse.xpanse.modules.deployment; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_STATE_FILE_NAME; + import jakarta.annotation.Resource; import java.time.OffsetDateTime; import java.util.ArrayList; @@ -25,6 +27,7 @@ import org.eclipse.xpanse.modules.database.servicetemplate.ServiceTemplateStorage; import org.eclipse.xpanse.modules.deployment.migration.consts.MigrateConstants; import org.eclipse.xpanse.modules.deployment.recreate.consts.RecreateConstants; +import org.eclipse.xpanse.modules.logging.CustomRequestIdGenerator; import org.eclipse.xpanse.modules.models.service.deploy.DeployRequest; import org.eclipse.xpanse.modules.models.service.deploy.DeployResource; import org.eclipse.xpanse.modules.models.service.enums.ServiceDeploymentState; @@ -128,7 +131,7 @@ public void rollbackOnDeploymentFailure(DeployTask rollbackTask, DeployResult rollbackResult; RuntimeException exception = null; log.info("Performing rollback of already provisioned resources."); - rollbackTask.setOrderId(UUID.randomUUID()); + rollbackTask.setOrderId(CustomRequestIdGenerator.generateOrderId()); rollbackTask.setTaskType(ServiceOrderType.ROLLBACK); ServiceOrderEntity serviceOrderEntity = serviceOrderManager .storeNewServiceOrderEntity(rollbackTask, serviceDeploymentEntity); @@ -169,6 +172,8 @@ private ServiceDeploymentEntity updateDeployServiceEntityWithDeployResult( log.info("Update deploy service entity {} with deploy result {}", serviceDeploymentEntity.getId(), deployResult); if (StringUtils.isNotBlank(deployResult.getTfStateContent())) { + deployResult.getDeploymentGeneratedFiles() + .put(TF_STATE_FILE_NAME, deployResult.getTfStateContent()); ServiceTemplateEntity serviceTemplateEntity = serviceTemplateStorage.getServiceTemplateById( serviceDeploymentEntity.getServiceTemplateId()); @@ -176,7 +181,18 @@ private ServiceDeploymentEntity updateDeployServiceEntityWithDeployResult( serviceTemplateEntity.getOcl().getDeployment().getDeployerTool().getKind(); resourceHandlerManager.getResourceHandler(serviceDeploymentEntity.getCsp(), deployerKind).handler(deployResult); + } else { + if (Objects.nonNull(serviceDeploymentEntity.getDeploymentGeneratedFiles())) { + String storedTfStateContent = serviceDeploymentEntity.getDeploymentGeneratedFiles() + .get(TF_STATE_FILE_NAME); + if (StringUtils.isNotBlank(storedTfStateContent)) { + deployResult.setTfStateContent(storedTfStateContent); + deployResult.getDeploymentGeneratedFiles() + .put(TF_STATE_FILE_NAME, deployResult.getTfStateContent()); + } + } } + ServiceDeploymentEntity deployServiceToUpdate = new ServiceDeploymentEntity(); BeanUtils.copyProperties(serviceDeploymentEntity, deployServiceToUpdate); updateServiceEntityWithDeployResult(deployResult, taskType, deployServiceToUpdate); @@ -185,7 +201,8 @@ private ServiceDeploymentEntity updateDeployServiceEntityWithDeployResult( private void updateServiceEntityWithDeployResult(DeployResult deployResult, - ServiceOrderType taskType, ServiceDeploymentEntity serviceDeployment) { + ServiceOrderType taskType, + ServiceDeploymentEntity serviceDeployment) { boolean isTaskSuccessful = deployResult.getIsTaskSuccessful(); ServiceDeploymentState deploymentState = getServiceDeploymentState(taskType, isTaskSuccessful); @@ -322,15 +339,14 @@ private void updateServiceOrderEntityWithDeployResult(DeployResult deployResult, entityToUpdate.setTaskStatus(taskStatus); entityToUpdate.setCompletedTime(OffsetDateTime.now()); entityToUpdate.setErrorMsg(deployResult.getMessage()); - // finally, update the service order entity of this current order task. + // finally, update the service order entity of this order task. serviceOrderStorage.storeAndFlush(entityToUpdate); } private void completeParentServiceOrder(UUID parentOrderId) { ServiceOrderEntity parentOrder = serviceOrderStorage.getEntityById(parentOrderId); // When the parent order is not a migrate task, complete it. - if (parentOrder.getTaskType() != ServiceOrderType.MIGRATE - && parentOrder.getTaskType() != ServiceOrderType.RECREATE) { + if (parentOrder.getTaskType() != ServiceOrderType.MIGRATE) { ServiceOrderEntity entityToUpdate = new ServiceOrderEntity(); BeanUtils.copyProperties(parentOrder, entityToUpdate); entityToUpdate.setCompletedTime(OffsetDateTime.now()); @@ -370,7 +386,6 @@ private void processRelatedWorkflowTask(ServiceOrderEntity serviceOrder) { } } } - } catch (Exception e) { log.error("Failed to process the related workflow task of service order: {}", serviceOrder.getOrderId(), e); diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/DeployServiceEntityConverter.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/DeployServiceEntityConverter.java index 440624de5..0d5238082 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/DeployServiceEntityConverter.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/DeployServiceEntityConverter.java @@ -12,11 +12,11 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.UUID; import org.eclipse.xpanse.modules.database.service.ServiceDeploymentEntity; import org.eclipse.xpanse.modules.database.serviceconfiguration.ServiceConfigurationEntity; import org.eclipse.xpanse.modules.database.servicetemplate.ServiceTemplateEntity; import org.eclipse.xpanse.modules.database.servicetemplate.ServiceTemplateStorage; +import org.eclipse.xpanse.modules.logging.CustomRequestIdGenerator; import org.eclipse.xpanse.modules.models.service.order.enums.ServiceOrderType; import org.eclipse.xpanse.modules.models.servicetemplate.ServiceConfigurationManage; import org.eclipse.xpanse.modules.models.servicetemplate.ServiceConfigurationParameter; @@ -38,15 +38,15 @@ public class DeployServiceEntityConverter { /** * Method to create a DeployTask from DeployServiceEntity. * - * @param orderType ServiceOrderType. + * @param orderType ServiceOrderType. * @param serviceDeploymentEntity DeployServiceEntity object. * @return DeployTask object. */ - public DeployTask getDeployTaskByStoredService(ServiceOrderType orderType, - ServiceDeploymentEntity serviceDeploymentEntity) { + public DeployTask getDeployTaskByStoredService( + ServiceOrderType orderType, ServiceDeploymentEntity serviceDeploymentEntity) { // Set Ocl and CreateRequest DeployTask deployTask = new DeployTask(); - deployTask.setOrderId(UUID.randomUUID()); + deployTask.setOrderId(CustomRequestIdGenerator.generateOrderId()); deployTask.setTaskType(orderType); deployTask.setServiceId(serviceDeploymentEntity.getId()); deployTask.setUserId(serviceDeploymentEntity.getUserId()); diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/callbacks/OpenTofuDeploymentResultCallbackManager.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/callbacks/OpenTofuDeploymentResultCallbackManager.java index c7277d6a8..a18b816b9 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/callbacks/OpenTofuDeploymentResultCallbackManager.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/callbacks/OpenTofuDeploymentResultCallbackManager.java @@ -10,9 +10,9 @@ import java.util.Objects; import java.util.UUID; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.eclipse.xpanse.modules.deployment.DeployResultManager; import org.eclipse.xpanse.modules.deployment.deployers.opentofu.tofumaker.generated.model.OpenTofuResult; -import org.eclipse.xpanse.modules.deployment.deployers.terraform.utils.TfResourceTransUtils; import org.eclipse.xpanse.modules.orchestrator.deployment.DeployResult; import org.springframework.stereotype.Component; @@ -48,11 +48,12 @@ private DeployResult getDeployResult(OpenTofuResult result) { deployResult.setIsTaskSuccessful(true); deployResult.setMessage(null); } - deployResult.setTfStateContent(result.getTerraformState()); - deployResult.getDeploymentGeneratedFiles() - .put(TfResourceTransUtils.STATE_FILE_NAME, result.getTerraformState()); - if (Objects.nonNull(result.getImportantFileContentMap())) { - deployResult.getDeploymentGeneratedFiles().putAll(result.getImportantFileContentMap()); + if (StringUtils.isNotBlank(result.getTerraformState())) { + deployResult.setTfStateContent(result.getTerraformState()); + } + if (Objects.nonNull(result.getGeneratedFileContentMap())) { + deployResult.getDeploymentGeneratedFiles() + .putAll(result.getGeneratedFileContentMap()); } return deployResult; } diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalDeployment.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalDeployment.java index 75acb284b..3a987f6b4 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalDeployment.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalDeployment.java @@ -8,34 +8,24 @@ import static org.eclipse.xpanse.modules.async.TaskConfiguration.ASYNC_EXECUTOR_NAME; -import jakarta.annotation.Nullable; import jakarta.annotation.Resource; import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Comparator; import java.util.HashMap; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.UUID; import java.util.concurrent.Executor; -import java.util.stream.Stream; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.eclipse.xpanse.modules.database.service.ServiceDeploymentEntity; import org.eclipse.xpanse.modules.deployment.ServiceDeploymentEntityHandler; import org.eclipse.xpanse.modules.deployment.deployers.opentofu.callbacks.OpenTofuDeploymentResultCallbackManager; -import org.eclipse.xpanse.modules.deployment.deployers.opentofu.exceptions.OpenTofuExecutorException; import org.eclipse.xpanse.modules.deployment.deployers.opentofu.opentofulocal.config.OpenTofuLocalConfig; import org.eclipse.xpanse.modules.deployment.deployers.opentofu.tofumaker.TofuMakerDeployment; import org.eclipse.xpanse.modules.deployment.deployers.opentofu.tofumaker.generated.model.OpenTofuResult; import org.eclipse.xpanse.modules.deployment.deployers.opentofu.utils.TfResourceTransUtils; import org.eclipse.xpanse.modules.deployment.utils.DeployEnvironments; -import org.eclipse.xpanse.modules.deployment.utils.DeployResultFileUtils; -import org.eclipse.xpanse.modules.deployment.utils.ScriptsGitRepoManage; +import org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper; import org.eclipse.xpanse.modules.models.service.deploy.exceptions.ServiceNotDeployedException; import org.eclipse.xpanse.modules.models.servicetemplate.Deployment; import org.eclipse.xpanse.modules.models.servicetemplate.enums.DeployerKind; @@ -43,7 +33,6 @@ import org.eclipse.xpanse.modules.orchestrator.deployment.DeployTask; import org.eclipse.xpanse.modules.orchestrator.deployment.Deployer; import org.eclipse.xpanse.modules.orchestrator.deployment.DeploymentScriptValidationResult; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.stereotype.Component; @@ -54,11 +43,7 @@ @Component @ConditionalOnMissingBean(TofuMakerDeployment.class) public class OpenTofuLocalDeployment implements Deployer { - public static final String SCRIPT_FILE_NAME = "resources.tf"; - public static final String STATE_FILE_NAME = "terraform.tfstate"; public static final String TF_DEBUG_FLAG = "TF_LOG"; - @Value("${clean.workspace.after.deployment.enabled:true}") - private boolean cleanWorkspaceAfterDeploymentEnabled; @Resource private OpenTofuInstaller openTofuInstaller; @Resource @@ -68,13 +53,11 @@ public class OpenTofuLocalDeployment implements Deployer { @Resource(name = ASYNC_EXECUTOR_NAME) private Executor taskExecutor; @Resource - private OpenTofuDeploymentResultCallbackManager openTofuDeploymentResultCallbackManager; + private OpenTofuDeploymentResultCallbackManager openTofuResultCallbackManager; @Resource private ServiceDeploymentEntityHandler serviceDeploymentEntityHandler; @Resource - private ScriptsGitRepoManage scriptsGitRepoManage; - @Resource - private DeployResultFileUtils deployResultFileUtils; + private DeploymentScriptsHelper scriptsHelper; /** * Deploy the DeployTask. @@ -124,7 +107,7 @@ public DeployResult modify(DeployTask task) { String resourceState = TfResourceTransUtils.getStoredStateContent( serviceDeploymentEntity); if (StringUtils.isBlank(resourceState)) { - String errorMsg = String.format("tfState of deployed service with id %s not found.", + String errorMsg = String.format("tfState of service deployment with id %s not found.", task.getServiceId()); log.error(errorMsg); throw new ServiceNotDeployedException(errorMsg); @@ -136,8 +119,10 @@ public DeployResult modify(DeployTask task) { } private void asyncExecDeploy(DeployTask task) { - String workspace = createWorkspaceForTask(task.getOrderId()); - prepareDeploymentScripts(workspace, task.getOcl().getDeployment(), null); + String workspace = scriptsHelper.createWorkspaceForTask( + getDeployerConfigWorkspace(), task.getOrderId()); + List preparedFiles = scriptsHelper.prepareDeploymentScripts( + workspace, task.getOcl().getDeployment(), null); OpenTofuLocalExecutor executor = getExecutorForDeployTask(task, workspace, true); // Execute the openTofu command asynchronously. taskExecutor.execute(() -> { @@ -151,22 +136,22 @@ private void asyncExecDeploy(DeployTask task) { openTofuResult.setCommandSuccessful(false); openTofuResult.setCommandStdError(tfEx.getMessage()); } - openTofuResult.setTerraformState(executor.getTerraformState()); + openTofuResult.setTerraformState( + scriptsHelper.getTaskTerraformState(executor.getTaskWorkspace())); openTofuResult.setOpenTofuVersionUsed( openTofuInstaller.getExactVersionOfOpenTofu(executor.getExecutorPath())); - Map importantFilesContent = executor.getImportantFilesContent(); - openTofuResult.setImportantFileContentMap(importantFilesContent); - openTofuDeploymentResultCallbackManager.orderCallback(task.getOrderId(), - openTofuResult); - if (cleanWorkspaceAfterDeploymentEnabled) { - deleteWorkspace(workspace); - } + openTofuResult.setGeneratedFileContentMap(scriptsHelper.getGeneratedFileContents( + executor.getTaskWorkspace(), preparedFiles)); + openTofuResultCallbackManager.orderCallback(task.getOrderId(), openTofuResult); + scriptsHelper.deleteTaskWorkspace(executor.getTaskWorkspace()); }); } private void asyncExecDestroy(DeployTask task, String tfState) { - String workspace = createWorkspaceForTask(task.getOrderId()); - prepareDeploymentScripts(workspace, task.getOcl().getDeployment(), tfState); + String workspace = scriptsHelper.createWorkspaceForTask( + getDeployerConfigWorkspace(), task.getOrderId()); + List preparedFiles = scriptsHelper.prepareDeploymentScripts( + workspace, task.getOcl().getDeployment(), tfState); OpenTofuLocalExecutor executor = getExecutorForDeployTask(task, workspace, false); // Execute the openTofu command asynchronously. taskExecutor.execute(() -> { @@ -180,22 +165,22 @@ private void asyncExecDestroy(DeployTask task, String tfState) { openTofuResult.setCommandSuccessful(false); openTofuResult.setCommandStdError(tfEx.getMessage()); } - openTofuResult.setTerraformState(executor.getTerraformState()); + openTofuResult.setTerraformState( + scriptsHelper.getTaskTerraformState(executor.getTaskWorkspace())); openTofuResult.setOpenTofuVersionUsed( openTofuInstaller.getExactVersionOfOpenTofu(executor.getExecutorPath())); - Map importantFilesContent = executor.getImportantFilesContent(); - openTofuResult.setImportantFileContentMap(importantFilesContent); - openTofuDeploymentResultCallbackManager.orderCallback(task.getOrderId(), - openTofuResult); - if (cleanWorkspaceAfterDeploymentEnabled) { - deleteWorkspace(workspace); - } + openTofuResult.setGeneratedFileContentMap(scriptsHelper.getGeneratedFileContents( + executor.getTaskWorkspace(), preparedFiles)); + openTofuResultCallbackManager.orderCallback(task.getOrderId(), openTofuResult); + scriptsHelper.deleteTaskWorkspace(executor.getTaskWorkspace()); }); } private void asyncExecModify(DeployTask task, String tfState) { - String workspace = createWorkspaceForTask(task.getOrderId()); - prepareDeploymentScripts(workspace, task.getOcl().getDeployment(), tfState); + String workspace = scriptsHelper.createWorkspaceForTask( + getDeployerConfigWorkspace(), task.getOrderId()); + List preparedFiles = scriptsHelper.prepareDeploymentScripts( + workspace, task.getOcl().getDeployment(), tfState); OpenTofuLocalExecutor executor = getExecutorForDeployTask(task, workspace, true); // Execute the terraform command asynchronously. taskExecutor.execute(() -> { @@ -209,68 +194,27 @@ private void asyncExecModify(DeployTask task, String tfState) { openTofuResult.setCommandSuccessful(false); openTofuResult.setCommandStdError(tfEx.getMessage()); } - openTofuResult.setTerraformState(executor.getTerraformState()); + openTofuResult.setTerraformState( + scriptsHelper.getTaskTerraformState(executor.getTaskWorkspace())); openTofuResult.setOpenTofuVersionUsed( openTofuInstaller.getExactVersionOfOpenTofu(executor.getExecutorPath())); - Map importantFilesContent = executor.getImportantFilesContent(); - openTofuResult.setImportantFileContentMap(importantFilesContent); - openTofuDeploymentResultCallbackManager.orderCallback(task.getOrderId(), - openTofuResult); - if (cleanWorkspaceAfterDeploymentEnabled) { - deleteWorkspace(workspace); - } + openTofuResult.setGeneratedFileContentMap(scriptsHelper.getGeneratedFileContents( + executor.getTaskWorkspace(), preparedFiles)); + openTofuResultCallbackManager.orderCallback(task.getOrderId(), openTofuResult); + scriptsHelper.deleteTaskWorkspace(executor.getTaskWorkspace()); }); } @Override public String getDeploymentPlanAsJson(DeployTask task) { - String workspace = createWorkspaceForTask(task.getOrderId()); - prepareDeploymentScripts(workspace, task.getOcl().getDeployment(), null); + String workspace = scriptsHelper.createWorkspaceForTask( + getDeployerConfigWorkspace(), task.getOrderId()); + scriptsHelper.prepareDeploymentScripts(workspace, task.getOcl().getDeployment(), null); // Execute the openTofu command. OpenTofuLocalExecutor executor = getExecutorForDeployTask(task, workspace, true); return executor.getOpenTofuPlanAsJson(); } - - private String createWorkspaceForTask(UUID orderId) { - String workspace = openTofuLocalConfig.getWorkspaceDirectory() + File.separator + orderId; - File ws = new File(System.getProperty("java.io.tmpdir"), workspace); - if (!ws.exists() && !ws.mkdirs()) { - throw new OpenTofuExecutorException( - "Create workspace failed, File path not created: " + ws.getAbsolutePath()); - } - return ws.getAbsolutePath(); - } - - - private void prepareDeploymentScripts(String workspace, Deployment deployment, String tfState) { - if (Objects.nonNull(deployment.getDeployer())) { - createScriptFile(workspace, deployment.getDeployer()); - if (StringUtils.isNotBlank(tfState)) { - createServiceStateFile(workspace, tfState); - } - } else if (Objects.nonNull(deployment.getScriptsRepo())) { - scriptsGitRepoManage.checkoutScripts(workspace, deployment.getScriptsRepo()); - String scriptPath = - workspace + File.separator + deployment.getScriptsRepo().getScriptsPath(); - if (StringUtils.isNotBlank(tfState)) { - createServiceStateFile(scriptPath, tfState); - } - } - } - - /** - * delete workspace. - */ - private void deleteWorkspace(String workspace) { - Path path = Paths.get(workspace); - try (Stream pathStream = Files.walk(path)) { - pathStream.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete); - } catch (Exception e) { - log.error("Delete workspace:{} error.", workspace, e); - } - } - /** * Get an OpenTofuExecutor. * @@ -278,17 +222,18 @@ private void deleteWorkspace(String workspace) { * @param workspace the workspace of the deployment. * @param isDeployTask if the task is for deploying a service. */ - private OpenTofuLocalExecutor getExecutorForDeployTask(DeployTask task, String workspace, - boolean isDeployTask) { + private OpenTofuLocalExecutor getExecutorForDeployTask( + DeployTask task, String workspace, boolean isDeployTask) { Map envVariables = this.deployEnvironments.getEnvironmentVariables(task); Map inputVariables = this.deployEnvironments.getInputVariables( task, isDeployTask); - return getExecutor(envVariables, inputVariables, workspace, task.getOcl().getDeployment()); + return getExecutor(envVariables, inputVariables, workspace, + task.getOcl().getDeployment()); } private OpenTofuLocalExecutor getExecutor(Map envVariables, - Map inputVariables, String workspace, - Deployment deployment) { + Map inputVariables, + String workspace, Deployment deployment) { if (openTofuLocalConfig.isDebugEnabled()) { log.info("Debug enabled for OpenTofu CLI with level {}", openTofuLocalConfig.getDebugLogLevel()); @@ -296,30 +241,8 @@ private OpenTofuLocalExecutor getExecutor(Map envVariables, } String executorPath = openTofuInstaller.getExecutorPathThatMatchesRequiredVersion( deployment.getDeployerTool().getVersion()); - return new OpenTofuLocalExecutor(executorPath, envVariables, inputVariables, workspace, - getSubDirectory(deployment), deployResultFileUtils); - } - - private void createScriptFile(String path, String scriptContext) { - String scriptPath = path + File.separator + SCRIPT_FILE_NAME; - try (FileWriter scriptWriter = new FileWriter(scriptPath)) { - scriptWriter.write(scriptContext); - log.info("Create script file success."); - } catch (IOException ex) { - log.error("Create script file success.", ex); - throw new OpenTofuExecutorException("Create script file success.", ex); - } - } - - private void createServiceStateFile(String path, String tfStateContext) { - String tfStateFileName = path + File.separator + STATE_FILE_NAME; - try (FileWriter scriptWriter = new FileWriter(tfStateFileName)) { - scriptWriter.write(tfStateContext); - log.info("Create service state file success."); - } catch (IOException e) { - log.error("Create service state file failed.", e); - throw new OpenTofuExecutorException("Create service state file failed.", e); - } + return new OpenTofuLocalExecutor(executorPath, envVariables, inputVariables, + scriptsHelper.getScriptsLocationInWorkspace(workspace, deployment)); } @@ -336,8 +259,9 @@ public DeployerKind getDeployerKind() { */ @Override public DeploymentScriptValidationResult validate(Deployment deployment) { - String workspace = createWorkspaceForTask(UUID.randomUUID()); - prepareDeploymentScripts(workspace, deployment, null); + String workspace = scriptsHelper.createWorkspaceForTask( + getDeployerConfigWorkspace(), UUID.randomUUID()); + scriptsHelper.prepareDeploymentScripts(workspace, deployment, null); OpenTofuLocalExecutor executor = getExecutor(new HashMap<>(), new HashMap<>(), workspace, deployment); DeploymentScriptValidationResult validationResult = executor.tfValidate(); @@ -346,13 +270,8 @@ public DeploymentScriptValidationResult validate(Deployment deployment) { return validationResult; } - @Nullable - private String getSubDirectory(Deployment deployment) { - if (Objects.nonNull(deployment.getDeployer())) { - return null; - } else if (Objects.nonNull(deployment.getScriptsRepo())) { - return deployment.getScriptsRepo().getScriptsPath(); - } - return null; + + private String getDeployerConfigWorkspace() { + return openTofuLocalConfig.getWorkspaceDirectory(); } } diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalExecutor.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalExecutor.java index 78a6ed276..d97a4064b 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalExecutor.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalExecutor.java @@ -6,24 +6,20 @@ package org.eclipse.xpanse.modules.deployment.deployers.opentofu.opentofulocal; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_VARS_FILE_NAME; + import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import jakarta.annotation.Nullable; import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; import java.util.Map; -import java.util.Objects; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.eclipse.xpanse.common.systemcmd.SystemCmd; import org.eclipse.xpanse.common.systemcmd.SystemCmdResult; import org.eclipse.xpanse.modules.deployment.deployers.opentofu.exceptions.OpenTofuExecutorException; -import org.eclipse.xpanse.modules.deployment.utils.DeployResultFileUtils; import org.eclipse.xpanse.modules.orchestrator.deployment.DeploymentScriptValidationResult; /** @@ -32,11 +28,7 @@ @Slf4j public class OpenTofuLocalExecutor { - private static final String VARS_FILE_NAME = "variables.tfvars.json"; - private static final String STATE_FILE_NAME = "terraform.tfstate"; private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); - private static final List EXCLUDED_FILE_SUFFIX_LIST = - Arrays.asList(".tf", ".tfstate", ".binary", ".hcl"); static { OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL); @@ -44,34 +36,29 @@ public class OpenTofuLocalExecutor { @Getter private final String executorPath; + @Getter + private final String taskWorkspace; private final Map env; private final Map variables; - private final String workspace; - private final DeployResultFileUtils deployResultFileUtils; /** * Constructor for openTofuExecutor. * - * @param executorPath path of the open tofu executor. - * @param env environment for the open tofu command line. - * @param variables variables for the open tofu command line. - * @param workspace workspace for the open tofu command line. - * @param deployResultFileUtils file tool class. + * @param executorPath path of the open tofu executor. + * @param env environment for the open tofu command line. + * @param variables variables for the open tofu command line. + * @param taskWorkspace workspace with scripts for the open tofu command line. */ OpenTofuLocalExecutor(String executorPath, Map env, Map variables, - String workspace, - @Nullable String subDirectory, - DeployResultFileUtils deployResultFileUtils) { + String taskWorkspace) { this.executorPath = executorPath; this.env = env; this.variables = variables; - this.workspace = - Objects.nonNull(subDirectory) - ? workspace + File.separator + subDirectory - : workspace; - this.deployResultFileUtils = deployResultFileUtils; + this.taskWorkspace = taskWorkspace; + log.info("Created OpenTofuLocalExecutor with executorPath: {} and taskWorkspace: {}", + executorPath, taskWorkspace); } /** @@ -129,14 +116,34 @@ public SystemCmdResult tfDestroy() { * @return Returns result of SystemCmd executed. */ private SystemCmdResult executeWithVariables(StringBuilder command) { - createVariablesFile(); + createVariablesFile(this.taskWorkspace, variables); command.append(" -var-file="); - command.append(VARS_FILE_NAME); + command.append(TF_VARS_FILE_NAME); SystemCmdResult systemCmdResult = execute(command.toString()); - cleanUpVariablesFile(); + cleanUpVariablesFile(this.taskWorkspace); return systemCmdResult; } + private void createVariablesFile(String taskWorkspace, Map variables) { + try { + File variablesFile = new File(taskWorkspace, TF_VARS_FILE_NAME); + log.info("creating variables file"); + OBJECT_MAPPER.writeValue(variablesFile, variables); + } catch (IOException ioException) { + throw new OpenTofuExecutorException("Creating variables file failed", ioException); + } + } + + private void cleanUpVariablesFile(String taskWorkspace) { + try { + File file = new File(taskWorkspace, TF_VARS_FILE_NAME); + log.info("cleaning up variables file"); + Files.deleteIfExists(file.toPath()); + } catch (IOException ioException) { + log.error("Cleanup of variables file failed", ioException); + } + } + /** * Executes open tofu commands. * @@ -145,7 +152,7 @@ private SystemCmdResult executeWithVariables(StringBuilder command) { private SystemCmdResult execute(String cmd) { SystemCmd systemCmd = new SystemCmd(); systemCmd.setEnv(env); - systemCmd.setWorkDir(workspace); + systemCmd.setWorkDir(taskWorkspace); return systemCmd.execute(cmd); } @@ -197,47 +204,6 @@ public void destroy() { } } - /** - * Reads the contents of the "terraform.tfstate" file from the OpenTofu workspace. - * - * @return file contents as string. - */ - public String getTerraformState() { - String state = null; - String path = workspace + File.separator + STATE_FILE_NAME; - try { - deployResultFileUtils.waitUntilFileIsNotLocked(path); - File tfState = new File(path); - if (tfState.exists()) { - state = Files.readString(tfState.toPath()); - } - } catch (IOException ex) { - log.error("OpenTofuExecutor read state file failed.", ex); - } - return state; - } - - /** - * Reads the contents of the other important file from the OpenTofu workspace. - * - * @return Map fileName as key, contents as value. - */ - public Map getImportantFilesContent() { - Map fileContentMap = new HashMap<>(); - File workPath = new File(workspace); - if (workPath.isDirectory() && workPath.exists()) { - File[] files = workPath.listFiles(); - if (Objects.nonNull(files)) { - Arrays.stream(files).forEach(file -> { - if (file.isFile() && !isExcludedFile(file.getName())) { - String content = readFileContent(file); - fileContentMap.put(file.getName(), content); - } - }); - } - } - return fileContentMap; - } /** * Method to execute open tofu plan and get the plan as a json string. @@ -264,22 +230,6 @@ public String getOpenTofuPlanAsJson() { return planJsonResult.getCommandStdOutput(); } - private boolean isExcludedFile(String fileName) { - String fileSuffix = fileName.substring(fileName.lastIndexOf(".")); - return EXCLUDED_FILE_SUFFIX_LIST.contains(fileSuffix); - } - - private String readFileContent(File file) { - String fileContent = ""; - try { - fileContent = Files.readString(file.toPath()); - log.info("Read file content with name:{} successfully.", file.getName()); - } catch (IOException e) { - log.error("Read file content with name:{} error.", file.getName(), e); - } - return fileContent; - } - /** * Executes open tofu validate command. @@ -311,27 +261,4 @@ public DeploymentScriptValidationResult tfValidate() { } } - private void createVariablesFile() { - try { - log.info("creating variables file"); - OBJECT_MAPPER.writeValue(new File(getVariablesFilePath()), variables); - } catch (IOException ioException) { - throw new OpenTofuExecutorException("Creating variables file failed", ioException); - } - } - - private void cleanUpVariablesFile() { - File file = new File(getVariablesFilePath()); - try { - log.info("cleaning up variables file"); - Files.deleteIfExists(file.toPath()); - } catch (IOException ioException) { - log.error("Cleanup of variables file failed", ioException); - } - } - - private String getVariablesFilePath() { - return this.workspace + File.separator + VARS_FILE_NAME; - } - } diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ApiClient.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ApiClient.java index 79fc8994d..c8e7666f9 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ApiClient.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ApiClient.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/BaseApi.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/BaseApi.java index 9c8955cc3..3710a4c20 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/BaseApi.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/BaseApi.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/JavaTimeFormatter.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/JavaTimeFormatter.java index d170038f6..1d786e7b7 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/JavaTimeFormatter.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/JavaTimeFormatter.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/RFC3339DateFormat.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/RFC3339DateFormat.java index bcac170bf..bab3c568e 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/RFC3339DateFormat.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/RFC3339DateFormat.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ServerConfiguration.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ServerConfiguration.java index e62b57457..eba74961d 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ServerConfiguration.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ServerConfiguration.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ServerVariable.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ServerVariable.java index 162e18729..193f92a8a 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ServerVariable.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/ServerVariable.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/AdminApi.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/AdminApi.java index f12eae4a1..7655a2071 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/AdminApi.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/AdminApi.java @@ -33,8 +33,8 @@ public AdminApi(ApiClient apiClient) { /** * Check health of OpenTofu Maker API service - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -48,8 +48,8 @@ public OpenTofuMakerSystemStatus healthCheck() throws RestClientException { /** * Check health of OpenTofu Maker API service - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromDirectoryApi.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromDirectoryApi.java index cb1332b49..a2f4dab0c 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromDirectoryApi.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromDirectoryApi.java @@ -43,8 +43,8 @@ public OpenTofuFromDirectoryApi(ApiClient apiClient) { /** * async deploy resources via OpenTofu from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -62,8 +62,8 @@ public void asyncDeployFromDirectory(String moduleDirectory, /** * async deploy resources via OpenTofu from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -124,8 +124,8 @@ public ResponseEntity asyncDeployFromDirectoryWithHttpInfo(String moduleDi /** * async destroy resources via OpenTofu from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -143,8 +143,8 @@ public void asyncDestroyFromDirectory(String moduleDirectory, /** * async destroy resources via OpenTofu from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -205,8 +205,8 @@ public ResponseEntity asyncDestroyFromDirectoryWithHttpInfo(String moduleD /** * async modify resources via OpenTofu from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -224,8 +224,8 @@ public void asyncModifyFromDirectory(String moduleDirectory, /** * async modify resources via OpenTofu from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -286,8 +286,8 @@ public ResponseEntity asyncModifyFromDirectoryWithHttpInfo(String moduleDi /** * Deploy resources via OpenTofu from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -306,8 +306,8 @@ public OpenTofuResult deployFromDirectory(String moduleDirectory, /** * Deploy resources via OpenTofu from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -369,8 +369,8 @@ public ResponseEntity deployFromDirectoryWithHttpInfo(String mod /** * Destroy the resources from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -389,8 +389,8 @@ public OpenTofuResult destroyFromDirectory(String moduleDirectory, /** * Destroy the resources from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -452,8 +452,8 @@ public ResponseEntity destroyFromDirectoryWithHttpInfo(String mo /** * Modify resources via OpenTofu from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -472,8 +472,8 @@ public OpenTofuResult modifyFromDirectory(String moduleDirectory, /** * Modify resources via OpenTofu from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -535,8 +535,8 @@ public ResponseEntity modifyFromDirectoryWithHttpInfo(String mod /** * Get OpenTofu Plan as JSON string from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -554,8 +554,8 @@ public OpenTofuPlan plan(String moduleDirectory, /** * Get OpenTofu Plan as JSON string from the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -617,8 +617,8 @@ public ResponseEntity planWithHttpInfo(String moduleDirectory, /** * Validate the OpenTofu modules in the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -636,8 +636,8 @@ public OpenTofuValidationResult validateFromDirectory(String moduleDirectory, /** * Validate the OpenTofu modules in the given directory. - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromGitRepoApi.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromGitRepoApi.java index 1c1245bd8..4f095ecb5 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromGitRepoApi.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromGitRepoApi.java @@ -44,8 +44,8 @@ public OpenTofuFromGitRepoApi(ApiClient apiClient) { /** * async deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -61,8 +61,8 @@ public void asyncDeployFromGitRepo( /** * async deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -113,8 +113,8 @@ public ResponseEntity asyncDeployFromGitRepoWithHttpInfo( /** * Async destroy the OpenTofu modules - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -130,8 +130,8 @@ public void asyncDestroyFromGitRepo( /** * Async destroy the OpenTofu modules - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -182,8 +182,8 @@ public ResponseEntity asyncDestroyFromGitRepoWithHttpInfo( /** * async modify resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -199,8 +199,8 @@ public void asyncModifyFromGitRepo( /** * async modify resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -251,8 +251,8 @@ public ResponseEntity asyncModifyFromGitRepoWithHttpInfo( /** * Deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -269,8 +269,8 @@ public OpenTofuResult deployFromGitRepo( /** * Deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -322,8 +322,8 @@ public ResponseEntity deployFromGitRepoWithHttpInfo( /** * Destroy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -340,8 +340,8 @@ public OpenTofuResult destroyFromGitRepo( /** * Destroy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -393,8 +393,8 @@ public ResponseEntity destroyFromGitRepoWithHttpInfo( /** * Modify resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -411,8 +411,8 @@ public OpenTofuResult modifyFromGitRepo( /** * Modify resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -464,8 +464,8 @@ public ResponseEntity modifyFromGitRepoWithHttpInfo( /** * Get OpenTofu Plan as JSON string from the list of script files provided - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -482,8 +482,8 @@ public OpenTofuPlan planFromGitRepo( /** * Get OpenTofu Plan as JSON string from the list of script files provided - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -535,8 +535,8 @@ public ResponseEntity planFromGitRepoWithHttpInfo( /** * Deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -553,8 +553,8 @@ public OpenTofuValidationResult validateScriptsFromGitRepo( /** * Deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromScriptsApi.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromScriptsApi.java index 75fb854db..a5968d5e1 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromScriptsApi.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/api/OpenTofuFromScriptsApi.java @@ -44,8 +44,8 @@ public OpenTofuFromScriptsApi(ApiClient apiClient) { /** * async deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -61,8 +61,8 @@ public void asyncDeployWithScripts( /** * async deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -113,8 +113,8 @@ public ResponseEntity asyncDeployWithScriptsWithHttpInfo( /** * Async destroy the OpenTofu modules - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -130,8 +130,8 @@ public void asyncDestroyWithScripts( /** * Async destroy the OpenTofu modules - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -182,8 +182,8 @@ public ResponseEntity asyncDestroyWithScriptsWithHttpInfo( /** * async modify resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -199,8 +199,8 @@ public void asyncModifyWithScripts( /** * async modify resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted @@ -251,8 +251,8 @@ public ResponseEntity asyncModifyWithScriptsWithHttpInfo( /** * Deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -269,8 +269,8 @@ public OpenTofuResult deployWithScripts( /** * Deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -322,8 +322,8 @@ public ResponseEntity deployWithScriptsWithHttpInfo( /** * Destroy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -340,8 +340,8 @@ public OpenTofuResult destroyWithScripts( /** * Destroy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -393,8 +393,8 @@ public ResponseEntity destroyWithScriptsWithHttpInfo( /** * Modify resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -411,8 +411,8 @@ public OpenTofuResult modifyWithScripts( /** * Modify resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -464,8 +464,8 @@ public ResponseEntity modifyWithScriptsWithHttpInfo( /** * Get OpenTofu Plan as JSON string from the list of script files provided - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -482,8 +482,8 @@ public OpenTofuPlan planWithScripts( /** * Get OpenTofu Plan as JSON string from the list of script files provided - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -535,8 +535,8 @@ public ResponseEntity planWithScriptsWithHttpInfo( /** * Deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK @@ -553,8 +553,8 @@ public OpenTofuValidationResult validateWithScripts( /** * Deploy resources via OpenTofu - *

422 - Unprocessable Entity *

400 - Bad Request + *

422 - Unprocessable Entity *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/ApiKeyAuth.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/ApiKeyAuth.java index 7e341c484..d9dfee390 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/ApiKeyAuth.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/ApiKeyAuth.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/Authentication.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/Authentication.java index c53a1ea19..3f8f0c315 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/Authentication.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/Authentication.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/HttpBasicAuth.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/HttpBasicAuth.java index 42b3f3829..70189fd68 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/HttpBasicAuth.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/HttpBasicAuth.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/HttpBearerAuth.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/HttpBearerAuth.java index fabcaad95..e110a8c21 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/HttpBearerAuth.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/HttpBearerAuth.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/OAuth.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/OAuth.java index dd19d804e..c09a0fa0e 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/OAuth.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/auth/OAuth.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromDirectoryRequest.java index 4b95e1279..3ea9bdd4c 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromGitRepoRequest.java index ed507d460..8ea58dfe7 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromScriptsRequest.java index a9b08c900..4996e40f8 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDeployFromScriptsRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromDirectoryRequest.java index b29c39081..6a4f3c7e2 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromGitRepoRequest.java index a0ad0b051..60c146e3b 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromScriptsRequest.java index 2a14ea7cc..0884a9dcd 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncDestroyFromScriptsRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromDirectoryRequest.java index 90894c141..c23ae2484 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromGitRepoRequest.java index 0ed7f2823..32d4733e0 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromScriptsRequest.java index 07f2b25c5..05c8a5354 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuAsyncModifyFromScriptsRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployFromDirectoryRequest.java index 932e37997..43e32756b 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployFromGitRepoRequest.java index 709ebf28e..d135e1f42 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployWithScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployWithScriptsRequest.java index db118d203..05fe68288 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployWithScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDeployWithScriptsRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyFromDirectoryRequest.java index cb2fb497b..5f2d86d87 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyFromGitRepoRequest.java index fa08fa576..4f8bb9f4a 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyWithScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyWithScriptsRequest.java index cb46665c1..f5edab43c 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyWithScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuDestroyWithScriptsRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuMakerSystemStatus.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuMakerSystemStatus.java index 77da40166..c613e209e 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuMakerSystemStatus.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuMakerSystemStatus.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyFromDirectoryRequest.java index 1f552f0e2..ec9d8d20d 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyFromGitRepoRequest.java index 0f71ad601..fe6aebb01 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyWithScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyWithScriptsRequest.java index ae8095c7a..5cc1c2fad 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyWithScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuModifyWithScriptsRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlan.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlan.java index f355131f1..46669ae20 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlan.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlan.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanFromDirectoryRequest.java index cda0c2462..812447572 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanFromGitRepoRequest.java index 6fbba1159..d54adad46 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanWithScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanWithScriptsRequest.java index aa1a3b9b5..222c07e11 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanWithScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuPlanWithScriptsRequest.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuResult.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuResult.java index 167eeb965..229e3775b 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuResult.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuResult.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -29,7 +29,7 @@ OpenTofuResult.JSON_PROPERTY_COMMAND_STD_OUTPUT, OpenTofuResult.JSON_PROPERTY_COMMAND_STD_ERROR, OpenTofuResult.JSON_PROPERTY_TERRAFORM_STATE, - OpenTofuResult.JSON_PROPERTY_IMPORTANT_FILE_CONTENT_MAP, + OpenTofuResult.JSON_PROPERTY_GENERATED_FILE_CONTENT_MAP, OpenTofuResult.JSON_PROPERTY_OPEN_TOFU_VERSION_USED, OpenTofuResult.JSON_PROPERTY_COMMAND_SUCCESSFUL }) @@ -39,14 +39,14 @@ public class OpenTofuResult { public static final String JSON_PROPERTY_COMMAND_STD_OUTPUT = "commandStdOutput"; public static final String JSON_PROPERTY_COMMAND_STD_ERROR = "commandStdError"; public static final String JSON_PROPERTY_TERRAFORM_STATE = "terraformState"; - public static final String JSON_PROPERTY_IMPORTANT_FILE_CONTENT_MAP = "importantFileContentMap"; + public static final String JSON_PROPERTY_GENERATED_FILE_CONTENT_MAP = "generatedFileContentMap"; public static final String JSON_PROPERTY_OPEN_TOFU_VERSION_USED = "openTofuVersionUsed"; public static final String JSON_PROPERTY_COMMAND_SUCCESSFUL = "commandSuccessful"; private UUID requestId; private String commandStdOutput; private String commandStdError; private String terraformState; - private Map importantFileContentMap = new HashMap<>(); + private Map generatedFileContentMap = new HashMap<>(); private String openTofuVersionUsed; private Boolean commandSuccessful; @@ -157,39 +157,39 @@ public void setTerraformState(String terraformState) { this.terraformState = terraformState; } - public OpenTofuResult importantFileContentMap(Map importantFileContentMap) { + public OpenTofuResult generatedFileContentMap(Map generatedFileContentMap) { - this.importantFileContentMap = importantFileContentMap; + this.generatedFileContentMap = generatedFileContentMap; return this; } - public OpenTofuResult putImportantFileContentMapItem(String key, - String importantFileContentMapItem) { - if (this.importantFileContentMap == null) { - this.importantFileContentMap = new HashMap<>(); + public OpenTofuResult putGeneratedFileContentMapItem(String key, + String generatedFileContentMapItem) { + if (this.generatedFileContentMap == null) { + this.generatedFileContentMap = new HashMap<>(); } - this.importantFileContentMap.put(key, importantFileContentMapItem); + this.generatedFileContentMap.put(key, generatedFileContentMapItem); return this; } /** * Data of all other files generated by the openTofu execution.The map key contains the file name and value is the file contents as string. * - * @return importantFileContentMap + * @return generatedFileContentMap */ @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_IMPORTANT_FILE_CONTENT_MAP) + @JsonProperty(JSON_PROPERTY_GENERATED_FILE_CONTENT_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map getImportantFileContentMap() { - return importantFileContentMap; + public Map getGeneratedFileContentMap() { + return generatedFileContentMap; } - @JsonProperty(JSON_PROPERTY_IMPORTANT_FILE_CONTENT_MAP) + @JsonProperty(JSON_PROPERTY_GENERATED_FILE_CONTENT_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setImportantFileContentMap(Map importantFileContentMap) { - this.importantFileContentMap = importantFileContentMap; + public void setGeneratedFileContentMap(Map generatedFileContentMap) { + this.generatedFileContentMap = generatedFileContentMap; } public OpenTofuResult openTofuVersionUsed(String openTofuVersionUsed) { @@ -257,7 +257,7 @@ public boolean equals(Object o) { Objects.equals(this.commandStdOutput, openTofuResult.commandStdOutput) && Objects.equals(this.commandStdError, openTofuResult.commandStdError) && Objects.equals(this.terraformState, openTofuResult.terraformState) && - Objects.equals(this.importantFileContentMap, openTofuResult.importantFileContentMap) + Objects.equals(this.generatedFileContentMap, openTofuResult.generatedFileContentMap) && Objects.equals(this.openTofuVersionUsed, openTofuResult.openTofuVersionUsed) && Objects.equals(this.commandSuccessful, openTofuResult.commandSuccessful); @@ -266,7 +266,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash(requestId, commandStdOutput, commandStdError, terraformState, - importantFileContentMap, openTofuVersionUsed, commandSuccessful); + generatedFileContentMap, openTofuVersionUsed, commandSuccessful); } @Override @@ -276,7 +276,7 @@ public String toString() { + " commandStdOutput: " + toIndentedString(commandStdOutput) + "\n" + " commandStdError: " + toIndentedString(commandStdError) + "\n" + " terraformState: " + toIndentedString(terraformState) + "\n" - + " importantFileContentMap: " + toIndentedString(importantFileContentMap) + + " generatedFileContentMap: " + toIndentedString(generatedFileContentMap) + "\n" + " openTofuVersionUsed: " + toIndentedString(openTofuVersionUsed) + "\n" diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuScriptGitRepoDetails.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuScriptGitRepoDetails.java index ed89d55c2..f8c0a0c3c 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuScriptGitRepoDetails.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuScriptGitRepoDetails.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuValidateDiagnostics.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuValidateDiagnostics.java index f3b6c0a4c..e0c6a4cef 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuValidateDiagnostics.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuValidateDiagnostics.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -39,7 +39,7 @@ public OpenTofuValidateDiagnostics detail(String detail) { } /** - * Get detail + * Detail of validation error. * * @return detail */ diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuValidationResult.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuValidationResult.java index a17064d7d..f2812afa5 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuValidationResult.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/OpenTofuValidationResult.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/Response.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/Response.java index b7b3278ee..a4c8165f8 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/Response.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/Response.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/WebhookConfig.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/WebhookConfig.java index a4ed050db..74c7bf1e9 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/WebhookConfig.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/tofumaker/generated/model/WebhookConfig.java @@ -2,7 +2,7 @@ * Tofu-Maker API * RESTful Services to interact with Tofu-Maker runtime * - * The version of the OpenAPI document: 1.0.7-SNAPSHOT + * The version of the OpenAPI document: 1.0.9-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/utils/TfResourceTransUtils.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/utils/TfResourceTransUtils.java index d18ecad05..d3d681a1e 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/utils/TfResourceTransUtils.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/utils/TfResourceTransUtils.java @@ -6,6 +6,8 @@ package org.eclipse.xpanse.modules.deployment.deployers.opentofu.utils; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_STATE_FILE_NAME; + import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -23,8 +25,6 @@ @Slf4j public class TfResourceTransUtils { - public static final String STATE_FILE_NAME = "terraform.tfstate"; - private TfResourceTransUtils() { // private constructor to block instantiation. } @@ -78,10 +78,10 @@ public static String getStoredStateContent(ServiceDeploymentEntity serviceDeploy if (Objects.isNull(serviceDeploymentEntity) || CollectionUtils.isEmpty(serviceDeploymentEntity.getDeploymentGeneratedFiles()) || StringUtils.isEmpty( - serviceDeploymentEntity.getDeploymentGeneratedFiles().get(STATE_FILE_NAME))) { + serviceDeploymentEntity.getDeploymentGeneratedFiles().get(TF_STATE_FILE_NAME))) { throw new ServiceNotDeployedException( "Can't find valid state context in stored deployed service."); } - return serviceDeploymentEntity.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + return serviceDeploymentEntity.getDeploymentGeneratedFiles().get(TF_STATE_FILE_NAME); } } diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/callbacks/TerraformDeploymentResultCallbackManager.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/callbacks/TerraformDeploymentResultCallbackManager.java index df0e8d8ba..fa0603f1a 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/callbacks/TerraformDeploymentResultCallbackManager.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/callbacks/TerraformDeploymentResultCallbackManager.java @@ -9,9 +9,9 @@ import java.util.Objects; import java.util.UUID; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.eclipse.xpanse.modules.deployment.DeployResultManager; import org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformboot.generated.model.TerraformResult; -import org.eclipse.xpanse.modules.deployment.deployers.terraform.utils.TfResourceTransUtils; import org.eclipse.xpanse.modules.orchestrator.deployment.DeployResult; import org.springframework.stereotype.Component; @@ -47,11 +47,11 @@ private DeployResult getDeployResult(TerraformResult result) { deployResult.setIsTaskSuccessful(true); deployResult.setMessage(null); } - deployResult.setTfStateContent(result.getTerraformState()); - deployResult.getDeploymentGeneratedFiles() - .put(TfResourceTransUtils.STATE_FILE_NAME, result.getTerraformState()); - if (Objects.nonNull(result.getImportantFileContentMap())) { - deployResult.getDeploymentGeneratedFiles().putAll(result.getImportantFileContentMap()); + if (StringUtils.isNotBlank(result.getTerraformState())) { + deployResult.setTfStateContent(result.getTerraformState()); + } + if (Objects.nonNull(result.getGeneratedFileContentMap())) { + deployResult.getDeploymentGeneratedFiles().putAll(result.getGeneratedFileContentMap()); } return deployResult; } diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ApiClient.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ApiClient.java index 3bf7141df..37fdd92fb 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ApiClient.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ApiClient.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/BaseApi.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/BaseApi.java index c12e49a94..31235d044 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/BaseApi.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/BaseApi.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/JavaTimeFormatter.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/JavaTimeFormatter.java index f12d653c3..546c4519a 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/JavaTimeFormatter.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/JavaTimeFormatter.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/RFC3339DateFormat.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/RFC3339DateFormat.java index 5d0b45b17..cb1928434 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/RFC3339DateFormat.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/RFC3339DateFormat.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ServerConfiguration.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ServerConfiguration.java index af96fb19d..f5ac5228e 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ServerConfiguration.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ServerConfiguration.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ServerVariable.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ServerVariable.java index a9de56c5f..16ace533d 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ServerVariable.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/ServerVariable.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/AdminApi.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/AdminApi.java index 761236fd5..e54345c43 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/AdminApi.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/AdminApi.java @@ -34,8 +34,8 @@ public AdminApi(ApiClient apiClient) { /** * Check health of Terraform Boot API service *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -49,8 +49,8 @@ public TerraformBootSystemStatus healthCheck() throws RestClientException { /** * Check health of Terraform Boot API service *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromDirectoryApi.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromDirectoryApi.java index aeb424a1a..8334653a0 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromDirectoryApi.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromDirectoryApi.java @@ -45,8 +45,8 @@ public TerraformFromDirectoryApi(ApiClient apiClient) { /** * async deploy resources via Terraform from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -64,8 +64,8 @@ public void asyncDeployFromDirectory(String moduleDirectory, /** * async deploy resources via Terraform from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -126,8 +126,8 @@ public ResponseEntity asyncDeployFromDirectoryWithHttpInfo(String moduleDi /** * async destroy resources via Terraform from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -145,8 +145,8 @@ public void asyncDestroyFromDirectory(String moduleDirectory, /** * async destroy resources via Terraform from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -207,8 +207,8 @@ public ResponseEntity asyncDestroyFromDirectoryWithHttpInfo(String moduleD /** * async modify resources via Terraform from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -226,8 +226,8 @@ public void asyncModifyFromDirectory(String moduleDirectory, /** * async modify resources via Terraform from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -288,8 +288,8 @@ public ResponseEntity asyncModifyFromDirectoryWithHttpInfo(String moduleDi /** * Deploy resources via Terraform from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -308,8 +308,8 @@ public TerraformResult deployFromDirectory(String moduleDirectory, /** * Deploy resources via Terraform from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -371,8 +371,8 @@ public ResponseEntity deployFromDirectoryWithHttpInfo(String mo /** * Destroy the resources from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -391,8 +391,8 @@ public TerraformResult destroyFromDirectory(String moduleDirectory, /** * Destroy the resources from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -454,8 +454,8 @@ public ResponseEntity destroyFromDirectoryWithHttpInfo(String m /** * Modify resources via Terraform from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -474,8 +474,8 @@ public TerraformResult modifyFromDirectory(String moduleDirectory, /** * Modify resources via Terraform from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -537,8 +537,8 @@ public ResponseEntity modifyFromDirectoryWithHttpInfo(String mo /** * Get Terraform Plan as JSON string from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -558,8 +558,8 @@ public TerraformPlan plan(String moduleDirectory, /** * Get Terraform Plan as JSON string from the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -628,8 +628,8 @@ public ResponseEntity planWithHttpInfo(String moduleDirectory, /** * Validate the Terraform modules in the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -647,8 +647,8 @@ public TerraformValidationResult validateFromDirectory(String moduleDirectory, /** * Validate the Terraform modules in the given directory. *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromGitRepoApi.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromGitRepoApi.java index cabe80cf8..b6b13b440 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromGitRepoApi.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromGitRepoApi.java @@ -45,8 +45,8 @@ public TerraformFromGitRepoApi(ApiClient apiClient) { /** * async deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -62,8 +62,8 @@ public void asyncDeployFromGitRepo( /** * async deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -114,8 +114,8 @@ public ResponseEntity asyncDeployFromGitRepoWithHttpInfo( /** * Async destroy the Terraform modules *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -131,8 +131,8 @@ public void asyncDestroyFromGitRepo( /** * Async destroy the Terraform modules *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -183,8 +183,8 @@ public ResponseEntity asyncDestroyFromGitRepoWithHttpInfo( /** * async deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -200,8 +200,8 @@ public void asyncModifyFromGitRepo( /** * async deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -252,8 +252,8 @@ public ResponseEntity asyncModifyFromGitRepoWithHttpInfo( /** * Deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -270,8 +270,8 @@ public TerraformResult deployFromGitRepo( /** * Deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -323,8 +323,8 @@ public ResponseEntity deployFromGitRepoWithHttpInfo( /** * Destroy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -341,8 +341,8 @@ public TerraformResult destroyFromGitRepo( /** * Destroy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -394,8 +394,8 @@ public ResponseEntity destroyFromGitRepoWithHttpInfo( /** * Modify resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -412,8 +412,8 @@ public TerraformResult modifyFromGitRepo( /** * Modify resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -465,8 +465,8 @@ public ResponseEntity modifyFromGitRepoWithHttpInfo( /** * Get Terraform Plan as JSON string from the list of script files provided *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -483,8 +483,8 @@ public TerraformPlan planFromGitRepo( /** * Get Terraform Plan as JSON string from the list of script files provided *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -536,8 +536,8 @@ public ResponseEntity planFromGitRepoWithHttpInfo( /** * Deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -554,8 +554,8 @@ public TerraformValidationResult validateScriptsFromGitRepo( /** * Deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromScriptsApi.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromScriptsApi.java index a760e8fb9..b87a4aba1 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromScriptsApi.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/api/TerraformFromScriptsApi.java @@ -45,8 +45,8 @@ public TerraformFromScriptsApi(ApiClient apiClient) { /** * async deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -62,8 +62,8 @@ public void asyncDeployWithScripts( /** * async deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -114,8 +114,8 @@ public ResponseEntity asyncDeployWithScriptsWithHttpInfo( /** * Async destroy the Terraform modules *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -131,8 +131,8 @@ public void asyncDestroyWithScripts( /** * Async destroy the Terraform modules *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -183,8 +183,8 @@ public ResponseEntity asyncDestroyWithScriptsWithHttpInfo( /** * async modify resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -200,8 +200,8 @@ public void asyncModifyWithScripts( /** * async modify resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

202 - Accepted * @@ -252,8 +252,8 @@ public ResponseEntity asyncModifyWithScriptsWithHttpInfo( /** * Deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -270,8 +270,8 @@ public TerraformResult deployWithScripts( /** * Deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -323,8 +323,8 @@ public ResponseEntity deployWithScriptsWithHttpInfo( /** * Destroy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -341,8 +341,8 @@ public TerraformResult destroyWithScripts( /** * Destroy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -394,8 +394,8 @@ public ResponseEntity destroyWithScriptsWithHttpInfo( /** * Modify resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -412,8 +412,8 @@ public TerraformResult modifyWithScripts( /** * Modify resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -465,8 +465,8 @@ public ResponseEntity modifyWithScriptsWithHttpInfo( /** * Get Terraform Plan as JSON string from the list of script files provided *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -483,8 +483,8 @@ public TerraformPlan planWithScripts( /** * Get Terraform Plan as JSON string from the list of script files provided *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -536,8 +536,8 @@ public ResponseEntity planWithScriptsWithHttpInfo( /** * Deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * @@ -554,8 +554,8 @@ public TerraformValidationResult validateWithScripts( /** * Deploy resources via Terraform *

422 - Unprocessable Entity - *

503 - Service Unavailable *

400 - Bad Request + *

503 - Service Unavailable *

502 - Bad Gateway *

200 - OK * diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/ApiKeyAuth.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/ApiKeyAuth.java index 52c25fe41..bbdb21761 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/ApiKeyAuth.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/ApiKeyAuth.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/Authentication.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/Authentication.java index b028a328a..f119b8288 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/Authentication.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/Authentication.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/HttpBasicAuth.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/HttpBasicAuth.java index 59c45d885..01f28933a 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/HttpBasicAuth.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/HttpBasicAuth.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/HttpBearerAuth.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/HttpBearerAuth.java index 76fe730b0..eb080bd7c 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/HttpBearerAuth.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/HttpBearerAuth.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/OAuth.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/OAuth.java index 88a8c31dd..9e95b87a1 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/OAuth.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/auth/OAuth.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/Response.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/Response.java index adced067f..b1e774807 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/Response.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/Response.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromDirectoryRequest.java index 2e6d90619..ba9b27432 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromGitRepoRequest.java index e62c4363a..111ad1b8a 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromScriptsRequest.java index 7cf44f524..d4690bf27 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDeployFromScriptsRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromDirectoryRequest.java index 418879a7c..98037f336 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromGitRepoRequest.java index df78371b4..fb6896fc6 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromScriptsRequest.java index 063dae378..8f5c8f62a 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncDestroyFromScriptsRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromDirectoryRequest.java index bea04205a..d80452210 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromGitRepoRequest.java index a1609e32c..8a0ffb474 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromScriptsRequest.java index adcad9e93..a7fac95ff 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformAsyncModifyFromScriptsRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformBootSystemStatus.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformBootSystemStatus.java index b44aefe3a..ea860f679 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformBootSystemStatus.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformBootSystemStatus.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployFromDirectoryRequest.java index 37fecd51f..d0f3773c7 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployFromGitRepoRequest.java index e3ca62f20..2745c7b24 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployWithScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployWithScriptsRequest.java index 19baa47df..ddf26dc3b 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployWithScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDeployWithScriptsRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyFromDirectoryRequest.java index 7b54ce2bb..fa980e304 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyFromGitRepoRequest.java index 9dc2c00e2..83830a4fe 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyWithScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyWithScriptsRequest.java index 78893f703..ce1a25b2e 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyWithScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformDestroyWithScriptsRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyFromDirectoryRequest.java index 0c3df9707..584a9c5a3 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyFromGitRepoRequest.java index d9d745d45..53025d9e7 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyWithScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyWithScriptsRequest.java index dbc7d336e..be7d57be2 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyWithScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformModifyWithScriptsRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlan.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlan.java index 4a7bba889..d3308b94c 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlan.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlan.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanFromDirectoryRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanFromDirectoryRequest.java index a463b8874..14ace3b9f 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanFromDirectoryRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanFromDirectoryRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanFromGitRepoRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanFromGitRepoRequest.java index 467ea8d26..9a1424562 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanFromGitRepoRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanFromGitRepoRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanWithScriptsRequest.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanWithScriptsRequest.java index 7f8e20573..0c28b46b0 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanWithScriptsRequest.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformPlanWithScriptsRequest.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformResult.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformResult.java index 0e786b700..077ae453a 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformResult.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformResult.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -29,7 +29,7 @@ TerraformResult.JSON_PROPERTY_COMMAND_STD_OUTPUT, TerraformResult.JSON_PROPERTY_COMMAND_STD_ERROR, TerraformResult.JSON_PROPERTY_TERRAFORM_STATE, - TerraformResult.JSON_PROPERTY_IMPORTANT_FILE_CONTENT_MAP, + TerraformResult.JSON_PROPERTY_GENERATED_FILE_CONTENT_MAP, TerraformResult.JSON_PROPERTY_TERRAFORM_VERSION_USED, TerraformResult.JSON_PROPERTY_COMMAND_SUCCESSFUL }) @@ -39,14 +39,14 @@ public class TerraformResult { public static final String JSON_PROPERTY_COMMAND_STD_OUTPUT = "commandStdOutput"; public static final String JSON_PROPERTY_COMMAND_STD_ERROR = "commandStdError"; public static final String JSON_PROPERTY_TERRAFORM_STATE = "terraformState"; - public static final String JSON_PROPERTY_IMPORTANT_FILE_CONTENT_MAP = "importantFileContentMap"; + public static final String JSON_PROPERTY_GENERATED_FILE_CONTENT_MAP = "generatedFileContentMap"; public static final String JSON_PROPERTY_TERRAFORM_VERSION_USED = "terraformVersionUsed"; public static final String JSON_PROPERTY_COMMAND_SUCCESSFUL = "commandSuccessful"; private UUID requestId; private String commandStdOutput; private String commandStdError; private String terraformState; - private Map importantFileContentMap = new HashMap<>(); + private Map generatedFileContentMap = new HashMap<>(); private String terraformVersionUsed; private Boolean commandSuccessful; @@ -157,39 +157,39 @@ public void setTerraformState(String terraformState) { this.terraformState = terraformState; } - public TerraformResult importantFileContentMap(Map importantFileContentMap) { + public TerraformResult generatedFileContentMap(Map generatedFileContentMap) { - this.importantFileContentMap = importantFileContentMap; + this.generatedFileContentMap = generatedFileContentMap; return this; } - public TerraformResult putImportantFileContentMapItem(String key, - String importantFileContentMapItem) { - if (this.importantFileContentMap == null) { - this.importantFileContentMap = new HashMap<>(); + public TerraformResult putGeneratedFileContentMapItem(String key, + String generatedFileContentMapItem) { + if (this.generatedFileContentMap == null) { + this.generatedFileContentMap = new HashMap<>(); } - this.importantFileContentMap.put(key, importantFileContentMapItem); + this.generatedFileContentMap.put(key, generatedFileContentMapItem); return this; } /** * Data of all other files generated by the terraform execution.The map key contains the file name and value is the file contents as string. * - * @return importantFileContentMap + * @return generatedFileContentMap */ @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_IMPORTANT_FILE_CONTENT_MAP) + @JsonProperty(JSON_PROPERTY_GENERATED_FILE_CONTENT_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map getImportantFileContentMap() { - return importantFileContentMap; + public Map getGeneratedFileContentMap() { + return generatedFileContentMap; } - @JsonProperty(JSON_PROPERTY_IMPORTANT_FILE_CONTENT_MAP) + @JsonProperty(JSON_PROPERTY_GENERATED_FILE_CONTENT_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setImportantFileContentMap(Map importantFileContentMap) { - this.importantFileContentMap = importantFileContentMap; + public void setGeneratedFileContentMap(Map generatedFileContentMap) { + this.generatedFileContentMap = generatedFileContentMap; } public TerraformResult terraformVersionUsed(String terraformVersionUsed) { @@ -257,8 +257,8 @@ public boolean equals(Object o) { Objects.equals(this.commandStdOutput, terraformResult.commandStdOutput) && Objects.equals(this.commandStdError, terraformResult.commandStdError) && Objects.equals(this.terraformState, terraformResult.terraformState) && - Objects.equals(this.importantFileContentMap, - terraformResult.importantFileContentMap) && + Objects.equals(this.generatedFileContentMap, + terraformResult.generatedFileContentMap) && Objects.equals(this.terraformVersionUsed, terraformResult.terraformVersionUsed) && Objects.equals(this.commandSuccessful, terraformResult.commandSuccessful); } @@ -266,7 +266,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash(requestId, commandStdOutput, commandStdError, terraformState, - importantFileContentMap, terraformVersionUsed, commandSuccessful); + generatedFileContentMap, terraformVersionUsed, commandSuccessful); } @Override @@ -276,7 +276,7 @@ public String toString() { + " commandStdOutput: " + toIndentedString(commandStdOutput) + "\n" + " commandStdError: " + toIndentedString(commandStdError) + "\n" + " terraformState: " + toIndentedString(terraformState) + "\n" - + " importantFileContentMap: " + toIndentedString(importantFileContentMap) + + " generatedFileContentMap: " + toIndentedString(generatedFileContentMap) + "\n" + " terraformVersionUsed: " + toIndentedString(terraformVersionUsed) + "\n" diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformScriptGitRepoDetails.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformScriptGitRepoDetails.java index da4aad71a..fb84283d8 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformScriptGitRepoDetails.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformScriptGitRepoDetails.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformValidateDiagnostics.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformValidateDiagnostics.java index dea029187..5e73225c5 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformValidateDiagnostics.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformValidateDiagnostics.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -39,7 +39,7 @@ public TerraformValidateDiagnostics detail(String detail) { } /** - * Get detail + * Detail of validation error. * * @return detail */ diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformValidationResult.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformValidationResult.java index 78aef6295..d7d2a1f68 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformValidationResult.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/TerraformValidationResult.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/WebhookConfig.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/WebhookConfig.java index f0eec9224..6d8209c46 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/WebhookConfig.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformboot/generated/model/WebhookConfig.java @@ -2,7 +2,7 @@ * Terraform-Boot API * RESTful Services to interact with Terraform-Boot runtime * - * The version of the OpenAPI document: 1.0.12-SNAPSHOT + * The version of the OpenAPI document: 1.0.14-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalDeployment.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalDeployment.java index 51f1ad4b5..add7a98d6 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalDeployment.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalDeployment.java @@ -7,34 +7,24 @@ import static org.eclipse.xpanse.modules.async.TaskConfiguration.ASYNC_EXECUTOR_NAME; -import jakarta.annotation.Nullable; import jakarta.annotation.Resource; import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Comparator; import java.util.HashMap; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.UUID; import java.util.concurrent.Executor; -import java.util.stream.Stream; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.eclipse.xpanse.modules.database.service.ServiceDeploymentEntity; import org.eclipse.xpanse.modules.deployment.ServiceDeploymentEntityHandler; -import org.eclipse.xpanse.modules.deployment.deployers.opentofu.exceptions.OpenTofuExecutorException; import org.eclipse.xpanse.modules.deployment.deployers.terraform.callbacks.TerraformDeploymentResultCallbackManager; import org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformboot.TerraformBootDeployment; import org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformboot.generated.model.TerraformResult; import org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.config.TerraformLocalConfig; import org.eclipse.xpanse.modules.deployment.deployers.terraform.utils.TfResourceTransUtils; import org.eclipse.xpanse.modules.deployment.utils.DeployEnvironments; -import org.eclipse.xpanse.modules.deployment.utils.DeployResultFileUtils; -import org.eclipse.xpanse.modules.deployment.utils.ScriptsGitRepoManage; +import org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper; import org.eclipse.xpanse.modules.models.service.deploy.exceptions.ServiceNotDeployedException; import org.eclipse.xpanse.modules.models.servicetemplate.Deployment; import org.eclipse.xpanse.modules.models.servicetemplate.enums.DeployerKind; @@ -42,7 +32,6 @@ import org.eclipse.xpanse.modules.orchestrator.deployment.DeployTask; import org.eclipse.xpanse.modules.orchestrator.deployment.Deployer; import org.eclipse.xpanse.modules.orchestrator.deployment.DeploymentScriptValidationResult; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.stereotype.Component; @@ -53,11 +42,7 @@ @Component @ConditionalOnMissingBean(TerraformBootDeployment.class) public class TerraformLocalDeployment implements Deployer { - public static final String SCRIPT_FILE_NAME = "resources.tf"; - public static final String STATE_FILE_NAME = "terraform.tfstate"; public static final String TF_DEBUG_FLAG = "TF_LOG"; - @Value("${clean.workspace.after.deployment.enabled:true}") - private boolean cleanWorkspaceAfterDeploymentEnabled; @Resource private TerraformInstaller terraformInstaller; @Resource @@ -67,13 +52,11 @@ public class TerraformLocalDeployment implements Deployer { @Resource(name = ASYNC_EXECUTOR_NAME) private Executor taskExecutor; @Resource - private TerraformDeploymentResultCallbackManager terraformDeploymentResultCallbackManager; + private TerraformDeploymentResultCallbackManager terraformResultCallbackManager; @Resource private ServiceDeploymentEntityHandler serviceDeploymentEntityHandler; @Resource - private ScriptsGitRepoManage scriptsGitRepoManage; - @Resource - private DeployResultFileUtils deployResultFileUtils; + private DeploymentScriptsHelper scriptsHelper; /** * Deploy the DeployTask. @@ -135,8 +118,10 @@ public DeployResult modify(DeployTask task) { } private void asyncExecDeploy(DeployTask task) { - String workspace = createWorkspaceForTask(task.getOrderId()); - prepareDeploymentScripts(workspace, task.getOcl().getDeployment(), null); + String workspace = scriptsHelper.createWorkspaceForTask( + getDeployerConfigWorkspace(), task.getOrderId()); + List preparedFiles = scriptsHelper.prepareDeploymentScripts( + workspace, task.getOcl().getDeployment(), null); TerraformLocalExecutor executor = getExecutorForDeployTask(task, workspace, true); // Execute the terraform command asynchronously. taskExecutor.execute(() -> { @@ -150,22 +135,23 @@ private void asyncExecDeploy(DeployTask task) { terraformResult.setCommandSuccessful(false); terraformResult.setCommandStdError(tfEx.getMessage()); } - terraformResult.setTerraformState(executor.getTerraformState()); + terraformResult.setTerraformState( + scriptsHelper.getTaskTerraformState(executor.getTaskWorkspace())); terraformResult.setTerraformVersionUsed( terraformInstaller.getExactVersionOfTerraform(executor.getExecutorPath())); - Map importantFileContentMap = executor.getImportantFilesContent(); - terraformResult.setImportantFileContentMap(importantFileContentMap); - terraformDeploymentResultCallbackManager.orderCallback(task.getOrderId(), + terraformResult.setGeneratedFileContentMap(scriptsHelper.getGeneratedFileContents( + executor.getTaskWorkspace(), preparedFiles)); + terraformResultCallbackManager.orderCallback(task.getOrderId(), terraformResult); - if (cleanWorkspaceAfterDeploymentEnabled) { - deleteWorkspace(workspace); - } + scriptsHelper.deleteTaskWorkspace(executor.getTaskWorkspace()); }); } private void asyncExecDestroy(DeployTask task, String tfState) { - String workspace = createWorkspaceForTask(task.getOrderId()); - prepareDeploymentScripts(workspace, task.getOcl().getDeployment(), tfState); + String workspace = scriptsHelper.createWorkspaceForTask( + getDeployerConfigWorkspace(), task.getOrderId()); + List preparedFiles = scriptsHelper.prepareDeploymentScripts( + workspace, task.getOcl().getDeployment(), tfState); TerraformLocalExecutor executor = getExecutorForDeployTask(task, workspace, false); // Execute the terraform command asynchronously. taskExecutor.execute(() -> { @@ -179,22 +165,23 @@ private void asyncExecDestroy(DeployTask task, String tfState) { terraformResult.setCommandSuccessful(false); terraformResult.setCommandStdError(tfEx.getMessage()); } - terraformResult.setTerraformState(executor.getTerraformState()); + terraformResult.setTerraformState( + scriptsHelper.getTaskTerraformState(executor.getTaskWorkspace())); terraformResult.setTerraformVersionUsed( terraformInstaller.getExactVersionOfTerraform(executor.getExecutorPath())); - Map importantFileContentMap = executor.getImportantFilesContent(); - terraformResult.setImportantFileContentMap(importantFileContentMap); - terraformDeploymentResultCallbackManager.orderCallback(task.getOrderId(), + terraformResult.setGeneratedFileContentMap(scriptsHelper.getGeneratedFileContents( + executor.getTaskWorkspace(), preparedFiles)); + terraformResultCallbackManager.orderCallback(task.getOrderId(), terraformResult); - if (cleanWorkspaceAfterDeploymentEnabled) { - deleteWorkspace(workspace); - } + scriptsHelper.deleteTaskWorkspace(executor.getTaskWorkspace()); }); } private void asyncExecModify(DeployTask task, String tfState) { - String workspace = createWorkspaceForTask(task.getOrderId()); - prepareDeploymentScripts(workspace, task.getOcl().getDeployment(), tfState); + String workspace = scriptsHelper.createWorkspaceForTask( + getDeployerConfigWorkspace(), task.getOrderId()); + List preparedFiles = scriptsHelper.prepareDeploymentScripts( + workspace, task.getOcl().getDeployment(), tfState); TerraformLocalExecutor executor = getExecutorForDeployTask(task, workspace, true); // Execute the terraform command asynchronously. taskExecutor.execute(() -> { @@ -208,40 +195,29 @@ private void asyncExecModify(DeployTask task, String tfState) { terraformResult.setCommandSuccessful(false); terraformResult.setCommandStdError(tfEx.getMessage()); } - terraformResult.setTerraformState(executor.getTerraformState()); + terraformResult.setTerraformState( + scriptsHelper.getTaskTerraformState(executor.getTaskWorkspace())); terraformResult.setTerraformVersionUsed( terraformInstaller.getExactVersionOfTerraform(executor.getExecutorPath())); - Map importantFileContentMap = executor.getImportantFilesContent(); - terraformResult.setImportantFileContentMap(importantFileContentMap); - terraformDeploymentResultCallbackManager.orderCallback(task.getOrderId(), + terraformResult.setGeneratedFileContentMap(scriptsHelper.getGeneratedFileContents( + executor.getTaskWorkspace(), preparedFiles)); + terraformResultCallbackManager.orderCallback(task.getOrderId(), terraformResult); - if (cleanWorkspaceAfterDeploymentEnabled) { - deleteWorkspace(workspace); - } + scriptsHelper.deleteTaskWorkspace(executor.getTaskWorkspace()); }); } @Override public String getDeploymentPlanAsJson(DeployTask task) { - String workspace = createWorkspaceForTask(task.getOrderId()); - prepareDeploymentScripts(workspace, task.getOcl().getDeployment(), null); + String workspace = scriptsHelper.createWorkspaceForTask( + getDeployerConfigWorkspace(), task.getOrderId()); + scriptsHelper.prepareDeploymentScripts( + workspace, task.getOcl().getDeployment(), null); // Execute the terraform command. TerraformLocalExecutor executor = getExecutorForDeployTask(task, workspace, true); return executor.getTerraformPlanAsJson(); } - /** - * delete workspace. - */ - private void deleteWorkspace(String workspace) { - Path path = Paths.get(workspace); - try (Stream pathStream = Files.walk(path)) { - pathStream.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete); - } catch (Exception e) { - log.error("Delete workspace:{} error.", workspace, e); - } - } - /** * Get a TerraformExecutor. * @@ -254,11 +230,13 @@ private TerraformLocalExecutor getExecutorForDeployTask(DeployTask task, String Map envVariables = this.deployEnvironments.getEnvironmentVariables(task); Map inputVariables = this.deployEnvironments.getInputVariables( task, isDeployTask); - return getExecutor(envVariables, inputVariables, workspace, task.getOcl().getDeployment()); + return getExecutor(envVariables, inputVariables, workspace, + task.getOcl().getDeployment()); } private TerraformLocalExecutor getExecutor(Map envVariables, - Map inputVariables, String workspace, + Map inputVariables, + String workspace, Deployment deployment) { if (terraformLocalConfig.isDebugEnabled()) { log.info("Debug enabled for Terraform CLI with level {}", @@ -267,56 +245,8 @@ private TerraformLocalExecutor getExecutor(Map envVariables, } String executorPath = terraformInstaller.getExecutorPathThatMatchesRequiredVersion( deployment.getDeployerTool().getVersion()); - return new TerraformLocalExecutor(executorPath, envVariables, inputVariables, workspace, - getSubDirectory(deployment), deployResultFileUtils); - } - - private String createWorkspaceForTask(UUID orderId) { - String workspace = terraformLocalConfig.getWorkspaceDirectory() + File.separator + orderId; - File ws = new File(System.getProperty("java.io.tmpdir"), workspace); - if (!ws.exists() && !ws.mkdirs()) { - throw new OpenTofuExecutorException( - "Create workspace failed, File path not created: " + ws.getAbsolutePath()); - } - return ws.getAbsolutePath(); - } - - private void prepareDeploymentScripts(String workspace, Deployment deployment, String tfState) { - if (Objects.nonNull(deployment.getDeployer())) { - createScriptFile(workspace, deployment.getDeployer()); - if (StringUtils.isNotBlank(tfState)) { - createServiceStateFile(workspace, tfState); - } - } else if (Objects.nonNull(deployment.getScriptsRepo())) { - scriptsGitRepoManage.checkoutScripts(workspace, deployment.getScriptsRepo()); - String scriptPath = - workspace + File.separator + deployment.getScriptsRepo().getScriptsPath(); - if (StringUtils.isNotBlank(tfState)) { - createServiceStateFile(scriptPath, tfState); - } - } - } - - private void createScriptFile(String path, String scriptContext) { - String scriptPath = path + File.separator + SCRIPT_FILE_NAME; - try (FileWriter scriptWriter = new FileWriter(scriptPath)) { - scriptWriter.write(scriptContext); - log.info("Create script file success."); - } catch (IOException ex) { - log.error("Create script file success.", ex); - throw new OpenTofuExecutorException("Create script file success.", ex); - } - } - - private void createServiceStateFile(String path, String tfStateContext) { - String tfStateFileName = path + File.separator + STATE_FILE_NAME; - try (FileWriter scriptWriter = new FileWriter(tfStateFileName)) { - scriptWriter.write(tfStateContext); - log.info("Create service state file success."); - } catch (IOException e) { - log.error("Create service state file failed.", e); - throw new OpenTofuExecutorException("Create service state file failed.", e); - } + return new TerraformLocalExecutor(executorPath, envVariables, inputVariables, + scriptsHelper.getScriptsLocationInWorkspace(workspace, deployment)); } @@ -333,8 +263,9 @@ public DeployerKind getDeployerKind() { */ @Override public DeploymentScriptValidationResult validate(Deployment deployment) { - String workspace = createWorkspaceForTask(UUID.randomUUID()); - prepareDeploymentScripts(workspace, deployment, null); + String workspace = scriptsHelper.createWorkspaceForTask( + getDeployerConfigWorkspace(), UUID.randomUUID()); + scriptsHelper.prepareDeploymentScripts(workspace, deployment, null); TerraformLocalExecutor executor = getExecutor(new HashMap<>(), new HashMap<>(), workspace, deployment); DeploymentScriptValidationResult validationResult = executor.tfValidate(); @@ -343,13 +274,7 @@ public DeploymentScriptValidationResult validate(Deployment deployment) { return validationResult; } - @Nullable - private String getSubDirectory(Deployment deployment) { - if (Objects.nonNull(deployment.getDeployer())) { - return null; - } else if (Objects.nonNull(deployment.getScriptsRepo())) { - return deployment.getScriptsRepo().getScriptsPath(); - } - return null; + private String getDeployerConfigWorkspace() { + return terraformLocalConfig.getWorkspaceDirectory(); } } diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalExecutor.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalExecutor.java index abf3dab99..534beffb7 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalExecutor.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalExecutor.java @@ -5,24 +5,21 @@ package org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_VARS_FILE_NAME; + import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import jakarta.annotation.Nullable; import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; import java.util.Map; -import java.util.Objects; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.eclipse.xpanse.common.systemcmd.SystemCmd; import org.eclipse.xpanse.common.systemcmd.SystemCmdResult; +import org.eclipse.xpanse.modules.deployment.deployers.opentofu.exceptions.OpenTofuExecutorException; import org.eclipse.xpanse.modules.deployment.deployers.terraform.exceptions.TerraformExecutorException; -import org.eclipse.xpanse.modules.deployment.utils.DeployResultFileUtils; import org.eclipse.xpanse.modules.orchestrator.deployment.DeploymentScriptValidationResult; /** @@ -31,11 +28,7 @@ @Slf4j public class TerraformLocalExecutor { - private static final String VARS_FILE_NAME = "variables.tfvars.json"; - private static final String STATE_FILE_NAME = "terraform.tfstate"; private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); - private static final List EXCLUDED_FILE_SUFFIX_LIST = - Arrays.asList(".tf", ".tfstate", ".binary", ".hcl"); static { OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL); @@ -43,34 +36,29 @@ public class TerraformLocalExecutor { @Getter private final String executorPath; + @Getter + private final String taskWorkspace; private final Map env; private final Map variables; - private final String workspace; - private final DeployResultFileUtils deployResultFileUtils; /** * Constructor for terraformExecutor. * - * @param executorPath path of the terraform executor. - * @param env environment for the terraform command line. - * @param variables variables for the terraform command line. - * @param workspace workspace for the terraform command line. - * @param deployResultFileUtils file tool class. + * @param executorPath path of the terraform executor. + * @param env environment for the terraform command line. + * @param variables variables for the terraform command line. + * @param taskWorkspace taskWorkspace for the terraform command line. */ TerraformLocalExecutor(String executorPath, Map env, Map variables, - String workspace, - @Nullable String subDirectory, - DeployResultFileUtils deployResultFileUtils) { + String taskWorkspace) { this.executorPath = executorPath; this.env = env; this.variables = variables; - this.workspace = - Objects.nonNull(subDirectory) - ? workspace + File.separator + subDirectory - : workspace; - this.deployResultFileUtils = deployResultFileUtils; + this.taskWorkspace = taskWorkspace; + log.info("Created TerraformLocalExecutor with executorPath: {} and taskWorkspace: {}", + executorPath, taskWorkspace); } /** @@ -128,14 +116,34 @@ public SystemCmdResult tfDestroy() { * @return Returns result of SystemCmd executed. */ private SystemCmdResult executeWithVariables(StringBuilder command) { - createVariablesFile(); + createVariablesFile(this.taskWorkspace, variables); command.append(" -var-file="); - command.append(VARS_FILE_NAME); + command.append(TF_VARS_FILE_NAME); SystemCmdResult systemCmdResult = execute(command.toString()); - cleanUpVariablesFile(); + cleanUpVariablesFile(this.taskWorkspace); return systemCmdResult; } + private void createVariablesFile(String taskWorkspace, Map variables) { + try { + File variablesFile = new File(taskWorkspace, TF_VARS_FILE_NAME); + log.info("creating variables file"); + OBJECT_MAPPER.writeValue(variablesFile, variables); + } catch (IOException ioException) { + throw new OpenTofuExecutorException("Creating variables file failed", ioException); + } + } + + private void cleanUpVariablesFile(String taskWorkspace) { + try { + File variablesFile = new File(taskWorkspace, TF_VARS_FILE_NAME); + log.info("cleaning up variables file"); + Files.deleteIfExists(variablesFile.toPath()); + } catch (IOException ioException) { + log.error("Cleanup of variables file failed", ioException); + } + } + /** * Executes terraform commands. * @@ -144,7 +152,7 @@ private SystemCmdResult executeWithVariables(StringBuilder command) { private SystemCmdResult execute(String cmd) { SystemCmd systemCmd = new SystemCmd(); systemCmd.setEnv(env); - systemCmd.setWorkDir(workspace); + systemCmd.setWorkDir(taskWorkspace); return systemCmd.execute(cmd); } @@ -196,48 +204,6 @@ public void destroy() { } } - /** - * Reads the contents of the this.executorPath + ".tfstate" file from the terraform workspace. - * - * @return file contents as string. - */ - public String getTerraformState() { - String state = null; - String path = workspace + File.separator + STATE_FILE_NAME; - try { - deployResultFileUtils.waitUntilFileIsNotLocked(path); - File tfState = new File(path); - if (tfState.exists()) { - state = Files.readString(tfState.toPath()); - } - } catch (IOException ex) { - log.error("Read state file failed.", ex); - } - return state; - } - - /** - * Reads the contents of the other important file from the terraform workspace. - * - * @return Map fileName as key, contents as value. - */ - public Map getImportantFilesContent() { - Map fileContentMap = new HashMap<>(); - File workPath = new File(workspace); - if (workPath.isDirectory() && workPath.exists()) { - File[] files = workPath.listFiles(); - if (Objects.nonNull(files)) { - Arrays.stream(files).forEach(file -> { - if (file.isFile() && !isExcludedFile(file.getName())) { - String content = readFileContent(file); - fileContentMap.put(file.getName(), content); - } - }); - } - } - return fileContentMap; - } - /** * Method to execute terraform plan and get the plan as a json string. */ @@ -263,22 +229,6 @@ public String getTerraformPlanAsJson() { return planJsonResult.getCommandStdOutput(); } - private boolean isExcludedFile(String fileName) { - String fileSuffix = fileName.substring(fileName.lastIndexOf(".")); - return EXCLUDED_FILE_SUFFIX_LIST.contains(fileSuffix); - } - - private String readFileContent(File file) { - String fileContent = ""; - try { - fileContent = Files.readString(file.toPath()); - log.info("Read file content with name:{} successfully.", file.getName()); - } catch (IOException e) { - log.error("Read file content with name:{} error.", file.getName(), e); - } - return fileContent; - } - /** * Executes terraform validate command. @@ -301,27 +251,4 @@ public DeploymentScriptValidationResult tfValidate() { } } - private void createVariablesFile() { - try { - log.info("creating variables file"); - OBJECT_MAPPER.writeValue(new File(getVariablesFilePath()), variables); - } catch (IOException ioException) { - throw new TerraformExecutorException("Creating variables file failed", ioException); - } - } - - private void cleanUpVariablesFile() { - File file = new File(getVariablesFilePath()); - try { - log.info("cleaning up variables file"); - Files.deleteIfExists(file.toPath()); - } catch (IOException ioException) { - log.error("Cleanup of variables file failed", ioException); - } - } - - private String getVariablesFilePath() { - return this.workspace + File.separator + VARS_FILE_NAME; - } - } diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/utils/TfResourceTransUtils.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/utils/TfResourceTransUtils.java index 8bbd72809..32ca4ddb7 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/utils/TfResourceTransUtils.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/utils/TfResourceTransUtils.java @@ -6,6 +6,8 @@ package org.eclipse.xpanse.modules.deployment.deployers.terraform.utils; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_STATE_FILE_NAME; + import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -23,8 +25,6 @@ @Slf4j public class TfResourceTransUtils { - public static final String STATE_FILE_NAME = "terraform.tfstate"; - private TfResourceTransUtils() { // private constructor to block instantiation. } @@ -81,10 +81,10 @@ public static String getStoredStateContent(ServiceDeploymentEntity serviceDeploy if (Objects.isNull(serviceDeploymentEntity) || CollectionUtils.isEmpty(serviceDeploymentEntity.getDeploymentGeneratedFiles()) || StringUtils.isEmpty( - serviceDeploymentEntity.getDeploymentGeneratedFiles().get(STATE_FILE_NAME))) { + serviceDeploymentEntity.getDeploymentGeneratedFiles().get(TF_STATE_FILE_NAME))) { throw new ServiceNotDeployedException( "Can't find valid state context in stored deployed service."); } - return serviceDeploymentEntity.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + return serviceDeploymentEntity.getDeploymentGeneratedFiles().get(TF_STATE_FILE_NAME); } } diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/exceptions/DeploymentScriptsCreationFailedException.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/exceptions/DeploymentScriptsCreationFailedException.java new file mode 100644 index 000000000..7e9588806 --- /dev/null +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/exceptions/DeploymentScriptsCreationFailedException.java @@ -0,0 +1,16 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: Huawei Inc. + */ + +package org.eclipse.xpanse.modules.deployment.exceptions; + +/** + * Defines possible exceptions when the deployment scripts are not created successfully. + */ +public class DeploymentScriptsCreationFailedException extends RuntimeException { + + public DeploymentScriptsCreationFailedException(String message) { + super(message); + } +} diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/utils/DeployResultFileUtils.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/utils/DeployResultFileUtils.java deleted file mode 100644 index 122b9924c..000000000 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/utils/DeployResultFileUtils.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * SPDX-FileCopyrightText: Huawei Inc. - * - */ - -package org.eclipse.xpanse.modules.deployment.utils; - -import java.io.IOException; -import java.io.RandomAccessFile; -import java.nio.channels.FileChannel; -import java.nio.channels.FileLock; -import java.time.Duration; -import java.util.concurrent.TimeUnit; -import lombok.extern.slf4j.Slf4j; -import org.awaitility.Awaitility; -import org.awaitility.core.ConditionTimeoutException; -import org.eclipse.xpanse.modules.models.service.deploy.exceptions.FileLockedException; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -/** - * Tool class for files after deployment is completed. - */ -@Slf4j -@Component -public class DeployResultFileUtils { - - private static final String MODE = "rw"; - @Value("${wait.time.for.deploy.result.file.lock.in.seconds}") - private int awaitAtMost; - @Value("${polling.interval.for.deploy.result.file.lock.check.in.seconds}") - private int awaitPollingInterval; - - /** - * Method to await for the tfstate file to be unlocked. - */ - public void waitUntilFileIsNotLocked(String path) { - try { - Awaitility.await() - .atMost(Duration.ofSeconds(awaitAtMost)) - .pollInterval(Duration.ofSeconds(awaitPollingInterval)) - .pollDelay(0, TimeUnit.SECONDS) - .until(() -> !isTfStateFileLocked(path)); - } catch (ConditionTimeoutException e) { - String errorMsg = String.format( - "Timeout waiting for file to be unlocked, %s", e.getMessage()); - log.info(errorMsg); - throw new FileLockedException(errorMsg); - } - } - - private boolean isTfStateFileLocked(String filePath) { - try (RandomAccessFile file = new RandomAccessFile(filePath, MODE); - FileChannel channel = file.getChannel()) { - try (FileLock lock = channel.tryLock()) { - if (lock != null) { - lock.release(); - return false; - } - } - } catch (IOException e) { - return true; - } - return true; - } - -} diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/utils/DeploymentScriptsHelper.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/utils/DeploymentScriptsHelper.java new file mode 100644 index 000000000..0d6afba12 --- /dev/null +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/utils/DeploymentScriptsHelper.java @@ -0,0 +1,280 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: Huawei Inc. + */ + +package org.eclipse.xpanse.modules.deployment.utils; + +import jakarta.annotation.Nullable; +import jakarta.annotation.Resource; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.nio.channels.FileChannel; +import java.nio.channels.FileLock; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.awaitility.Awaitility; +import org.awaitility.core.ConditionTimeoutException; +import org.eclipse.xpanse.modules.deployment.exceptions.DeploymentScriptsCreationFailedException; +import org.eclipse.xpanse.modules.models.service.deploy.exceptions.FileLockedException; +import org.eclipse.xpanse.modules.models.servicetemplate.Deployment; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * Bean to manage deployment scripts. + */ +@Slf4j +@Component +public class DeploymentScriptsHelper { + + public static final String TF_SCRIPT_FILE_EXTENSION = ".tf"; + public static final String TF_SCRIPT_FILE_NAME = "resources.tf"; + public static final String TF_VARS_FILE_NAME = "variables.tfvars.json"; + public static final String TF_STATE_FILE_NAME = "terraform.tfstate"; + private static final List EXCLUDED_FILE_SUFFIX_LIST = + Arrays.asList(".tf", ".tfstate", ".binary", ".hcl"); + private static final String MODE = "rw"; + + @Value("${wait.time.for.deploy.result.file.lock.in.seconds}") + private int awaitAtMost; + @Value("${polling.interval.for.deploy.result.file.lock.check.in.seconds}") + private int awaitPollingInterval; + @Value("${clean.workspace.after.deployment.enabled:true}") + private boolean cleanWorkspaceAfterDeploymentEnabled; + @Resource + private ScriptsGitRepoManage scriptsGitRepoManage; + + /** + * Create workspace directory for a deployment task. + * + * @param configWorkspaceDir config workspace directory. + * @param orderId id of the deployment order task. + * @return absolute path of the taskWorkspace. + */ + public String createWorkspaceForTask(String configWorkspaceDir, UUID orderId) { + File baseWorkspace = new File(System.getProperty("java.io.tmpdir"), configWorkspaceDir); + File taskWorkspace = new File(baseWorkspace, orderId.toString()); + if (!taskWorkspace.exists() && !taskWorkspace.mkdirs()) { + throw new DeploymentScriptsCreationFailedException( + "Create workspace for task failed, File path not created: " + + taskWorkspace.getAbsolutePath()); + } + return taskWorkspace.getAbsolutePath(); + } + + + /** + * Prepare the deployment script files for a deployment task. + * + * @param taskWorkspace workspace directory for the task. + * @param deployment deployment object containing the scripts to be used for deployment. + * @param tfState tf state file content. + * @return list of files created for deployment. + */ + public List prepareDeploymentScripts(String taskWorkspace, Deployment deployment, + String tfState) { + File ws = new File(taskWorkspace); + if (!ws.exists() && !ws.mkdirs()) { + throw new DeploymentScriptsCreationFailedException( + "Create workspace for task failed, File path not created: " + taskWorkspace); + } + List files = new ArrayList<>(); + if (Objects.nonNull(deployment.getDeployer())) { + File scriptFile = createScriptFile(taskWorkspace, deployment.getDeployer()); + files.add(scriptFile); + if (StringUtils.isNotBlank(tfState)) { + File stateFile = createServiceStateFile(taskWorkspace, tfState); + files.add(stateFile); + } + + } else if (Objects.nonNull(deployment.getScriptsRepo())) { + List scriptFiles = scriptsGitRepoManage.checkoutScripts(taskWorkspace, + deployment.getScriptsRepo()); + files.addAll(scriptFiles); + if (StringUtils.isNotBlank(tfState)) { + String scriptPath = taskWorkspace + File.separator + + deployment.getScriptsRepo().getScriptsPath(); + File stateFile = createServiceStateFile(scriptPath, tfState); + files.add(stateFile); + } + } + return files; + } + + + /** + * Reads the contents of the "terraform.tfstate" file in the workspace for the task. + * + * @return file contents as string. + */ + public String getTaskTerraformState(String taskWorkspace) { + String state = null; + String path = new File(taskWorkspace, TF_STATE_FILE_NAME).getAbsolutePath(); + try { + waitUntilFileIsNotLocked(path); + File tfState = new File(path); + if (tfState.exists()) { + state = Files.readString(tfState.toPath()); + } + } catch (IOException ex) { + log.error("Read terraform state file failed.", ex); + } + return state; + } + + /** + * Reads the contents of the other generated file in the workspace for the task. + * + * @return Map fileName as key, contents as value. + */ + public Map getGeneratedFileContents(String taskWorkspace, + List preparedFiles) { + Map fileContentMap = new HashMap<>(); + File workPath = new File(taskWorkspace); + if (workPath.isDirectory() && workPath.exists()) { + File[] files = workPath.listFiles(); + if (Objects.nonNull(files)) { + Arrays.stream(files).forEach(file -> { + if (file.isFile() && !isExcludedFile(file.getName()) + && !preparedFiles.contains(file)) { + String content = readFileContent(file); + fileContentMap.put(file.getName(), content); + } + }); + } + } + return fileContentMap; + } + + + /** + * Delete all files in the workspace for the task. + * + * @param taskWorkspace workspace directory for the task. + */ + public void deleteTaskWorkspace(String taskWorkspace) { + if (cleanWorkspaceAfterDeploymentEnabled) { + Path path = Paths.get(taskWorkspace); + try (Stream pathStream = Files.walk(path)) { + pathStream.sorted(Comparator.reverseOrder()).map(Path::toFile) + .forEach(file -> { + if (!file.delete()) { + log.error("Failed to delete file: {}", file.getAbsolutePath()); + } + }); + } catch (Exception e) { + log.error("Delete workspace:{} for the task error.", taskWorkspace, e); + } + } + } + + /** + * Get the scripts location in the workspace for the deployment task. + * + * @param taskWorkspace workspace directory for the deployment task. + * @param deployment deployment object. + * @return scripts location path in the workspace for the deployment task. + */ + @Nullable + public String getScriptsLocationInWorkspace(String taskWorkspace, Deployment deployment) { + if (Objects.nonNull(deployment.getScriptsRepo())) { + log.info("Deployment scripts are from git repo. Scripts path:{}", + deployment.getScriptsRepo().getScriptsPath()); + return taskWorkspace + File.separator + deployment.getScriptsRepo().getScriptsPath(); + } + return taskWorkspace; + } + + private File createScriptFile(String taskWorkspace, String scriptContent) { + String scriptPath = taskWorkspace + File.separator + TF_SCRIPT_FILE_NAME; + try (FileWriter scriptWriter = new FileWriter(scriptPath)) { + scriptWriter.write(scriptContent); + log.info("Created deployment script files successful"); + return new File(scriptPath); + } catch (IOException ex) { + log.error("Created deployment script files failed.", ex); + throw new DeploymentScriptsCreationFailedException( + "Created deployment script files failed."); + } + } + + private File createServiceStateFile(String taskWorkspace, String tfStateContext) { + String tfStateFileName = taskWorkspace + File.separator + TF_STATE_FILE_NAME; + try (FileWriter scriptWriter = new FileWriter(tfStateFileName)) { + scriptWriter.write(tfStateContext); + log.info("Create service state file success."); + return new File(tfStateFileName); + } catch (IOException e) { + log.error("Create service state file failed.", e); + throw new DeploymentScriptsCreationFailedException("Create service state file failed."); + } + } + + private boolean isExcludedFile(String fileName) { + String fileSuffix = fileName.substring(fileName.lastIndexOf(".")); + return EXCLUDED_FILE_SUFFIX_LIST.contains(fileSuffix); + } + + private String readFileContent(File file) { + try { + return Files.readString(file.toPath()); + } catch (IOException e) { + log.error("Read file content with name:{} error.", file.getName(), e); + } + return null; + } + + + /** + * Method to await for the tfstate file to be unlocked. + * + * @param tfStateFilePath tfstate file path. + */ + private void waitUntilFileIsNotLocked(String tfStateFilePath) { + try { + Awaitility.await() + .atMost(Duration.ofSeconds(awaitAtMost)) + .pollInterval(Duration.ofSeconds(awaitPollingInterval)) + .pollDelay(0, TimeUnit.SECONDS) + .until(() -> !isTfStateFileLocked(tfStateFilePath)); + } catch (ConditionTimeoutException e) { + String errorMsg = String.format( + "Timeout waiting for file to be unlocked, %s", e.getMessage()); + log.info(errorMsg); + throw new FileLockedException(errorMsg); + } + } + + private boolean isTfStateFileLocked(String tfStateFilePath) { + try (RandomAccessFile file = new RandomAccessFile(tfStateFilePath, MODE); + FileChannel channel = file.getChannel()) { + try (FileLock lock = channel.tryLock()) { + if (lock != null) { + lock.release(); + return false; + } + } + } catch (IOException e) { + return true; + } + return true; + } + +} diff --git a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/utils/ScriptsGitRepoManage.java b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/utils/ScriptsGitRepoManage.java index f3196fb9f..dbd83f4a6 100644 --- a/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/utils/ScriptsGitRepoManage.java +++ b/modules/deployment/src/main/java/org/eclipse/xpanse/modules/deployment/utils/ScriptsGitRepoManage.java @@ -5,13 +5,20 @@ package org.eclipse.xpanse.modules.deployment.utils; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_SCRIPT_FILE_EXTENSION; + import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.Objects; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.eclipse.jgit.api.CloneCommand; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.storage.file.FileRepositoryBuilder; +import org.eclipse.xpanse.modules.deployment.exceptions.DeploymentScriptsCreationFailedException; import org.eclipse.xpanse.modules.models.common.exceptions.GitRepoCloneException; import org.eclipse.xpanse.modules.models.servicetemplate.ScriptsRepo; import org.springframework.beans.factory.annotation.Value; @@ -39,7 +46,7 @@ public class ScriptsGitRepoManage { @Retryable(retryFor = GitRepoCloneException.class, maxAttemptsExpression = "${http.request.retry.max.attempts}", backoff = @Backoff(delayExpression = "${http.request.retry.delay.milliseconds}")) - public File[] checkoutScripts(String workspace, ScriptsRepo scriptsRepo) { + public List checkoutScripts(String workspace, ScriptsRepo scriptsRepo) { File workspaceDirectory = new File(workspace); FileRepositoryBuilder repositoryBuilder = new FileRepositoryBuilder(); repositoryBuilder.findGitDir(workspaceDirectory); @@ -64,24 +71,42 @@ public File[] checkoutScripts(String workspace, ScriptsRepo scriptsRepo) { } else { log.info("Scripts repo is already cloned in the workspace."); } - return folderContainsScripts(workspace, scriptsRepo); + List files = getSourceFiles(workspace, scriptsRepo); + validateIfFolderContainsTerraformScripts(files, scriptsRepo); + return files; } - private File[] folderContainsScripts(String workspace, ScriptsRepo scriptsRepo) { + private List getSourceFiles(String workspace, ScriptsRepo scriptsRepo) { + List sourceFiles = new ArrayList<>(); File directory = new File(workspace - + (Objects.nonNull(scriptsRepo.getScriptsPath()) + + (StringUtils.isNotBlank(scriptsRepo.getScriptsPath()) ? File.separator + scriptsRepo.getScriptsPath() : "")); - File[] files = directory.listFiles((dir, name) -> name.toLowerCase().endsWith(".tf")); - if (Objects.isNull(files) || files.length == 0) { - throw new GitRepoCloneException( - "No terraform scripts found in the " + if (directory.exists() && directory.isDirectory()) { + File[] files = directory.listFiles(); + if (Objects.nonNull(files)) { + Arrays.stream(files).forEach(file -> { + if (file.isFile()) { + sourceFiles.add(file); + } + }); + } + } + return sourceFiles; + } + + private void validateIfFolderContainsTerraformScripts( + List files, ScriptsRepo scriptsRepo) { + boolean isScriptsExisted = files.stream() + .anyMatch(file -> file.getName().endsWith(TF_SCRIPT_FILE_EXTENSION)); + if (!isScriptsExisted) { + throw new DeploymentScriptsCreationFailedException( + "No deployment scripts found in the " + scriptsRepo.getRepoUrl() + " repo's '" - + (Objects.nonNull(scriptsRepo.getScriptsPath()) - ? scriptsRepo.getScriptsPath() : "root") + + (StringUtils.isNotBlank(scriptsRepo.getScriptsPath()) + ? File.separator + scriptsRepo.getScriptsPath() : "root") + "' folder."); } - return files; } } diff --git a/modules/deployment/src/main/resources/terraform-boot-openapi.json b/modules/deployment/src/main/resources/terraform-boot-openapi.json index c6acd38a5..1a09c5205 100644 --- a/modules/deployment/src/main/resources/terraform-boot-openapi.json +++ b/modules/deployment/src/main/resources/terraform-boot-openapi.json @@ -3,7 +3,7 @@ "info": { "title": "Terraform-Boot API", "description": "RESTful Services to interact with Terraform-Boot runtime", - "version": "1.0.12-SNAPSHOT" + "version": "1.0.14-SNAPSHOT" }, "servers": [ { @@ -65,8 +65,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -75,8 +75,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -136,8 +136,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -146,8 +146,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -207,8 +207,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -217,8 +217,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -278,8 +278,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -288,8 +288,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -342,8 +342,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -352,8 +352,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -413,8 +413,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -423,8 +423,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -484,8 +484,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -494,8 +494,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -548,8 +548,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -558,8 +558,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -619,8 +619,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -629,8 +629,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -690,8 +690,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -700,8 +700,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -761,8 +761,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -771,8 +771,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -825,8 +825,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -835,8 +835,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -896,8 +896,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -906,8 +906,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -967,8 +967,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -977,8 +977,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1051,8 +1051,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1061,8 +1061,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1133,8 +1133,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1143,8 +1143,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1215,8 +1215,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1225,8 +1225,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1290,8 +1290,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1300,8 +1300,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1372,8 +1372,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1382,8 +1382,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1426,8 +1426,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1436,8 +1436,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1508,8 +1508,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1518,8 +1518,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1579,8 +1579,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1589,8 +1589,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1643,8 +1643,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1653,8 +1653,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1718,8 +1718,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1728,8 +1728,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1800,8 +1800,8 @@ } } }, - "503": { - "description": "Service Unavailable", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1810,8 +1810,8 @@ } } }, - "400": { - "description": "Bad Request", + "503": { + "description": "Service Unavailable", "content": { "*/*": { "schema": { @@ -1928,7 +1928,8 @@ "type": "object", "properties": { "detail": { - "type": "string" + "type": "string", + "description": "Detail of validation error." } }, "description": "List of validation errors." @@ -2095,7 +2096,7 @@ "type": "string", "description": ".tfstate file contents returned as string." }, - "importantFileContentMap": { + "generatedFileContentMap": { "type": "object", "additionalProperties": { "type": "string", diff --git a/modules/deployment/src/main/resources/tofu-maker-openapi.json b/modules/deployment/src/main/resources/tofu-maker-openapi.json index fdfab86d7..ab4ac4e3a 100644 --- a/modules/deployment/src/main/resources/tofu-maker-openapi.json +++ b/modules/deployment/src/main/resources/tofu-maker-openapi.json @@ -3,7 +3,7 @@ "info": { "title": "Tofu-Maker API", "description": "RESTful Services to interact with Tofu-Maker runtime", - "version": "1.0.7-SNAPSHOT" + "version": "1.0.9-SNAPSHOT" }, "servers": [ { @@ -55,8 +55,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -65,8 +65,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -126,8 +126,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -136,8 +136,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -197,8 +197,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -207,8 +207,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -268,8 +268,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -278,8 +278,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -332,8 +332,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -342,8 +342,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -403,8 +403,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -413,8 +413,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -474,8 +474,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -484,8 +484,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -538,8 +538,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -548,8 +548,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -609,8 +609,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -619,8 +619,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -680,8 +680,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -690,8 +690,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -751,8 +751,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -761,8 +761,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -815,8 +815,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -825,8 +825,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -886,8 +886,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -896,8 +896,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -957,8 +957,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -967,8 +967,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1032,8 +1032,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1042,8 +1042,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1114,8 +1114,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1124,8 +1124,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1196,8 +1196,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1206,8 +1206,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1271,8 +1271,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1281,8 +1281,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1353,8 +1353,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1363,8 +1363,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1407,8 +1407,8 @@ "description": "Check health of OpenTofu Maker API service", "operationId": "healthCheck", "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1417,8 +1417,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1489,8 +1489,8 @@ } ], "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1499,8 +1499,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1560,8 +1560,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1570,8 +1570,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1624,8 +1624,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1634,8 +1634,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1699,8 +1699,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1709,8 +1709,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1781,8 +1781,8 @@ "required": true }, "responses": { - "422": { - "description": "Unprocessable Entity", + "400": { + "description": "Bad Request", "content": { "*/*": { "schema": { @@ -1791,8 +1791,8 @@ } } }, - "400": { - "description": "Bad Request", + "422": { + "description": "Unprocessable Entity", "content": { "*/*": { "schema": { @@ -1919,7 +1919,8 @@ "type": "object", "properties": { "detail": { - "type": "string" + "type": "string", + "description": "Detail of validation error." } }, "description": "List of validation errors." @@ -2081,7 +2082,7 @@ "type": "string", "description": ".tfstate file contents returned as string." }, - "importantFileContentMap": { + "generatedFileContentMap": { "type": "object", "additionalProperties": { "type": "string", diff --git a/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalDeploymentTest.java b/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalDeploymentTest.java index 29ae9323c..cffe8f7ec 100644 --- a/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalDeploymentTest.java +++ b/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalDeploymentTest.java @@ -7,7 +7,7 @@ package org.eclipse.xpanse.modules.deployment.deployers.opentofu.opentofulocal; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.TerraformLocalDeployment.STATE_FILE_NAME; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_STATE_FILE_NAME; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; @@ -32,7 +32,8 @@ import org.eclipse.xpanse.modules.deployment.deployers.opentofu.opentofulocal.config.OpenTofuLocalConfig; import org.eclipse.xpanse.modules.deployment.deployers.opentofu.utils.TfResourceTransUtils; import org.eclipse.xpanse.modules.deployment.utils.DeployEnvironments; -import org.eclipse.xpanse.modules.deployment.utils.DeployResultFileUtils; +import org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper; +import org.eclipse.xpanse.modules.deployment.utils.ScriptsGitRepoManage; import org.eclipse.xpanse.modules.models.service.deploy.DeployRequest; import org.eclipse.xpanse.modules.models.service.order.enums.ServiceOrderType; import org.eclipse.xpanse.modules.models.servicetemplate.Ocl; @@ -54,6 +55,7 @@ import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.io.ClassPathResource; +import org.springframework.test.util.ReflectionTestUtils; /** * Test for OpenTofuDeployment. @@ -67,22 +69,24 @@ class OpenTofuLocalDeploymentTest { resource "random_id" "new" { byte_length = 4 } - + output "random_id" { value = resource.random_id_2.new.id } """; @InjectMocks OpenTofuLocalDeployment openTofuLocalDeployment; + @InjectMocks + DeploymentScriptsHelper scriptsHelper; @Mock OpenTofuInstaller openTofuInstaller; - @Mock - DeployResultFileUtils deployResultFileUtils; + @InjectMocks + ScriptsGitRepoManage scriptsGitRepoManage; + @InjectMocks + OpenTofuLocalConfig openTofuLocalConfig; @Mock DeployEnvironments deployEnvironments; @Mock - OpenTofuLocalConfig openTofuLocalConfig; - @Mock PluginManager pluginManager; @Mock DeployService deployService; @@ -97,6 +101,15 @@ class OpenTofuLocalDeploymentTest { @BeforeEach void setUp() throws Exception { + ReflectionTestUtils.setField(openTofuLocalConfig, "workspaceDirectory", "ws-test"); + ReflectionTestUtils.setField(scriptsHelper, "awaitAtMost", 60); + ReflectionTestUtils.setField(scriptsHelper, "awaitPollingInterval", 1); + ReflectionTestUtils.setField(scriptsHelper, "scriptsGitRepoManage", + scriptsGitRepoManage); + ReflectionTestUtils.setField(openTofuLocalDeployment, "openTofuLocalConfig", + openTofuLocalConfig); + ReflectionTestUtils.setField(openTofuLocalDeployment, "scriptsHelper", + scriptsHelper); OclLoader oclLoader = new OclLoader(); ocl = oclLoader.getOcl( URI.create("file:src/test/resources/ocl_terraform_test.yml").toURL()); @@ -150,11 +163,11 @@ DeployRequest getDeployRequest(Ocl ocl) { String getFileContent() { String content = ""; try { - ClassPathResource classPathResource = new ClassPathResource(STATE_FILE_NAME); + ClassPathResource classPathResource = new ClassPathResource(TF_STATE_FILE_NAME); InputStream inputStream = classPathResource.getInputStream(); content = IOUtils.toString(inputStream, StandardCharsets.UTF_8); } catch (IOException e) { - log.error("Failed to read file: {}", STATE_FILE_NAME, e); + log.error("Failed to read file: {}", TF_STATE_FILE_NAME, e); } return content; } @@ -164,7 +177,7 @@ void testDeploy() { when(openTofuInstaller.getExecutorPathThatMatchesRequiredVersion(any())).thenReturn("tofu"); DeployTask deployTask = getDeployTask(ocl, ServiceOrderType.DEPLOY); DeployResult deployResult = openTofuLocalDeployment.deploy(deployTask); - String tfState = deployResult.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + String tfState = deployResult.getTfStateContent(); assertNotNull(deployResult); assertNotNull(deployResult.getDeploymentGeneratedFiles()); Assertions.assertNull(tfState); @@ -174,7 +187,7 @@ void testDeploy() { DeployResult deployResult1 = openTofuLocalDeployment.deploy(deployTask1); assertNotNull(deployResult1); assertNotNull(deployResult1.getDeploymentGeneratedFiles()); - String tfState1 = deployResult1.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + String tfState1 = deployResult1.getDeploymentGeneratedFiles().get(TF_STATE_FILE_NAME); Assertions.assertNull(tfState1); } catch (Exception e) { log.error("testDeploy throw unexpected exception.", e); @@ -188,7 +201,7 @@ void testModify() { DeployTask deployTask = getDeployTask(ocl, ServiceOrderType.MODIFY); String tfState = getFileContent(); ServiceDeploymentEntity serviceDeploymentEntity = new ServiceDeploymentEntity(); - serviceDeploymentEntity.setDeploymentGeneratedFiles(Map.of(STATE_FILE_NAME, tfState)); + serviceDeploymentEntity.setDeploymentGeneratedFiles(Map.of(TF_STATE_FILE_NAME, tfState)); when(serviceDeploymentEntityHandler.getServiceDeploymentEntity(any())).thenReturn( serviceDeploymentEntity); DeployResult deployResult = openTofuLocalDeployment.modify(deployTask); @@ -201,7 +214,7 @@ void testModify() { openTofuLocalDeployment.modify(deployTask1); assertNotNull(deployResult1); assertNotNull(deployResult1.getDeploymentGeneratedFiles()); - String tfState1 = deployResult1.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + String tfState1 = deployResult1.getTfStateContent(); Assertions.assertNull(tfState1); } catch (Exception e) { log.error("testDeploy throw unexpected exception.", e); @@ -214,7 +227,7 @@ void testDestroy() { when(openTofuInstaller.getExecutorPathThatMatchesRequiredVersion(any())).thenReturn("tofu"); String tfState = getFileContent(); ServiceDeploymentEntity serviceDeploymentEntity = new ServiceDeploymentEntity(); - serviceDeploymentEntity.setDeploymentGeneratedFiles(Map.of(STATE_FILE_NAME, tfState)); + serviceDeploymentEntity.setDeploymentGeneratedFiles(Map.of(TF_STATE_FILE_NAME, tfState)); when(serviceDeploymentEntityHandler.getServiceDeploymentEntity(any())).thenReturn( serviceDeploymentEntity); @@ -252,7 +265,8 @@ void testModify_FailedCausedByOpenTofuExecutorException() { .thenReturn("Test"); String tfState = getFileContent(); ServiceDeploymentEntity serviceDeploymentEntity = new ServiceDeploymentEntity(); - serviceDeploymentEntity.setDeploymentGeneratedFiles(Map.of(STATE_FILE_NAME, tfState)); + serviceDeploymentEntity.setDeploymentGeneratedFiles(Map.of(TF_STATE_FILE_NAME, + tfState)); when(serviceDeploymentEntityHandler.getServiceDeploymentEntity(any())).thenReturn( serviceDeploymentEntity); ocl.getDeployment().setDeployer(errorDeployer); @@ -284,7 +298,6 @@ void testGetDeployerKind() { @Test void testGetDeployPlanAsJson() { - when(openTofuLocalConfig.getWorkspaceDirectory()).thenReturn("ws-test"); when(openTofuInstaller.getExecutorPathThatMatchesRequiredVersion(any())).thenReturn("tofu"); DeployTask deployTask = getDeployTask(ocl, ServiceOrderType.DEPLOY); String deployPlanJson = openTofuLocalDeployment.getDeploymentPlanAsJson(deployTask); diff --git a/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalExecutorTest.java b/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalExecutorTest.java index 947ad0aa1..3ab861c33 100644 --- a/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalExecutorTest.java +++ b/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/opentofu/opentofulocal/OpenTofuLocalExecutorTest.java @@ -1,6 +1,6 @@ package org.eclipse.xpanse.modules.deployment.deployers.opentofu.opentofulocal; -import static org.eclipse.xpanse.modules.deployment.deployers.opentofu.opentofulocal.OpenTofuLocalDeployment.SCRIPT_FILE_NAME; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_SCRIPT_FILE_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -15,9 +15,8 @@ import java.util.UUID; import org.eclipse.xpanse.common.systemcmd.SystemCmdResult; import org.eclipse.xpanse.modules.deployment.deployers.opentofu.resources.TfState; -import org.eclipse.xpanse.modules.deployment.utils.DeployResultFileUtils; +import org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper; import org.eclipse.xpanse.modules.models.servicetemplate.Ocl; -import org.eclipse.xpanse.modules.models.servicetemplate.enums.DeployerKind; import org.eclipse.xpanse.modules.models.servicetemplate.utils.OclLoader; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; @@ -26,32 +25,37 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.test.util.ReflectionTestUtils; @ExtendWith(MockitoExtension.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) class OpenTofuLocalExecutorTest { - private static final String workspace = - System.getProperty("java.io.tmpdir") + "/opentofu_workspace/" + UUID.randomUUID(); + private static String workspace = ""; @Mock private Map mockEnv; @Mock private Map mockVariables; - private OpenTofuLocalExecutor openTofuLocalExecutorUnderTest; - @Mock - private DeployResultFileUtils deployResultFileUtilsTest; + @InjectMocks + private OpenTofuLocalExecutor openTofuLocalExecutor; + @InjectMocks + private DeploymentScriptsHelper deploymentScriptsHelper; @BeforeAll - static void initWorkSpace() throws Exception { + static void initTaskWorkspace() throws Exception { + File baseWorkspace = new File(System.getProperty("java.io.tmpdir"), "ws-test"); + File taskWorkspace = new File(baseWorkspace, UUID.randomUUID().toString()); + if (!taskWorkspace.exists() && !taskWorkspace.mkdirs()) { + return; + } + workspace = taskWorkspace.getAbsolutePath(); OclLoader oclLoader = new OclLoader(); Ocl ocl = oclLoader.getOcl( URI.create("file:src/test/resources/ocl_terraform_test.yml").toURL()); - ocl.getDeployment().getDeployerTool().setKind(DeployerKind.OPEN_TOFU); String script = ocl.getDeployment().getDeployer(); - File ws = new File(workspace + "/" + UUID.randomUUID()); - ws.mkdirs(); - String scriptPath = workspace + File.separator + SCRIPT_FILE_NAME; + String scriptPath = workspace + File.separator + TF_SCRIPT_FILE_NAME; try (FileWriter scriptWriter = new FileWriter(scriptPath)) { scriptWriter.write(script); } @@ -59,15 +63,17 @@ static void initWorkSpace() throws Exception { @BeforeEach void setUp() { - openTofuLocalExecutorUnderTest = new OpenTofuLocalExecutor( - "tofu", mockEnv, mockVariables, workspace, null, deployResultFileUtilsTest); + ReflectionTestUtils.setField(deploymentScriptsHelper, "awaitAtMost", 60); + ReflectionTestUtils.setField(deploymentScriptsHelper, "awaitPollingInterval", 1); + openTofuLocalExecutor = + new OpenTofuLocalExecutor("tofu", mockEnv, mockVariables, workspace); } @Test @Order(1) void testTfInit() { // Run the test - final SystemCmdResult result = openTofuLocalExecutorUnderTest.tfInit(); + final SystemCmdResult result = openTofuLocalExecutor.tfInit(); // Verify the results assertTrue(result.isCommandSuccessful()); assertEquals(result.getCommandStdError(), ""); @@ -77,14 +83,14 @@ void testTfInit() { @Test @Order(2) void testGetOpenTofuPlanAsJson() { - assertNotNull(openTofuLocalExecutorUnderTest.getOpenTofuPlanAsJson()); + assertNotNull(openTofuLocalExecutor.getOpenTofuPlanAsJson()); } @Test @Order(3) void testTfPlan() { // Run the test - final SystemCmdResult result = openTofuLocalExecutorUnderTest.tfPlan(); + final SystemCmdResult result = openTofuLocalExecutor.tfPlan(); // Verify the results assertTrue(result.isCommandSuccessful()); assertEquals(result.getCommandStdError(), ""); @@ -97,7 +103,7 @@ void testTfPlan() { void testTfPlanWithOutput() { // Setup // Run the test - final SystemCmdResult result = openTofuLocalExecutorUnderTest.tfPlanWithOutput(); + final SystemCmdResult result = openTofuLocalExecutor.tfPlanWithOutput(); // Verify the results assertTrue(result.isCommandSuccessful()); assertEquals(result.getCommandStdError(), ""); @@ -109,7 +115,7 @@ void testTfPlanWithOutput() { @Order(5) void testTfApply() { // Run the test - final SystemCmdResult result = openTofuLocalExecutorUnderTest.tfApply(); + final SystemCmdResult result = openTofuLocalExecutor.tfApply(); // Verify the results assertTrue(result.isCommandSuccessful()); assertEquals(result.getCommandStdError(), ""); @@ -121,7 +127,7 @@ void testTfApply() { @Order(6) void testTfDestroy() { // Run the test - final SystemCmdResult result = openTofuLocalExecutorUnderTest.tfDestroy(); + final SystemCmdResult result = openTofuLocalExecutor.tfDestroy(); // Verify the results assertTrue(result.isCommandSuccessful()); assertEquals(result.getCommandStdError(), ""); @@ -135,10 +141,11 @@ void testTfDestroy() { void testDeploy() throws JsonProcessingException { // Setup // Run the test - openTofuLocalExecutorUnderTest.deploy(); + openTofuLocalExecutor.deploy(); // Verify the results TfState tfState = - new ObjectMapper().readValue(openTofuLocalExecutorUnderTest.getTerraformState(), + new ObjectMapper().readValue( + deploymentScriptsHelper.getTaskTerraformState(workspace), TfState.class); assertFalse(tfState.getOutputs().isEmpty()); } @@ -148,23 +155,14 @@ void testDeploy() throws JsonProcessingException { void testDestroy() throws JsonProcessingException { // Setup // Run the test - openTofuLocalExecutorUnderTest.destroy(); + openTofuLocalExecutor.destroy(); // Verify the results TfState tfState = - new ObjectMapper().readValue(openTofuLocalExecutorUnderTest.getTerraformState(), + new ObjectMapper().readValue( + deploymentScriptsHelper.getTaskTerraformState(workspace), TfState.class); assertTrue(tfState.getOutputs().isEmpty()); } - @Test - @Order(9) - void testGetImportantFilesContent() { - // Setup - // Run the test - final Map result = - openTofuLocalExecutorUnderTest.getImportantFilesContent(); - // Verify the results - assertTrue(result.containsKey("terraform.tfstate.backup")); - } } diff --git a/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalDeploymentTest.java b/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalDeploymentTest.java index 5f90b5f3c..44af80f0a 100644 --- a/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalDeploymentTest.java +++ b/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalDeploymentTest.java @@ -7,7 +7,7 @@ package org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.TerraformLocalDeployment.STATE_FILE_NAME; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_STATE_FILE_NAME; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; @@ -30,7 +30,8 @@ import org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.config.TerraformLocalConfig; import org.eclipse.xpanse.modules.deployment.deployers.terraform.utils.TfResourceTransUtils; import org.eclipse.xpanse.modules.deployment.utils.DeployEnvironments; -import org.eclipse.xpanse.modules.deployment.utils.DeployResultFileUtils; +import org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper; +import org.eclipse.xpanse.modules.deployment.utils.ScriptsGitRepoManage; import org.eclipse.xpanse.modules.models.service.deploy.DeployRequest; import org.eclipse.xpanse.modules.models.service.order.enums.ServiceOrderType; import org.eclipse.xpanse.modules.models.servicetemplate.Ocl; @@ -52,6 +53,7 @@ import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.io.ClassPathResource; +import org.springframework.test.util.ReflectionTestUtils; /** * Test for TerraformDeployment. @@ -65,20 +67,22 @@ class TerraformLocalDeploymentTest { resource "random_id" "new" { byte_length = 4 } - + output "random_id" { value = resource.random_id_2.new.id } """; @InjectMocks TerraformLocalDeployment terraformLocalDeployment; - @Mock - DeployResultFileUtils deployResultFileUtils; + @InjectMocks + DeploymentScriptsHelper scriptsHelper; + @InjectMocks + TerraformLocalConfig terraformLocalConfig; + @InjectMocks + ScriptsGitRepoManage scriptsGitRepoManage; @Mock DeployEnvironments deployEnvironments; @Mock - TerraformLocalConfig terraformLocalConfig; - @Mock PluginManager pluginManager; @Mock DeployService deployService; @@ -94,6 +98,15 @@ class TerraformLocalDeploymentTest { @BeforeEach void setUp() throws Exception { + ReflectionTestUtils.setField(terraformLocalConfig, "workspaceDirectory", "ws-test"); + ReflectionTestUtils.setField(scriptsHelper, "awaitAtMost", 60); + ReflectionTestUtils.setField(scriptsHelper, "awaitPollingInterval", 1); + ReflectionTestUtils.setField(scriptsHelper, "scriptsGitRepoManage", + scriptsGitRepoManage); + ReflectionTestUtils.setField(terraformLocalDeployment, "terraformLocalConfig", + terraformLocalConfig); + ReflectionTestUtils.setField(terraformLocalDeployment, "scriptsHelper", + scriptsHelper); OclLoader oclLoader = new OclLoader(); ocl = oclLoader.getOcl( URI.create("file:src/test/resources/ocl_terraform_test.yml").toURL()); @@ -144,12 +157,11 @@ DeployRequest getDeployRequest(Ocl ocl) { String getFileContent() { String content = ""; try { - ClassPathResource classPathResource = new ClassPathResource( - TerraformLocalDeployment.STATE_FILE_NAME); + ClassPathResource classPathResource = new ClassPathResource(TF_STATE_FILE_NAME); InputStream inputStream = classPathResource.getInputStream(); content = IOUtils.toString(inputStream, StandardCharsets.UTF_8); } catch (IOException e) { - log.error("Failed to read file: {}", TerraformLocalDeployment.STATE_FILE_NAME, e); + log.error("Failed to read file: {}", TF_STATE_FILE_NAME, e); } return content; } @@ -159,7 +171,7 @@ void testDeploy() { DeployTask deployTask = getDeployTask(ocl, ServiceOrderType.DEPLOY); DeployResult deployResult = terraformLocalDeployment.deploy(deployTask); - String tfState = deployResult.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + String tfState = deployResult.getTfStateContent(); Assertions.assertNotNull(deployResult); Assertions.assertNotNull(deployResult.getDeploymentGeneratedFiles()); Assertions.assertNull(tfState); @@ -169,7 +181,7 @@ void testDeploy() { DeployResult deployResult1 = terraformLocalDeployment.deploy(deployTask1); Assertions.assertNotNull(deployResult1); Assertions.assertNotNull(deployResult1.getDeploymentGeneratedFiles()); - String tfState1 = deployResult1.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + String tfState1 = deployResult1.getTfStateContent(); Assertions.assertNull(tfState1); } catch (Exception e) { log.error("testDeploy throw unexpected exception.", e); @@ -181,7 +193,7 @@ void testDeploy() { void testModify() { String tfState = getFileContent(); ServiceDeploymentEntity serviceDeploymentEntity = new ServiceDeploymentEntity(); - serviceDeploymentEntity.setDeploymentGeneratedFiles(Map.of(STATE_FILE_NAME, tfState)); + serviceDeploymentEntity.setDeploymentGeneratedFiles(Map.of(TF_STATE_FILE_NAME, tfState)); when(serviceDeploymentEntityHandler.getServiceDeploymentEntity(any())).thenReturn( serviceDeploymentEntity); @@ -195,7 +207,7 @@ void testModify() { DeployResult deployResult1 = terraformLocalDeployment.deploy(deployTask1); Assertions.assertNotNull(deployResult1); Assertions.assertNotNull(deployResult1.getDeploymentGeneratedFiles()); - String tfState1 = deployResult1.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + String tfState1 = deployResult1.getTfStateContent(); Assertions.assertNull(tfState1); } catch (Exception e) { log.error("testDeploy throw unexpected exception.", e); @@ -207,7 +219,7 @@ void testModify() { void testDestroy() { String tfState = getFileContent(); ServiceDeploymentEntity serviceDeploymentEntity = new ServiceDeploymentEntity(); - serviceDeploymentEntity.setDeploymentGeneratedFiles(Map.of(STATE_FILE_NAME, tfState)); + serviceDeploymentEntity.setDeploymentGeneratedFiles(Map.of(TF_STATE_FILE_NAME, tfState)); when(serviceDeploymentEntityHandler.getServiceDeploymentEntity(any())).thenReturn( serviceDeploymentEntity); diff --git a/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalExecutorTest.java b/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalExecutorTest.java index 9bd3c9a97..a1ce6da2a 100644 --- a/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalExecutorTest.java +++ b/modules/deployment/src/test/java/org/eclipse/xpanse/modules/deployment/deployers/terraform/terraformlocal/TerraformLocalExecutorTest.java @@ -6,7 +6,7 @@ package org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.TerraformLocalDeployment.SCRIPT_FILE_NAME; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_SCRIPT_FILE_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -17,16 +17,12 @@ import java.io.File; import java.io.FileWriter; import java.net.URI; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Collections; -import java.util.Comparator; import java.util.Map; import java.util.UUID; import org.eclipse.xpanse.common.systemcmd.SystemCmdResult; import org.eclipse.xpanse.modules.deployment.deployers.terraform.resources.TfState; -import org.eclipse.xpanse.modules.deployment.utils.DeployResultFileUtils; +import org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper; import org.eclipse.xpanse.modules.models.servicetemplate.Ocl; import org.eclipse.xpanse.modules.models.servicetemplate.utils.OclLoader; import org.eclipse.xpanse.modules.orchestrator.deployment.DeploymentScriptValidationResult; @@ -37,31 +33,38 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.test.util.ReflectionTestUtils; @ExtendWith(MockitoExtension.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) class TerraformLocalExecutorTest { - private static final String workspace = - System.getProperty("java.io.tmpdir") + "/terraform_workspace/" + UUID.randomUUID(); + + private static String workspace = ""; @Mock private Map mockEnv; @Mock private Map mockVariables; - private TerraformLocalExecutor terraformLocalExecutorUnderTest; - @Mock - private DeployResultFileUtils deployResultFileUtilsTest; + @InjectMocks + private TerraformLocalExecutor terraformLocalExecutor; + @InjectMocks + private DeploymentScriptsHelper scriptsHelper; @BeforeAll - static void initWorkSpace() throws Exception { + static void initTaskWorkspace() throws Exception { + File baseWorkspace = new File(System.getProperty("java.io.tmpdir"), "ws-test"); + File taskWorkspace = new File(baseWorkspace, UUID.randomUUID().toString()); + if (!taskWorkspace.exists() && !taskWorkspace.mkdirs()) { + return; + } + workspace = taskWorkspace.getAbsolutePath(); OclLoader oclLoader = new OclLoader(); Ocl ocl = oclLoader.getOcl( URI.create("file:src/test/resources/ocl_terraform_test.yml").toURL()); String script = ocl.getDeployment().getDeployer(); - File ws = new File(workspace); - ws.mkdirs(); - String scriptPath = workspace + File.separator + SCRIPT_FILE_NAME; + String scriptPath = workspace + File.separator + TF_SCRIPT_FILE_NAME; try (FileWriter scriptWriter = new FileWriter(scriptPath)) { scriptWriter.write(script); } @@ -69,8 +72,10 @@ static void initWorkSpace() throws Exception { @BeforeEach void setUp() { - terraformLocalExecutorUnderTest = new TerraformLocalExecutor("terraform", - mockEnv, mockVariables, workspace, null, deployResultFileUtilsTest); + ReflectionTestUtils.setField(scriptsHelper, "awaitAtMost", 60); + ReflectionTestUtils.setField(scriptsHelper, "awaitPollingInterval", 1); + terraformLocalExecutor = new TerraformLocalExecutor("terraform", + mockEnv, mockVariables, workspace); } @Test @@ -83,7 +88,7 @@ void testTfValidate() { expectedResult.setDiagnostics(Collections.emptyList()); // Run the test final DeploymentScriptValidationResult result = - terraformLocalExecutorUnderTest.tfValidate(); + terraformLocalExecutor.tfValidate(); // Verify the results assertThat(result).isEqualTo(expectedResult); } @@ -93,7 +98,7 @@ void testTfValidate() { @Order(2) void testTfInit() { // Run the test - final SystemCmdResult result = terraformLocalExecutorUnderTest.tfInit(); + final SystemCmdResult result = terraformLocalExecutor.tfInit(); // Verify the results assertTrue(result.isCommandSuccessful()); assertEquals(result.getCommandStdError(), ""); @@ -103,14 +108,14 @@ void testTfInit() { @Test @Order(3) void testGetTerraformPlanAsJson() { - assertNotNull(terraformLocalExecutorUnderTest.getTerraformPlanAsJson()); + assertNotNull(terraformLocalExecutor.getTerraformPlanAsJson()); } @Test @Order(4) void testTfPlan() { // Run the test - final SystemCmdResult result = terraformLocalExecutorUnderTest.tfPlan(); + final SystemCmdResult result = terraformLocalExecutor.tfPlan(); // Verify the results assertTrue(result.isCommandSuccessful()); assertEquals(result.getCommandStdError(), ""); @@ -123,7 +128,7 @@ void testTfPlan() { void testTfPlanWithOutput() { // Setup // Run the test - final SystemCmdResult result = terraformLocalExecutorUnderTest.tfPlanWithOutput(); + final SystemCmdResult result = terraformLocalExecutor.tfPlanWithOutput(); // Verify the results assertTrue(result.isCommandSuccessful()); assertEquals(result.getCommandStdError(), ""); @@ -135,7 +140,7 @@ void testTfPlanWithOutput() { @Order(6) void testTfApply() { // Run the test - final SystemCmdResult result = terraformLocalExecutorUnderTest.tfApply(); + final SystemCmdResult result = terraformLocalExecutor.tfApply(); // Verify the results assertTrue(result.isCommandSuccessful()); assertEquals(result.getCommandStdError(), ""); @@ -147,7 +152,7 @@ void testTfApply() { @Order(7) void testTfDestroy() { // Run the test - final SystemCmdResult result = terraformLocalExecutorUnderTest.tfDestroy(); + final SystemCmdResult result = terraformLocalExecutor.tfDestroy(); // Verify the results assertTrue(result.isCommandSuccessful()); assertEquals(result.getCommandStdError(), ""); @@ -161,10 +166,10 @@ void testTfDestroy() { void testDeploy() throws JsonProcessingException { // Setup // Run the test - terraformLocalExecutorUnderTest.deploy(); + terraformLocalExecutor.deploy(); // Verify the results TfState tfState = - new ObjectMapper().readValue(terraformLocalExecutorUnderTest.getTerraformState(), + new ObjectMapper().readValue(scriptsHelper.getTaskTerraformState(workspace), TfState.class); assertFalse(tfState.getOutputs().isEmpty()); } @@ -174,30 +179,11 @@ void testDeploy() throws JsonProcessingException { void testDestroy() throws JsonProcessingException { // Setup // Run the test - terraformLocalExecutorUnderTest.destroy(); + terraformLocalExecutor.destroy(); // Verify the results TfState tfState = - new ObjectMapper().readValue(terraformLocalExecutorUnderTest.getTerraformState(), + new ObjectMapper().readValue(scriptsHelper.getTaskTerraformState(workspace), TfState.class); assertTrue(tfState.getOutputs().isEmpty()); } - - @Test - @Order(10) - void testGetImportantFilesContent() throws Exception { - // Setup - // Run the test - final Map result = - terraformLocalExecutorUnderTest.getImportantFilesContent(); - // Verify the results - assertTrue(result.containsKey("terraform.tfstate.backup")); - - deleteWorkspace(); - } - - void deleteWorkspace() throws Exception { - Path path = Paths.get(workspace); - Files.walk(path).sorted(Comparator.reverseOrder()).map(Path::toFile) - .forEach(File::delete); - } } diff --git a/modules/models/src/main/java/org/eclipse/xpanse/modules/models/response/ResultType.java b/modules/models/src/main/java/org/eclipse/xpanse/modules/models/response/ResultType.java index 8ec69ac81..56ee9cde4 100644 --- a/modules/models/src/main/java/org/eclipse/xpanse/modules/models/response/ResultType.java +++ b/modules/models/src/main/java/org/eclipse/xpanse/modules/models/response/ResultType.java @@ -77,7 +77,8 @@ public enum ResultType { INVALID_SERVICE_CONFIGURATION("Service Configuration Invalid"), SERVICE_CONFIG_UPDATE_REQUEST_NOT_FOUND("Service Configuration Update Request Not Found"), SERVICE_CONFIGURATION_NOT_FOUND("Service Configuration Not Found"), - INVALID_DEPLOYER_TOOL("Invalid Deployer Tool"); + INVALID_DEPLOYER_TOOL("Invalid Deployer Tool"), + DEPLOYMENT_SCRIPTS_CREATION_FAILED("Deployment Scripts Creation Failed"); private final String value; diff --git a/modules/models/src/test/java/org/eclipse/xpanse/modules/models/common/exceptions/VariableValidationFailedExceptionTest.java b/modules/models/src/test/java/org/eclipse/xpanse/modules/models/common/exceptions/VariableValidationFailedExceptionTest.java index e399d795f..df27653d6 100644 --- a/modules/models/src/test/java/org/eclipse/xpanse/modules/models/common/exceptions/VariableValidationFailedExceptionTest.java +++ b/modules/models/src/test/java/org/eclipse/xpanse/modules/models/common/exceptions/VariableValidationFailedExceptionTest.java @@ -46,7 +46,6 @@ public void testConstructorAndGetErrorReasons() { @Test void testEqualsAndHashCode() { - assertEquals(exception, exception); assertEquals(exception.hashCode(), exception.hashCode()); Object obj = new Object(); @@ -54,17 +53,20 @@ void testEqualsAndHashCode() { assertNotEquals(exception, null); assertNotEquals(exception.hashCode(), obj.hashCode()); - VariableValidationFailedException exception1 = new VariableValidationFailedException(errorReasons1); + VariableValidationFailedException exception1 = + new VariableValidationFailedException(errorReasons1); assertNotEquals(exception, exception1); assertNotEquals(exception.hashCode(), exception1.hashCode()); - VariableValidationFailedException exception2 = new VariableValidationFailedException(errorReasons); + VariableValidationFailedException exception2 = + new VariableValidationFailedException(errorReasons); assertNotEquals(exception, exception2); assertNotEquals(exception2, exception1); assertNotEquals(exception.hashCode(), exception2.hashCode()); assertNotEquals(exception2.hashCode(), exception1.hashCode()); - VariableValidationFailedException exception3 = new VariableValidationFailedException(errorReasons2); + VariableValidationFailedException exception3 = + new VariableValidationFailedException(errorReasons2); assertNotEquals(exception, exception3); assertNotEquals(exception3, exception2); assertNotEquals(exception3, exception1); @@ -75,7 +77,8 @@ void testEqualsAndHashCode() { @Test void testToString() { - String expectedToString = "VariableValidationFailedException(errorReasons=" + errorReasons + ")"; + String expectedToString = + "VariableValidationFailedException(errorReasons=" + errorReasons + ")"; assertEquals(expectedToString, exception.toString()); } diff --git a/modules/orchestrator/src/test/java/org/eclipse/xpanse/modules/orchestrator/deployment/DeployResultTest.java b/modules/orchestrator/src/test/java/org/eclipse/xpanse/modules/orchestrator/deployment/DeployResultTest.java index b8f451ab7..3698cb51f 100644 --- a/modules/orchestrator/src/test/java/org/eclipse/xpanse/modules/orchestrator/deployment/DeployResultTest.java +++ b/modules/orchestrator/src/test/java/org/eclipse/xpanse/modules/orchestrator/deployment/DeployResultTest.java @@ -27,7 +27,7 @@ class DeployResultTest { private final UUID orderId = UUID.fromString("f0dcb6ea-cbe7-4c88-9c94-a5d00e82a4f2"); private final boolean isSuccessful = true; private final Map outputProperties = Collections.singletonMap("key", "value"); - private final Map deploymentGeneratedFiles = + private final Map generatedFileContentMap = Collections.singletonMap("privateKey", "privateValue"); private final String message = "success"; private final String tfStateContent = "tfStateContent"; @@ -44,7 +44,7 @@ void setUp() { test.setIsTaskSuccessful(isSuccessful); test.setResources(resources); test.setOutputProperties(outputProperties); - test.setDeploymentGeneratedFiles(deploymentGeneratedFiles); + test.setDeploymentGeneratedFiles(generatedFileContentMap); test.setMessage(message); test.setTfStateContent(tfStateContent); test.setDeployerVersionUsed(deployerVersionUsed); @@ -57,7 +57,7 @@ void testGetters() { assertEquals(message, test.getMessage()); assertEquals(resources, test.getResources()); assertEquals(outputProperties, test.getOutputProperties()); - assertEquals(deploymentGeneratedFiles, test.getDeploymentGeneratedFiles()); + assertEquals(generatedFileContentMap, test.getDeploymentGeneratedFiles()); assertEquals(tfStateContent, test.getTfStateContent()); assertEquals(deployerVersionUsed, test.getDeployerVersionUsed()); } @@ -84,7 +84,7 @@ void testToString() { + ", message=" + message + ", resources=" + resources + ", outputProperties=" + outputProperties - + ", deploymentGeneratedFiles=" + deploymentGeneratedFiles + + ", deploymentGeneratedFiles=" + generatedFileContentMap + ", deployerVersionUsed=" + deployerVersionUsed + ", tfStateContent=" + tfStateContent + ")"; diff --git a/modules/servicetemplate/src/main/java/org/eclipse/xpanse/modules/servicetemplate/utils/ServiceConfigurationParameterValidator.java b/modules/servicetemplate/src/main/java/org/eclipse/xpanse/modules/servicetemplate/utils/ServiceConfigurationParameterValidator.java index 1e1d4365d..b391ab6b9 100644 --- a/modules/servicetemplate/src/main/java/org/eclipse/xpanse/modules/servicetemplate/utils/ServiceConfigurationParameterValidator.java +++ b/modules/servicetemplate/src/main/java/org/eclipse/xpanse/modules/servicetemplate/utils/ServiceConfigurationParameterValidator.java @@ -6,25 +6,21 @@ package org.eclipse.xpanse.modules.servicetemplate.utils; +import static org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper.TF_SCRIPT_FILE_EXTENSION; + import jakarta.annotation.Resource; import java.io.File; -import java.io.FileWriter; -import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.UUID; import lombok.extern.slf4j.Slf4j; -import org.eclipse.xpanse.modules.deployment.deployers.terraform.exceptions.TerraformExecutorException; -import org.eclipse.xpanse.modules.deployment.utils.ScriptsGitRepoManage; +import org.eclipse.xpanse.modules.deployment.utils.DeploymentScriptsHelper; import org.eclipse.xpanse.modules.models.serviceconfiguration.exceptions.ServiceConfigurationInvalidException; import org.eclipse.xpanse.modules.models.servicetemplate.Ocl; import org.eclipse.xpanse.modules.models.servicetemplate.ServiceConfigurationParameter; import org.eclipse.xpanse.modules.orchestrator.OrchestratorPlugin; import org.eclipse.xpanse.modules.orchestrator.PluginManager; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @@ -35,17 +31,11 @@ @Component public class ServiceConfigurationParameterValidator { - public static final String SCRIPT_FILE_NAME = "resources.tf"; public static final String CSP_SCRIPT_FILE_NAME = "provider.tf"; - @Resource private PluginManager pluginManager; - @Resource - private ScriptsGitRepoManage scriptsGitRepoManage; - - @Value("${terraform.workspace.directory}") - private String workspaceDirectory; + private DeploymentScriptsHelper deploymentScriptsHelper; /** * validate service configuration parameters. @@ -83,39 +73,16 @@ public void validateServiceConfigurationParameters(Ocl ocl) { } private List prepareDeployWorkspaceWithScripts(Ocl ocl) { - String workspace = getWorkspacePath(UUID.randomUUID()); - if (Objects.nonNull(ocl.getDeployment().getScriptsRepo())) { - File[] files = scriptsGitRepoManage - .checkoutScripts(workspace, ocl.getDeployment().getScriptsRepo()); - return Arrays.stream(files) - .filter(file -> file.getName().endsWith(".tf")) - .filter(file -> !CSP_SCRIPT_FILE_NAME.equals(file.getName())) - .toList(); - } else { - return List.of(createScriptFile(workspace, ocl.getDeployment().getDeployer())); - } + String taskWorkspace = deploymentScriptsHelper.createWorkspaceForTask( + getBaseWorkspace(), UUID.randomUUID()); + List files = deploymentScriptsHelper.prepareDeploymentScripts(taskWorkspace, + ocl.getDeployment(), null); + return files.stream() + .filter(file -> file.getName().endsWith(TF_SCRIPT_FILE_EXTENSION)) + .filter(file -> !CSP_SCRIPT_FILE_NAME.equals(file.getName())).toList(); } - private File createScriptFile(String workspace, String script) { - File ws = new File(workspace); - if (!ws.exists() && !ws.mkdirs()) { - throw new TerraformExecutorException( - "workspace creation failed, File path not created: " + ws.getAbsolutePath()); - } - String scriptPath = workspace + File.separator + SCRIPT_FILE_NAME; - try (FileWriter scriptWriter = new FileWriter(scriptPath)) { - scriptWriter.write(script); - log.info("Terraform script creation successful"); - return new File(scriptPath); - } catch (IOException ex) { - log.error("create version file failed.", ex); - throw new TerraformExecutorException("version file creation failed.", ex); - } - } - - - private String getWorkspacePath(UUID id) { - return System.getProperty("java.io.tmpdir") + File.separator - + workspaceDirectory + File.separator + id.toString(); + private String getBaseWorkspace() { + return "tf-workspace"; } } diff --git a/plugins/flexibleengine/src/main/java/org/eclipse/xpanse/plugins/flexibleengine/resourcehandler/FlexibleEngineTerraformResourceHandler.java b/plugins/flexibleengine/src/main/java/org/eclipse/xpanse/plugins/flexibleengine/resourcehandler/FlexibleEngineTerraformResourceHandler.java index 46db9286d..e474570a0 100644 --- a/plugins/flexibleengine/src/main/java/org/eclipse/xpanse/plugins/flexibleengine/resourcehandler/FlexibleEngineTerraformResourceHandler.java +++ b/plugins/flexibleengine/src/main/java/org/eclipse/xpanse/plugins/flexibleengine/resourcehandler/FlexibleEngineTerraformResourceHandler.java @@ -6,8 +6,6 @@ package org.eclipse.xpanse.plugins.flexibleengine.resourcehandler; -import static org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.TerraformLocalDeployment.STATE_FILE_NAME; - import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.ArrayList; @@ -46,7 +44,7 @@ public void handler(DeployResult deployResult) { List deployResourceList = new ArrayList<>(); TfState tfState; try { - var stateFile = deployResult.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + var stateFile = deployResult.getTfStateContent(); tfState = objectMapper.readValue(stateFile, TfState.class); } catch (IOException ex) { log.error("Parse terraform state content failed."); diff --git a/plugins/flexibleengine/src/test/java/org/eclipse/xpanse/plugins/flexibleengine/reourcehandler/FlexibleEngineTerraformResourceHandlerTest.java b/plugins/flexibleengine/src/test/java/org/eclipse/xpanse/plugins/flexibleengine/reourcehandler/FlexibleEngineTerraformResourceHandlerTest.java index 204fa7494..25e1b0796 100644 --- a/plugins/flexibleengine/src/test/java/org/eclipse/xpanse/plugins/flexibleengine/reourcehandler/FlexibleEngineTerraformResourceHandlerTest.java +++ b/plugins/flexibleengine/src/test/java/org/eclipse/xpanse/plugins/flexibleengine/reourcehandler/FlexibleEngineTerraformResourceHandlerTest.java @@ -1,7 +1,5 @@ package org.eclipse.xpanse.plugins.flexibleengine.reourcehandler; -import static org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.TerraformLocalDeployment.STATE_FILE_NAME; - import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.net.URI; @@ -24,8 +22,7 @@ void handler() throws IOException { TfState tfState = objectMapper.readValue( URI.create("file:src/test/resources/flexible-tfstate.json").toURL(), TfState.class); DeployResult deployResult = new DeployResult(); - deployResult.getDeploymentGeneratedFiles() - .put(STATE_FILE_NAME, objectMapper.writeValueAsString(tfState)); + deployResult.setTfStateContent(objectMapper.writeValueAsString(tfState)); flexibleHandler.handler(deployResult); Assertions.assertTrue(CollectionUtils.isNotEmpty(deployResult.getResources())); Assertions.assertFalse(deployResult.getOutputProperties().isEmpty()); @@ -38,8 +35,7 @@ void handler_destroy() throws IOException { URI.create("file:src/test/resources/flexible-tfstate-destroy.json").toURL(), TfState.class); DeployResult deployResult = new DeployResult(); - deployResult.getDeploymentGeneratedFiles().put(STATE_FILE_NAME, - objectMapper.writeValueAsString(tfState)); + deployResult.setTfStateContent(objectMapper.writeValueAsString(tfState)); flexibleHandler.handler(deployResult); Assertions.assertTrue(CollectionUtils.isEmpty(deployResult.getResources())); Assertions.assertTrue(deployResult.getOutputProperties().isEmpty()); diff --git a/plugins/huaweicloud/src/main/java/org/eclipse/xpanse/plugins/huaweicloud/resourcehandler/HuaweiCloudTerraformResourceHandler.java b/plugins/huaweicloud/src/main/java/org/eclipse/xpanse/plugins/huaweicloud/resourcehandler/HuaweiCloudTerraformResourceHandler.java index 2a6793b96..208996d04 100644 --- a/plugins/huaweicloud/src/main/java/org/eclipse/xpanse/plugins/huaweicloud/resourcehandler/HuaweiCloudTerraformResourceHandler.java +++ b/plugins/huaweicloud/src/main/java/org/eclipse/xpanse/plugins/huaweicloud/resourcehandler/HuaweiCloudTerraformResourceHandler.java @@ -6,7 +6,6 @@ package org.eclipse.xpanse.plugins.huaweicloud.resourcehandler; -import static org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.TerraformLocalDeployment.STATE_FILE_NAME; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; @@ -46,7 +45,7 @@ public void handler(DeployResult deployResult) { List deployResourceList = new ArrayList<>(); TfState tfState; try { - var stateFile = deployResult.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + var stateFile = deployResult.getTfStateContent(); tfState = objectMapper.readValue(stateFile, TfState.class); } catch (IOException ex) { log.error("Parse terraform state content failed."); diff --git a/plugins/huaweicloud/src/test/java/org/eclipse/xpanse/plugins/huaweicloud/resourcehandler/HuaweiCloudTerraformResourceHandlerTest.java b/plugins/huaweicloud/src/test/java/org/eclipse/xpanse/plugins/huaweicloud/resourcehandler/HuaweiCloudTerraformResourceHandlerTest.java index f168307fc..a9f97d846 100644 --- a/plugins/huaweicloud/src/test/java/org/eclipse/xpanse/plugins/huaweicloud/resourcehandler/HuaweiCloudTerraformResourceHandlerTest.java +++ b/plugins/huaweicloud/src/test/java/org/eclipse/xpanse/plugins/huaweicloud/resourcehandler/HuaweiCloudTerraformResourceHandlerTest.java @@ -1,7 +1,5 @@ package org.eclipse.xpanse.plugins.huaweicloud.resourcehandler; -import static org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.TerraformLocalDeployment.STATE_FILE_NAME; - import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.net.URI; @@ -23,8 +21,7 @@ void handler() throws IOException { TfState tfState = objectMapper.readValue( URI.create("file:src/test/resources/huawei-tfstate.json").toURL(), TfState.class); DeployResult deployResult = new DeployResult(); - deployResult.getDeploymentGeneratedFiles() - .put(STATE_FILE_NAME, objectMapper.writeValueAsString(tfState)); + deployResult.setTfStateContent(objectMapper.writeValueAsString(tfState)); huaweiHandler.handler(deployResult); Assertions.assertFalse(CollectionUtils.isEmpty(deployResult.getResources())); Assertions.assertFalse(deployResult.getOutputProperties().isEmpty()); @@ -37,8 +34,7 @@ void handler_destroy() throws IOException { URI.create("file:src/test/resources/huawei-tfstate-destroy.json").toURL(), TfState.class); DeployResult deployResult = new DeployResult(); - deployResult.getDeploymentGeneratedFiles() - .put(STATE_FILE_NAME, objectMapper.writeValueAsString(tfState)); + deployResult.setTfStateContent(objectMapper.writeValueAsString(tfState)); huaweiHandler.handler(deployResult); Assertions.assertTrue(CollectionUtils.isEmpty(deployResult.getResources())); Assertions.assertTrue(deployResult.getOutputProperties().isEmpty()); diff --git a/plugins/openstack-common/src/main/java/org/eclipse/xpanse/plugins/openstack/common/resourcehandler/OpenstackTerraformResourceHandler.java b/plugins/openstack-common/src/main/java/org/eclipse/xpanse/plugins/openstack/common/resourcehandler/OpenstackTerraformResourceHandler.java index 91fa8e505..b4a1c1882 100644 --- a/plugins/openstack-common/src/main/java/org/eclipse/xpanse/plugins/openstack/common/resourcehandler/OpenstackTerraformResourceHandler.java +++ b/plugins/openstack-common/src/main/java/org/eclipse/xpanse/plugins/openstack/common/resourcehandler/OpenstackTerraformResourceHandler.java @@ -6,8 +6,6 @@ package org.eclipse.xpanse.plugins.openstack.common.resourcehandler; -import static org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.TerraformLocalDeployment.STATE_FILE_NAME; - import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.ArrayList; @@ -46,7 +44,7 @@ public void handler(DeployResult deployResult) { List deployResourceList = new ArrayList<>(); TfState tfState; try { - var stateFile = deployResult.getDeploymentGeneratedFiles().get(STATE_FILE_NAME); + var stateFile = deployResult.getTfStateContent(); tfState = objectMapper.readValue(stateFile, TfState.class); } catch (IOException ex) { log.error("Parse terraform state content failed."); diff --git a/plugins/openstack-common/src/test/java/org/eclipse/xpanse/plugins/openstack/common/resourcehandler/OpenstackTerraformResourceHandlerTest.java b/plugins/openstack-common/src/test/java/org/eclipse/xpanse/plugins/openstack/common/resourcehandler/OpenstackTerraformResourceHandlerTest.java index 8ae9ab1db..70bc406e2 100644 --- a/plugins/openstack-common/src/test/java/org/eclipse/xpanse/plugins/openstack/common/resourcehandler/OpenstackTerraformResourceHandlerTest.java +++ b/plugins/openstack-common/src/test/java/org/eclipse/xpanse/plugins/openstack/common/resourcehandler/OpenstackTerraformResourceHandlerTest.java @@ -1,6 +1,5 @@ package org.eclipse.xpanse.plugins.openstack.common.resourcehandler; -import static org.eclipse.xpanse.modules.deployment.deployers.terraform.terraformlocal.TerraformLocalDeployment.STATE_FILE_NAME; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; @@ -24,8 +23,7 @@ void handler() throws IOException { URI.create("file:src/test/resources/openstack-tfstate.json").toURL(), TfState.class); DeployResult deployResult = new DeployResult(); - deployResult.getDeploymentGeneratedFiles() - .put(STATE_FILE_NAME, objectMapper.writeValueAsString(tfState)); + deployResult.setTfStateContent(objectMapper.writeValueAsString(tfState)); openstackHandler.handler(deployResult); Assertions.assertFalse(CollectionUtils.isEmpty(deployResult.getResources())); Assertions.assertFalse(deployResult.getOutputProperties().isEmpty()); @@ -38,8 +36,7 @@ void handler_destroy() throws IOException { URI.create("file:src/test/resources/openstack-tfstate-destroy.json").toURL(), TfState.class); DeployResult deployResult = new DeployResult(); - deployResult.getDeploymentGeneratedFiles() - .put(STATE_FILE_NAME, objectMapper.writeValueAsString(tfState)); + deployResult.setTfStateContent(objectMapper.writeValueAsString(tfState)); openstackHandler.handler(deployResult); Assertions.assertTrue(CollectionUtils.isEmpty(deployResult.getResources())); Assertions.assertTrue(deployResult.getOutputProperties().isEmpty()); diff --git a/runtime/src/test/resources/deploy_success_callback.json b/runtime/src/test/resources/deploy_success_callback.json index fd24e01f5..bc1cef85d 100644 --- a/runtime/src/test/resources/deploy_success_callback.json +++ b/runtime/src/test/resources/deploy_success_callback.json @@ -2,6 +2,6 @@ "commandStdError": "", "commandStdOutput": "Terraform used the selected providers to generate the following execution\r\nplan. Resource actions are indicated with the following symbols:\r\n + create\r\n\r\nTerraform will perform the following actions:\r\n\r\n # random_password.password will be created\r\n + resource \"random_password\" \"password\" {\r\n + bcrypt_hash = (sensitive value)\r\n + id = (known after apply)\r\n + length = 12\r\n + lower = true\r\n + min_lower = 0\r\n + min_numeric = 0\r\n + min_special = 1\r\n + min_upper = 0\r\n + number = true\r\n + numeric = true\r\n + override_special = \"#%@\"\r\n + result = (sensitive value)\r\n + special = true\r\n + upper = true\r\n }\r\n\r\nPlan: 1 to add, 0 to change, 0 to destroy.\r\n\r\nChanges to Outputs:\r\n + admin_passwd = (known after apply)\r\n + availability_zone = \"valid zone\"\r\n + flavor_id = \"s6.large.2\"\r\n + region = \"cn-southwest-2\"\r\n + region_name = \"cn-southwest-2\"\r\n + secgroup_name = \"secgroup-default\"\r\n + subnet_name = \"subnet-default\"\r\n + vpc_name = \"vpc-default\"\r\nrandom_password.password: Creating...\r\nrandom_password.password: Creation complete after 0s [id=none]\r\n\r\nApply complete! Resources: 1 added, 0 changed, 0 destroyed.\r\n\r\nOutputs:\r\n\r\nadmin_passwd = \"%PTfCbeAPsoM\"\r\navailability_zone = \"valid zone\"\r\nflavor_id = \"s6.large.2\"\r\nregion = \"cn-southwest-2\"\r\nregion_name = \"cn-southwest-2\"\r\nsecgroup_name = \"secgroup-default\"\r\nsubnet_name = \"subnet-default\"\r\nvpc_name = \"vpc-default\"", "commandSuccessful": true, - "importantFileContentMap":{}, + "generatedFileContentMap":{}, "terraformState": "{\n \"version\": 4,\n \"terraform_version\": \"1.6.5\",\n \"serial\": 2,\n \"lineage\": \"2f419fd9-cdb7-2411-c081-353207e09c8c\",\n \"outputs\": {\n \"admin_passwd\": {\n \"value\": \"%PTfCbeAPsoM\",\n \"type\": \"string\"\n },\n \"availability_zone\": {\n \"value\": \"valid zone\",\n \"type\": \"string\"\n },\n \"flavor_id\": {\n \"value\": \"s6.large.2\",\n \"type\": \"string\"\n },\n \"region\": {\n \"value\": \"cn-southwest-2\",\n \"type\": \"string\"\n },\n \"region_name\": {\n \"value\": \"cn-southwest-2\",\n \"type\": \"string\"\n },\n \"secgroup_name\": {\n \"value\": \"secgroup-default\",\n \"type\": \"string\"\n },\n \"subnet_name\": {\n \"value\": \"subnet-default\",\n \"type\": \"string\"\n },\n \"vpc_name\": {\n \"value\": \"vpc-default\",\n \"type\": \"string\"\n }\n },\n \"resources\": [\n {\n \"mode\": \"managed\",\n \"type\": \"random_password\",\n \"name\": \"password\",\n \"provider\": \"provider[\\\"registry.terraform.io/hashicorp/random\\\"]\",\n \"instances\": [\n {\n \"schema_version\": 3,\n \"attributes\": {\n \"bcrypt_hash\": \"$2a$10$Hz1vUyizSDok5pwBwlXUie33zsob.i0rA1WooTES0cnYRvBfiGhD.\",\n \"id\": \"none\",\n \"keepers\": null,\n \"length\": 12,\n \"lower\": true,\n \"min_lower\": 0,\n \"min_numeric\": 0,\n \"min_special\": 1,\n \"min_upper\": 0,\n \"number\": true,\n \"numeric\": true,\n \"override_special\": \"#%@\",\n \"result\": \"%PTfCbeAPsoM\",\n \"special\": true,\n \"upper\": true\n },\n \"sensitive_attributes\": []\n }\n ]\n }\n ],\n \"check_results\": null\n}\n" } \ No newline at end of file diff --git a/runtime/src/test/resources/destroy_success_callback.json b/runtime/src/test/resources/destroy_success_callback.json index 7a411f5b5..5924808ba 100644 --- a/runtime/src/test/resources/destroy_success_callback.json +++ b/runtime/src/test/resources/destroy_success_callback.json @@ -2,7 +2,7 @@ "commandStdError": "", "commandStdOutput": "random_password.password: Refreshing state... [id=none]\r\n\r\nTerraform used the selected providers to generate the following execution\r\nplan. Resource actions are indicated with the following symbols:\r\n - destroy\r\n\r\nTerraform will perform the following actions:\r\n\r\n # random_password.password will be destroyed\r\n - resource \"random_password\" \"password\" {\r\n - bcrypt_hash = (sensitive value) -> null\r\n - id = \"none\" -> null\r\n - length = 12 -> null\r\n - lower = true -> null\r\n - min_lower = 0 -> null\r\n - min_numeric = 0 -> null\r\n - min_special = 1 -> null\r\n - min_upper = 0 -> null\r\n - number = true -> null\r\n - numeric = true -> null\r\n - override_special = \"#%@\" -> null\r\n - result = (sensitive value) -> null\r\n - special = true -> null\r\n - upper = true -> null\r\n }\r\n\r\nPlan: 0 to add, 0 to change, 1 to destroy.\r\n\r\nChanges to Outputs:\r\n - admin_passwd = \"%PTfCbeAPsoM\" -> null\r\n - availability_zone = \"valid zone\" -> null\r\n - flavor_id = \"s6.large.2\" -> null\r\n - region = \"cn-southwest-2\" -> null\r\n - region_name = \"cn-southwest-2\" -> null\r\n - secgroup_name = \"secgroup-default\" -> null\r\n - subnet_name = \"subnet-default\" -> null\r\n - vpc_name = \"vpc-default\" -> null\r\nrandom_password.password: Destroying... [id=none]\r\nrandom_password.password: Destruction complete after 0s\r\n\r\nDestroy complete! Resources: 1 destroyed.", "commandSuccessful": true, - "importantFileContentMap": { + "generatedFileContentMap": { "terraform.tfstate.backup": "{\n \"version\": 4,\n \"terraform_version\": \"1.6.5\",\n \"serial\": 2,\n \"lineage\": \"2f419fd9-cdb7-2411-c081-353207e09c8c\",\n \"outputs\": {\n \"admin_passwd\": {\n \"value\": \"%PTfCbeAPsoM\",\n \"type\": \"string\"\n },\n \"availability_zone\": {\n \"value\": \"valid zone\",\n \"type\": \"string\"\n },\n \"flavor_id\": {\n \"value\": \"s6.large.2\",\n \"type\": \"string\"\n },\n \"region\": {\n \"value\": \"cn-southwest-2\",\n \"type\": \"string\"\n },\n \"region_name\": {\n \"value\": \"cn-southwest-2\",\n \"type\": \"string\"\n },\n \"secgroup_name\": {\n \"value\": \"secgroup-default\",\n \"type\": \"string\"\n },\n \"subnet_name\": {\n \"value\": \"subnet-default\",\n \"type\": \"string\"\n },\n \"vpc_name\": {\n \"value\": \"vpc-default\",\n \"type\": \"string\"\n }\n },\n \"resources\": [\n {\n \"mode\": \"managed\",\n \"type\": \"random_password\",\n \"name\": \"password\",\n \"provider\": \"provider[\\\"registry.terraform.io/hashicorp/random\\\"]\",\n \"instances\": [\n {\n \"schema_version\": 3,\n \"attributes\": {\n \"bcrypt_hash\": \"$2a$10$Hz1vUyizSDok5pwBwlXUie33zsob.i0rA1WooTES0cnYRvBfiGhD.\",\n \"id\": \"none\",\n \"keepers\": null,\n \"length\": 12,\n \"lower\": true,\n \"min_lower\": 0,\n \"min_numeric\": 0,\n \"min_special\": 1,\n \"min_upper\": 0,\n \"number\": true,\n \"numeric\": true,\n \"override_special\": \"#%@\",\n \"result\": \"%PTfCbeAPsoM\",\n \"special\": true,\n \"upper\": true\n },\n \"sensitive_attributes\": []\n }\n ]\n }\n ],\n \"check_results\": null\n}\n" }, "terraformState": "{\n \"version\": 4,\n \"terraform_version\": \"1.6.5\",\n \"serial\": 4,\n \"lineage\": \"2f419fd9-cdb7-2411-c081-353207e09c8c\",\n \"outputs\": {},\n \"resources\": [],\n \"check_results\": null\n}\n"