mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
refactor(iam): drop the empty HAND_BUILT list and the reader's hand-built check (#9272)
With IAM read from the generated tables, no namespace is built by hand and HAND_BUILT is empty. Remove it from the request-resources generator (the tuple, the file's handBuilt key, and the clauses reading a hand-built namespace's operations only where MEASURED gives them) and from the reader (RequestResources.builtByHand, the parsed table's handBuilt set, and the clauses of readsNamespace and IamActionRegistry.checkedAsAws that asked it). Every operation's resources are unchanged: the generator's offline check regenerates the same file, without the empty key.
This commit is contained in:
1 parent
da661523ae
commit
4897db0bad
9 files changed
+57
-89
No files matched your search
@@ -374,8 +374,7 @@ final class RequestResourceMembers {
|
||||
* The file: each operation's resources, the resource types its action acts on, the resources it creates under a
|
||||
* parent and the one a create whose action acts on no type, or on other types alone, makes ({@code makes}), as
|
||||
* {@code <namespace>:<Operation>}, the members a REST operation's request carries outside its body, each
|
||||
* namespace's ARN formats, and the namespaces it reads, those built by hand, those not read yet, and the others
|
||||
* with resource types. A located member is a label of the request's path, {@code {Label}}, or a parameter of its
|
||||
* namespace's ARN formats, and the namespaces it reads, those not read yet, and the others with resource types. A located member is a label of the request's path, {@code {Label}}, or a parameter of its
|
||||
* query, {@code ?name}, by the member's name, and one the clients of an operation locate apart is under each
|
||||
* client ({@code locatedApart}), whose vendored route tells a request's client. Each operation's {@code forwarded}
|
||||
* requests are those its service makes to another as the caller, and its {@code statements} those it makes as the
|
||||
@@ -392,7 +391,7 @@ final class RequestResourceMembers {
|
||||
Map<String, Map<String, String>> located, Map<String, Map<String, ArnFormat>> formats,
|
||||
Map<String, Map<String, List<String>>> resourceTagKeys,
|
||||
Map<String, Map<String, Map<String, ResourceKey>>> resourceKeys,
|
||||
Set<String> namespaces, Set<String> handBuilt, Set<String> notCovered, Set<String> otherNamespaces,
|
||||
Set<String> namespaces, Set<String> notCovered, Set<String> otherNamespaces,
|
||||
Map<String, List<Forwarded>> forwarded, Map<String, Map<String, List<StatementRequest>>> statements,
|
||||
Map<String, Map<String, Map<String, String>>> locatedApart, Set<String> unread,
|
||||
Map<String, Map<String, List<Resource>>> checkedAs) {
|
||||
@@ -664,7 +663,6 @@ final class RequestResourceMembers {
|
||||
return new Table(Map.copyOf(entries), Map.copyOf(actsOn), Map.copyOf(creates), Map.copyOf(makes),
|
||||
Map.copyOf(targets), Map.copyOf(ec2Query), Map.copyOf(located), Map.copyOf(formats),
|
||||
Map.copyOf(resourceTagKeys), resourceKeys, namespaces,
|
||||
names(document.path("handBuilt")),
|
||||
Set.copyOf(document.path("notCovered").propertyStream().map(Map.Entry::getKey).toList()),
|
||||
names(document.path("otherNamespaces")), Map.copyOf(forwarded), statements(document, formats),
|
||||
Map.copyOf(locatedApart), Set.copyOf(unread), Map.copyOf(checkedAs));
|
||||
|
||||
@@ -70,9 +70,9 @@ public final class RequestResources {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the generated table owns this operation, including those of hand-built namespaces it reads. An operation
|
||||
* naming what it acts on in a body the reader does not read ({@code unread}: S3's DeleteObjects, its keys in an XML
|
||||
* body) is not read, as checked on the rest of its request it would be checked on none of what it names.
|
||||
* Whether the generated table owns this operation. An operation naming what it acts on in a body the reader does
|
||||
* not read ({@code unread}: S3's DeleteObjects, its keys in an XML body) is not read, as checked on the rest of its
|
||||
* request it would be checked on none of what it names.
|
||||
*/
|
||||
public static boolean reads(String operation) {
|
||||
return readable(RequestResourceMembers.table(), operation);
|
||||
@@ -92,18 +92,9 @@ public final class RequestResources {
|
||||
return operation != null && table.operations().containsKey(operation) && !table.unread().contains(operation);
|
||||
}
|
||||
|
||||
/** Whether {@code ResourceArnBuilder} builds the resources of this namespace's requests itself. */
|
||||
public static boolean builtByHand(String namespace) {
|
||||
return namespace != null && RequestResourceMembers.table().handBuilt().contains(namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the table reads this namespace whole, every operation's resources from its request as modeled: one it
|
||||
* covers that {@code ResourceArnBuilder} does not build by hand, which a few of its operations may be read for.
|
||||
*/
|
||||
/** Whether the table reads this namespace whole, every operation's resources from its request as modeled. */
|
||||
public static boolean readsNamespace(String namespace) {
|
||||
return namespace != null && RequestResourceMembers.table().namespaces().contains(namespace)
|
||||
&& !builtByHand(namespace);
|
||||
return namespace != null && RequestResourceMembers.table().namespaces().contains(namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -747,14 +747,12 @@ public class IamActionRegistry {
|
||||
|
||||
/**
|
||||
* Whether a request of the operation is checked on the resources AWS checks its action on: those its request
|
||||
* names, which the vendored request resources read for the operation ({@link RequestResources#reads}) or
|
||||
* {@code ResourceArnBuilder} builds for its namespace ({@link RequestResources#builtByHand}), or {@code *}
|
||||
* when AWS authorizes the action on no resource type ({@link IamAuthorizedActions#actsOnNoResourceType}), so
|
||||
* none of the resources in the request's path is needed.
|
||||
* names, which the vendored request resources read for the operation ({@link RequestResources#reads}), or
|
||||
* {@code *} when AWS authorizes the action on no resource type ({@link IamAuthorizedActions#actsOnNoResourceType}),
|
||||
* so none of the resources in the request's path is needed.
|
||||
*/
|
||||
private static boolean checkedAsAws(String credentialScope, String operation, String action) {
|
||||
return RequestResources.reads(credentialScope + ":" + operation)
|
||||
|| RequestResources.builtByHand(credentialScope)
|
||||
|| IamAuthorizedActions.actsOnNoResourceType(action);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user