Skip to content

Commit c6413ec

Browse files
committed
remove DeploymentScenario field
1 parent e3afcd1 commit c6413ec

8 files changed

+11
-107
lines changed

src/main/java/org/eclipse/xpanse/tofu/maker/models/enums/DeploymentScenario.java

-50
This file was deleted.

src/main/java/org/eclipse/xpanse/tofu/maker/models/request/directory/OpenTofuDeployFromDirectoryRequest.java

-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import java.util.HashMap;
1111
import java.util.Map;
1212
import lombok.Data;
13-
import org.eclipse.xpanse.tofu.maker.models.enums.DeploymentScenario;
1413

1514
/**
1615
* Data model for the OpenTofu deploy requests.
@@ -23,12 +22,6 @@ public class OpenTofuDeployFromDirectoryRequest {
2322
+ "or it must also apply the changes.")
2423
Boolean isPlanOnly;
2524

26-
@Schema(description = "This value can be set by the client if they wish to know the type of"
27-
+ "request for which the callback response is generated from tofu-maker. There will be"
28-
+ "no difference in the way request is executed. This information is only set in the"
29-
+ "callback response again for the client to handle the callback response accordingly.")
30-
DeploymentScenario deploymentScenario;
31-
3225
@NotNull
3326
@Schema(description = "Key-value pairs of variables that must be used to execute the "
3427
+ "OpenTofu request.",

src/main/java/org/eclipse/xpanse/tofu/maker/models/request/directory/OpenTofuDestroyFromDirectoryRequest.java

+2-11
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,19 @@
1212
import java.util.HashMap;
1313
import java.util.Map;
1414
import lombok.Data;
15-
import org.eclipse.xpanse.tofu.maker.models.enums.DeploymentScenario;
1615

1716
/**
1817
* Data model for the OpenTofu destroy requests.
1918
*/
2019
@Data
2120
public class OpenTofuDestroyFromDirectoryRequest {
2221

23-
@Schema(description = "This value can be set by the client if they wish to know the type of"
24-
+ "request for which the callback response is generated from tofu-maker. There will be"
25-
+ "no difference in the way request is executed. This information is only set in the"
26-
+ "callback response again for the client to handle the callback response accordingly.")
27-
DeploymentScenario deploymentScenario;
28-
2922
@NotNull
3023
@Schema(description = "Key-value pairs of regular variables that must be used to execute the "
31-
+ "OpenTofu request.",
32-
additionalProperties = TRUE)
24+
+ "OpenTofu request.", additionalProperties = TRUE)
3325
Map<String, Object> variables;
3426

3527
@Schema(description = "Key-value pairs of variables that must be injected as environment "
36-
+ "variables to OpenTofu process.",
37-
additionalProperties = TRUE)
28+
+ "variables to OpenTofu process.", additionalProperties = TRUE)
3829
Map<String, String> envVariables = new HashMap<>();
3930
}

src/main/java/org/eclipse/xpanse/tofu/maker/models/request/directory/OpenTofuModifyFromDirectoryRequest.java

+4-11
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55

66
package org.eclipse.xpanse.tofu.maker.models.request.directory;
77

8+
import static io.swagger.v3.oas.annotations.media.Schema.AdditionalPropertiesValue.TRUE;
9+
810
import io.swagger.v3.oas.annotations.media.Schema;
911
import jakarta.validation.constraints.NotNull;
1012
import java.util.HashMap;
1113
import java.util.Map;
1214
import lombok.Data;
13-
import org.eclipse.xpanse.tofu.maker.models.enums.DeploymentScenario;
1415

1516
/**
1617
* Data model for the OpenTofu modify requests.
@@ -23,20 +24,12 @@ public class OpenTofuModifyFromDirectoryRequest {
2324
+ "or it must also apply the changes.")
2425
Boolean isPlanOnly;
2526

26-
@Schema(description = "This value can be set by the client if they wish to know the type of"
27-
+ "request for which the callback response is generated from tofu-maker. There will be"
28-
+ "no difference in the way request is executed. This information is only set in the"
29-
+ "callback response again for the client to handle the callback response accordingly.")
30-
DeploymentScenario deploymentScenario;
31-
3227
@NotNull
3328
@Schema(description = "Key-value pairs of variables that must be used to execute the "
34-
+ "OpenTofu request.",
35-
additionalProperties = Schema.AdditionalPropertiesValue.TRUE)
29+
+ "OpenTofu request.", additionalProperties = TRUE)
3630
Map<String, Object> variables;
3731

3832
@Schema(description = "Key-value pairs of variables that must be injected as environment "
39-
+ "variables to OpenTofu process.",
40-
additionalProperties = Schema.AdditionalPropertiesValue.TRUE)
33+
+ "variables to OpenTofu process.", additionalProperties = TRUE)
4134
Map<String, String> envVariables = new HashMap<>();
4235
}

src/main/java/org/eclipse/xpanse/tofu/maker/models/response/OpenTofuResult.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import java.util.Map;
1111
import lombok.Builder;
1212
import lombok.Data;
13-
import org.eclipse.xpanse.tofu.maker.models.enums.DeploymentScenario;
1413

1514
/**
1615
* Data model for the OpenTofu command execution results.
@@ -19,13 +18,8 @@
1918
@Builder
2019
public class OpenTofuResult {
2120

22-
@Schema(description = "This value can be set by the client if they wish to know the type of"
23-
+ "request for which the callback response is generated from tofu-maker. There will be"
24-
+ "no difference in the way request is executed. This information is only set in the"
25-
+ "callback response again for the client to handle the callback response accordingly.")
26-
private DeploymentScenario deploymentScenario;
27-
@Schema(description = "defines if the command was successfully executed")
2821
@NotNull
22+
@Schema(description = "defines if the command was successfully executed")
2923
private boolean isCommandSuccessful;
3024
@Schema(description = "stdout of the command returned as string.")
3125
private String commandStdOutput;

src/main/java/org/eclipse/xpanse/tofu/maker/opentofu/service/OpenTofuDirectoryService.java

+4-15
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import lombok.extern.slf4j.Slf4j;
2525
import org.eclipse.xpanse.tofu.maker.async.TaskConfiguration;
2626
import org.eclipse.xpanse.tofu.maker.models.OpenTofuMakerSystemStatus;
27-
import org.eclipse.xpanse.tofu.maker.models.enums.DeploymentScenario;
2827
import org.eclipse.xpanse.tofu.maker.models.enums.HealthStatus;
2928
import org.eclipse.xpanse.tofu.maker.models.exceptions.OpenTofuExecutorException;
3029
import org.eclipse.xpanse.tofu.maker.models.exceptions.OpenTofuHealthCheckException;
@@ -145,9 +144,7 @@ public OpenTofuResult deployFromDirectory(OpenTofuDeployFromDirectoryRequest req
145144
result.setCommandStdError(tfEx.getMessage());
146145
}
147146
String workspace = executor.getModuleFullPath(moduleDirectory);
148-
OpenTofuResult openTofuResult =
149-
transSystemCmdResultToOpenTofuResult(result, workspace,
150-
request.getDeploymentScenario());
147+
OpenTofuResult openTofuResult = transSystemCmdResultToOpenTofuResult(result, workspace);
151148
if (cleanWorkspaceAfterDeployment) {
152149
deleteWorkspace(workspace);
153150
}
@@ -176,8 +173,7 @@ public OpenTofuResult modifyFromDirectory(OpenTofuModifyFromDirectoryRequest req
176173
}
177174
String workspace = executor.getModuleFullPath(moduleDirectory);
178175
OpenTofuResult openTofuResult =
179-
transSystemCmdResultToOpenTofuResult(result, workspace,
180-
request.getDeploymentScenario());
176+
transSystemCmdResultToOpenTofuResult(result, workspace);
181177
if (cleanWorkspaceAfterDeployment) {
182178
deleteWorkspace(workspace);
183179
}
@@ -200,8 +196,7 @@ public OpenTofuResult destroyFromDirectory(OpenTofuDestroyFromDirectoryRequest r
200196
result.setCommandStdError(tfEx.getMessage());
201197
}
202198
String workspace = executor.getModuleFullPath(moduleDirectory);
203-
OpenTofuResult openTofuResult = transSystemCmdResultToOpenTofuResult(
204-
result, workspace, request.getDeploymentScenario());
199+
OpenTofuResult openTofuResult = transSystemCmdResultToOpenTofuResult(result, workspace);
205200
deleteWorkspace(workspace);
206201
return openTofuResult;
207202
}
@@ -228,7 +223,6 @@ public void asyncDeployWithScripts(
228223
result = deployFromDirectory(asyncDeployRequest, moduleDirectory);
229224
} catch (RuntimeException e) {
230225
result = OpenTofuResult.builder()
231-
.deploymentScenario(asyncDeployRequest.getDeploymentScenario())
232226
.commandStdOutput(null)
233227
.commandStdError(e.getMessage())
234228
.isCommandSuccessful(false)
@@ -252,7 +246,6 @@ public void asyncModifyWithScripts(
252246
result = modifyFromDirectory(asyncModifyRequest, moduleDirectory);
253247
} catch (RuntimeException e) {
254248
result = OpenTofuResult.builder()
255-
.deploymentScenario(asyncModifyRequest.getDeploymentScenario())
256249
.commandStdOutput(null)
257250
.commandStdError(e.getMessage())
258251
.isCommandSuccessful(false)
@@ -276,7 +269,6 @@ public void asyncDestroyWithScripts(OpenTofuAsyncDestroyFromDirectoryRequest req
276269
result = destroyFromDirectory(request, moduleDirectory);
277270
} catch (RuntimeException e) {
278271
result = OpenTofuResult.builder()
279-
.deploymentScenario(request.getDeploymentScenario())
280272
.commandStdOutput(null)
281273
.commandStdError(e.getMessage())
282274
.isCommandSuccessful(false)
@@ -291,12 +283,9 @@ public void asyncDestroyWithScripts(OpenTofuAsyncDestroyFromDirectoryRequest req
291283
}
292284

293285
private OpenTofuResult transSystemCmdResultToOpenTofuResult(SystemCmdResult result,
294-
String workspace,
295-
DeploymentScenario
296-
deploymentScenario) {
286+
String workspace) {
297287
OpenTofuResult openTofuResult = OpenTofuResult.builder().build();
298288
BeanUtils.copyProperties(result, openTofuResult);
299-
openTofuResult.setDeploymentScenario(deploymentScenario);
300289
openTofuResult.setTerraformState(getTerraformState(workspace));
301290
openTofuResult.setImportantFileContentMap(getImportantFilesContent(workspace));
302291
return openTofuResult;

src/main/java/org/eclipse/xpanse/tofu/maker/opentofu/service/OpenTofuGitRepoService.java

-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ public void asyncDeployFromGitRepo(
126126
result = deployFromGitRepo(asyncDeployRequest, uuid);
127127
} catch (RuntimeException e) {
128128
result = OpenTofuResult.builder()
129-
.deploymentScenario(asyncDeployRequest.getDeploymentScenario())
130129
.commandStdOutput(null)
131130
.commandStdError(e.getMessage())
132131
.isCommandSuccessful(false)
@@ -150,7 +149,6 @@ public void asyncModifyFromGitRepo(
150149
result = modifyFromGitRepo(asyncModifyRequest, uuid);
151150
} catch (RuntimeException e) {
152151
result = OpenTofuResult.builder()
153-
.deploymentScenario(asyncModifyRequest.getDeploymentScenario())
154152
.commandStdOutput(null)
155153
.commandStdError(e.getMessage())
156154
.isCommandSuccessful(false)
@@ -174,7 +172,6 @@ public void asyncDestroyFromGitRepo(OpenTofuAsyncDestroyFromGitRepoRequest reque
174172
result = destroyFromGitRepo(request, uuid);
175173
} catch (RuntimeException e) {
176174
result = OpenTofuResult.builder()
177-
.deploymentScenario(request.getDeploymentScenario())
178175
.commandStdOutput(null)
179176
.commandStdError(e.getMessage())
180177
.isCommandSuccessful(false)

src/main/java/org/eclipse/xpanse/tofu/maker/opentofu/service/OpenTofuScriptsService.java

-3
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ public void asyncDeployWithScripts(
111111
result = deployWithScripts(asyncDeployRequest, uuid);
112112
} catch (RuntimeException e) {
113113
result = OpenTofuResult.builder()
114-
.deploymentScenario(asyncDeployRequest.getDeploymentScenario())
115114
.commandStdOutput(null)
116115
.commandStdError(e.getMessage())
117116
.isCommandSuccessful(false)
@@ -135,7 +134,6 @@ public void asyncModifyWithScripts(
135134
result = modifyWithScripts(asyncModifyRequest, uuid);
136135
} catch (RuntimeException e) {
137136
result = OpenTofuResult.builder()
138-
.deploymentScenario(asyncModifyRequest.getDeploymentScenario())
139137
.commandStdOutput(null)
140138
.commandStdError(e.getMessage())
141139
.isCommandSuccessful(false)
@@ -159,7 +157,6 @@ public void asyncDestroyWithScripts(OpenTofuAsyncDestroyFromScriptsRequest reque
159157
result = destroyWithScripts(request, uuid);
160158
} catch (RuntimeException e) {
161159
result = OpenTofuResult.builder()
162-
.deploymentScenario(request.getDeploymentScenario())
163160
.commandStdOutput(null)
164161
.commandStdError(e.getMessage())
165162
.isCommandSuccessful(false)

0 commit comments

Comments
 (0)