Skip to content

Commit

Permalink
Merge pull request #25 from deployment-io/integration
Browse files Browse the repository at this point in the history
Refactor parameter extraction for AWS service deletion
  • Loading branch information
ankit-arora authored Oct 25, 2024
2 parents 3cb1a51 + 2988afa commit 3608f25
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions jobs/commands/delete_aws_private_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,28 @@ type DeleteAwsPrivateService struct {
func (d *DeleteAwsPrivateService) Run(parameters map[string]interface{}, logsWriter io.Writer) (newParameters map[string]interface{}, err error) {
//stop service //delete service
io.WriteString(logsWriter, fmt.Sprintf("Deleting private service\n"))
deploymentID, err := jobs.GetParameterValue[string](parameters, parameters_enums.DeploymentID)
if err != nil {
return parameters, err
}
var organizationIdFromJob string
organizationIdFromJob, err = jobs.GetParameterValue[string](parameters, parameters_enums.OrganizationIdFromJob)
if err != nil {
return parameters, err
}
if !isPreview(parameters) {
//update deployment to deleted and delete domain
updateDeploymentsPipeline.Add(organizationIdFromJob, deployments.UpdateDeploymentDtoV1{
ID: deploymentID,
DeletionState: deployment_enums.DeletionInProcess,
})
} else {
previewID := deploymentID
updatePreviewsPipeline.Add(organizationIdFromJob, previews.UpdatePreviewDtoV1{
ID: previewID,
DeletionState: deployment_enums.DeletionInProcess,
})
}
clusterArn, err := jobs.GetParameterValue[string](parameters, parameters_enums.EcsClusterArn)
if err != nil {
return parameters, err
Expand Down Expand Up @@ -107,16 +129,6 @@ func (d *DeleteAwsPrivateService) Run(parameters map[string]interface{}, logsWri
return parameters, err
}
}

deploymentID, err := jobs.GetParameterValue[string](parameters, parameters_enums.DeploymentID)
if err != nil {
return parameters, err
}
var organizationIdFromJob string
organizationIdFromJob, err = jobs.GetParameterValue[string](parameters, parameters_enums.OrganizationIdFromJob)
if err != nil {
return parameters, err
}
if !isPreview(parameters) {
//update deployment to deleted and delete domain
updateDeploymentsPipeline.Add(organizationIdFromJob, deployments.UpdateDeploymentDtoV1{
Expand Down

0 comments on commit 3608f25

Please sign in to comment.