mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(emr-serverless): retain deleted applications for waiters (#6103)
* fix(emr-serverless): retain deleted applications for waiters * fix(emr-serverless): reject tag access after application deletion
This commit is contained in:
1 parent
e5591dda32
commit
03f87285a0
4 files changed
+70
-3
No files matched your search
+12
-1
@@ -119,6 +119,8 @@ public class EmrServerlessService {
|
||||
.filter(app -> inRegion(app, region)).collect(Collectors.toList());
|
||||
if (request.getStates() != null && !request.getStates().isEmpty()) {
|
||||
all = all.stream().filter(app -> request.getStates().contains(app.getState())).collect(Collectors.toList());
|
||||
} else {
|
||||
all = all.stream().filter(app -> !"TERMINATED".equals(app.getState())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
PaginatedResult<Application> page = Pagination.paginate(all, Application::getApplicationId, request.getMaxResults(), request.getNextToken(), 50, "ValidationException");
|
||||
@@ -197,7 +199,9 @@ public class EmrServerlessService {
|
||||
if (!"CREATED".equals(state) && !"STOPPED".equals(state)) {
|
||||
throw new AwsException("ValidationException", "Application must be in a stopped or created state in order to be deleted.", 400);
|
||||
}
|
||||
storage.delete(applicationId);
|
||||
app.setState("TERMINATED");
|
||||
app.setUpdatedAt(System.currentTimeMillis());
|
||||
storage.put(applicationId, app);
|
||||
}
|
||||
|
||||
public synchronized void startApplication(String applicationId) {
|
||||
@@ -206,6 +210,9 @@ public class EmrServerlessService {
|
||||
if ("STARTED".equals(state) || "STARTING".equals(state)) {
|
||||
return;
|
||||
}
|
||||
if ("TERMINATED".equals(state)) {
|
||||
throw new AwsException("ValidationException", "Application is terminated.", 400);
|
||||
}
|
||||
app.setState("STARTED");
|
||||
app.setUpdatedAt(System.currentTimeMillis());
|
||||
storage.put(applicationId, app);
|
||||
@@ -217,6 +224,9 @@ public class EmrServerlessService {
|
||||
if ("STOPPED".equals(state) || "STOPPING".equals(state)) {
|
||||
return;
|
||||
}
|
||||
if ("TERMINATED".equals(state)) {
|
||||
throw new AwsException("ValidationException", "Application is terminated.", 400);
|
||||
}
|
||||
app.setState("STOPPED");
|
||||
app.setUpdatedAt(System.currentTimeMillis());
|
||||
storage.put(applicationId, app);
|
||||
@@ -288,6 +298,7 @@ public class EmrServerlessService {
|
||||
}
|
||||
return storage.get(matcher.group(1))
|
||||
.filter(app -> arn.equals(app.getArn()))
|
||||
.filter(app -> !"TERMINATED".equals(app.getState()))
|
||||
.orElseThrow(() -> new AwsException("ResourceNotFoundException", "Resource " + arn + " not found", 404));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user