mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(bedrock): serialize guardrail updates and deletion (#7843)
* fix(bedrock): serialize guardrail updates and deletion * fix(bedrock): serialize guardrail version creation * test(bedrock): stage the guardrail race with the shared ParkingStore
This commit is contained in:
1 parent
e3f18da59e
commit
f491a77dba
2 files changed
+104
-3
No files matched your search
@@ -203,7 +203,7 @@ public class BedrockService implements ResourceProvider {
|
||||
"Guardrail " + guardrailId + " version " + effectiveVersion + " does not exist.", 404));
|
||||
}
|
||||
|
||||
public Guardrail updateGuardrail(String identifier, JsonNode request, String region) {
|
||||
public synchronized Guardrail updateGuardrail(String identifier, JsonNode request, String region) {
|
||||
String name = requiredName(request);
|
||||
String description = boundedDescription(request);
|
||||
String blockedInputMessaging = requiredBlockedMessaging(request, "blockedInputMessaging");
|
||||
@@ -230,7 +230,7 @@ public class BedrockService implements ResourceProvider {
|
||||
* {@code guardrailVersion} is a {@code GuardrailNumericalVersion} in the AWS model,
|
||||
* so DRAFT cannot be deleted on its own.
|
||||
*/
|
||||
public void deleteGuardrail(String identifier, String version, String region) {
|
||||
public synchronized void deleteGuardrail(String identifier, String version, String region) {
|
||||
String guardrailId = resolveGuardrailId(identifier);
|
||||
if (version != null && !version.isBlank()) {
|
||||
if (!NUMERICAL_VERSION_PATTERN.matcher(version).matches()) {
|
||||
@@ -398,7 +398,7 @@ public class BedrockService implements ResourceProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public Guardrail createGuardrailVersion(String identifier, String description, String region) {
|
||||
public synchronized Guardrail createGuardrailVersion(String identifier, String description, String region) {
|
||||
Guardrail draft = getGuardrail(identifier, DRAFT_VERSION, region);
|
||||
String guardrailId = draft.getGuardrailId();
|
||||
String version = String.valueOf(nextVersionNumber(guardrailId, region));
|
||||
|
||||
Reference in new issue
Block a user