mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
Recreate the reviewed Rekognition changes on the existing upstream main base using a verified commit. The complete file tree is identical to PR head 19f259b43e1ec8a3ce5fd2a50eb9c21e4ed604df, preserving the collection, pagination, persistence and model-validation fixes while removing the unsigned merge. Generate constraints for every modeled operation with constraints=True. Select the served operation in the handler, validate its request once, then dispatch. Preserve UnknownOperationException for unserved actions. Move constraint tests to the handler boundary and verify newly modeled operations are detected without maintaining an allowlist. Verified 189 Java tests, 55 generator tests, Checkstyle, generated-data, documentation and partition checks. Addresses review 5865133468.
56 lines
1.9 KiB
Java
56 lines
1.9 KiB
Java
package io.floci.aws.services.resourcegroups;
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import io.floci.aws.core.common.AwsException;
|
|
import io.floci.aws.core.common.RequestConstraintCheck;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* Checks a Resource Groups request against the constraints vendored in
|
|
* {@code aws/resource-groups-request-shapes.json} by {@code tools/aws/regen_resource_groups_shapes.py},
|
|
* answering {@code BadRequestException}.
|
|
*/
|
|
final class ResourceGroupsRequestShapes {
|
|
|
|
private static final RequestConstraintCheck CHECK = RequestConstraintCheck.load(
|
|
"aws/resource-groups-request-shapes.json", "Resource Groups request shapes",
|
|
new RequestConstraintCheck.Messages() {
|
|
@Override
|
|
public AwsException type(String path, String type) {
|
|
return bad(path + " must be a " + type + ".");
|
|
}
|
|
|
|
@Override
|
|
public AwsException bounds(String path, String type, Long min, Long max, Number size) {
|
|
return bad(path + " is outside the modeled bounds.");
|
|
}
|
|
|
|
@Override
|
|
public AwsException pattern(String path, String pattern) {
|
|
return bad(path + " does not match the modeled pattern.");
|
|
}
|
|
|
|
@Override
|
|
public AwsException enumValue(String path, List<String> values) {
|
|
return bad(path + " is not a modeled value.");
|
|
}
|
|
|
|
@Override
|
|
public AwsException required(String path) {
|
|
return bad(path + " is required.");
|
|
}
|
|
});
|
|
|
|
private ResourceGroupsRequestShapes() {
|
|
}
|
|
|
|
static void check(String operation, JsonNode request) {
|
|
CHECK.check(operation, request);
|
|
}
|
|
|
|
private static AwsException bad(String message) {
|
|
return new AwsException("BadRequestException", message, 400);
|
|
}
|
|
}
|