@@ -36,6 +36,7 @@ import software.aws.toolkits.jetbrains.services.cloudformation.stack.StackWindow
36
36
import software.aws.toolkits.jetbrains.services.cloudformation.validateSamTemplateHasResources
37
37
import software.aws.toolkits.jetbrains.services.lambda.LambdaHandlerResolver
38
38
import software.aws.toolkits.jetbrains.services.lambda.deploy.DeployServerlessApplicationDialog
39
+ import software.aws.toolkits.jetbrains.services.lambda.deploy.DeployServerlessApplicationSettings
39
40
import software.aws.toolkits.jetbrains.services.lambda.sam.SamCommon
40
41
import software.aws.toolkits.jetbrains.services.lambda.sam.SamExecutable
41
42
import software.aws.toolkits.jetbrains.services.lambda.steps.DeployLambda
@@ -106,8 +107,7 @@ class DeployServerlessApplicationAction : AnAction(
106
107
FileDocumentManager .getInstance().saveAllDocuments()
107
108
108
109
val stackDialog = DeployServerlessApplicationDialog (project, templateFile)
109
- stackDialog.show()
110
- if (! stackDialog.isOK) {
110
+ if (! stackDialog.showAndGet()) {
111
111
SamTelemetry .deploy(
112
112
project = project,
113
113
version = SamCommon .getVersionString(),
@@ -116,27 +116,28 @@ class DeployServerlessApplicationAction : AnAction(
116
116
return @runInEdt
117
117
}
118
118
119
- saveSettings(project, templateFile, stackDialog)
119
+ val settings = stackDialog.settings()
120
+ saveSettings(project, templateFile, settings)
120
121
121
- val stackName = stackDialog .stackName
122
- continueDeployment(project, stackName, templateFile, stackDialog )
122
+ val stackName = settings .stackName
123
+ continueDeployment(project, stackName, templateFile, settings )
123
124
}
124
125
}
125
126
}
126
127
127
- private fun continueDeployment (project : Project , stackName : String , templateFile : VirtualFile , stackDialog : DeployServerlessApplicationDialog ) {
128
+ private fun continueDeployment (project : Project , stackName : String , templateFile : VirtualFile , settings : DeployServerlessApplicationSettings ) {
128
129
val workflow = StepExecutor (
129
130
project,
130
131
message(" serverless.application.deploy_in_progress.title" , stackName),
131
132
createDeployWorkflow(
132
133
project,
133
134
stackName,
134
135
templateFile,
135
- stackDialog .bucket,
136
- stackDialog .ecrRepo,
137
- stackDialog .useContainer,
138
- stackDialog .parameters,
139
- stackDialog .capabilities
136
+ settings .bucket,
137
+ settings .ecrRepo,
138
+ settings .useContainer,
139
+ settings .parameters,
140
+ settings .capabilities
140
141
),
141
142
stackName
142
143
)
@@ -145,7 +146,7 @@ class DeployServerlessApplicationAction : AnAction(
145
146
runBlocking {
146
147
val changeSetArn = it.getRequiredAttribute(DeployLambda .CHANGE_SET_ARN )
147
148
148
- if (! stackDialog .autoExecute) {
149
+ if (! settings .autoExecute) {
149
150
val response = withContext(edtContext) { UploadFunctionContinueDialog (project, changeSetArn).showAndGet() }
150
151
if (! response) {
151
152
// TODO this telemetry needs to be improved. The user can finish the deployment later so we do not know if
@@ -251,16 +252,16 @@ class DeployServerlessApplicationAction : AnAction(
251
252
return @runReadAction null
252
253
}
253
254
254
- private fun saveSettings (project : Project , templateFile : VirtualFile , stackDialog : DeployServerlessApplicationDialog ) {
255
+ private fun saveSettings (project : Project , templateFile : VirtualFile , settings : DeployServerlessApplicationSettings ) {
255
256
ModuleUtil .findModuleForFile(templateFile, project)?.let { module ->
256
257
relativeSamPath(module, templateFile)?.let { samPath ->
257
258
DeploySettings .getInstance(module)?.apply {
258
- setSamStackName(samPath, stackDialog .stackName)
259
- setSamBucketName(samPath, stackDialog .bucket)
260
- setSamEcrRepoUri(samPath, stackDialog .ecrRepo)
261
- setSamAutoExecute(samPath, stackDialog .autoExecute)
262
- setSamUseContainer(samPath, stackDialog .useContainer)
263
- setEnabledCapabilities(samPath, stackDialog .capabilities)
259
+ setSamStackName(samPath, settings .stackName)
260
+ setSamBucketName(samPath, settings .bucket)
261
+ setSamEcrRepoUri(samPath, settings .ecrRepo)
262
+ setSamAutoExecute(samPath, settings .autoExecute)
263
+ setSamUseContainer(samPath, settings .useContainer)
264
+ setEnabledCapabilities(samPath, settings .capabilities)
264
265
}
265
266
}
266
267
}
0 commit comments