diff --git a/docs/services/iam.md b/docs/services/iam.md index de4f9ecf7b..3756a58d37 100644 --- a/docs/services/iam.md +++ b/docs/services/iam.md @@ -1949,8 +1949,14 @@ Region than the request's is checked as given and as each resource of that name on instead, in the ARN's account or the caller's and in the ARN's Region or the request's (ECR's tag handlers keep the ARN's account in the request's Region), and the request is refused if any is denied; one of a type AWS owns, whose ARN's account is `aws` (an IAM Identity Center application -provider), is checked in that account alone. Every other request is checked on `*`, as is an operation whose action acts on no -resource type or whose request names none, where AWS checks `*` too. `make +provider), is checked in that account alone, and so is one its service acts on in the account the ARN names +(the sink an OAM `CreateLink` links to, a RAM invitation sent to the caller or a share another account owns). A +request leaving out an optional member holding the ARN of a resource its service then uses one of its own for +is checked on the one the service finds: Resource Explorer's `Search` and `ListResources` with no `ViewArn` +on the Region's default view. A field of each value of a map of structures, named after a type the action acts +on, names one resource for each: an FIS experiment template's create and update are checked on each action +its `actions` map names by `actionId`, `action/`. Every other request is checked on `*`, as is an +operation whose action acts on no resource type or whose request names none, where AWS checks `*` too. `make iam-request-resources-check` re-derives the table from the pinned botocore, `make iam-request-resources-verify` checks it against AWS, and the namespaces it does not read yet are listed in it with their reason. @@ -2072,8 +2078,8 @@ that type when it is left out. GuardDuty's detector operations are checked on `d from their path, and a publishing destination on `detector//publishingdestination/`; its list, member and organization operations act on no resource type and are checked on `*`. An `EnableSecurityHub` or a GuardDuty -create carrying tags also needs `securityhub:TagResource` on the hub or `guardduty:TagResource` on `*`, -a detector's id being one GuardDuty mints (below). +create carrying tags also needs `securityhub:TagResource` on the hub or `guardduty:TagResource` on the +resource it creates, with the id GuardDuty mints open (`detector/*`, `detector//ipset/*`). A route no rule maps is the operation whose route it matches in botocore's model of its service, vendored in `src/main/resources/aws/rest-routes.json` (`make aws-data-sync` regenerates it): of the @@ -2395,7 +2401,12 @@ resource, so its tags are checked on that one, built from the parent's ARN with listeners and rules, holds. A create that names another resource beside the one it makes tags the one it makes alone, the resource of the type it is named after: Cloud Map's `CreateService` is checked on its namespace and on `service/*`, and its tags on `service/*`; CodePipeline's -`PutWebhook` on the webhook and the pipeline it connects to, and its tags on the webhook. Where the +`PutWebhook` on the webhook and the pipeline it connects to, and its tags on the webhook. A create +whose action acts on no resource type is checked on `*`, and its tags on the resource it makes, of the +type it is named after with the ids its service mints open, where its tagging action acts on that type: +Resource Explorer's `CreateView` on `view//*`, OAM's `CreateSink` on `sink/*`, ACM's +`RequestCertificate` on `certificate/*`; a Cloud Map namespace's tags, whose `TagResource` acts on no +type, stay on `*`. Where the tagging action takes its namespace's `CreateAction` key, as `ec2:CreateTags`, `ecs:TagResource`, CloudFormation's `TagResource` and Elastic Load Balancing's `AddTags` do, the key is the operation's name: diff --git a/src/main/java/io/floci/aws/core/common/IamEnforcementFilter.java b/src/main/java/io/floci/aws/core/common/IamEnforcementFilter.java index 13fa08644d..15243bc41e 100644 --- a/src/main/java/io/floci/aws/core/common/IamEnforcementFilter.java +++ b/src/main/java/io/floci/aws/core/common/IamEnforcementFilter.java @@ -1125,8 +1125,8 @@ public class IamEnforcementFilter implements ContainerRequestFilter { String credentialScope, List resources, String region, String accountId, String akid) { // A create tags the resource it makes, not the parent it makes it in (see RequestResources.created). - List created = RequestResources.created(operation, ctx, AwsRegions.partitionFor(region), region, - accountId, IamActionRegistry.pathLabels(credentialScope, ctx)); + List created = RequestResources.created(operation, tagging.action(), ctx, + AwsRegions.partitionFor(region), region, accountId, IamActionRegistry.pathLabels(credentialScope, ctx)); List made = created.isEmpty() ? resources : created; for (TagOnCreate.TagSet set : tagging.checked()) { Map> context = TagOnCreate.conditionContext(tagging, set, operation); diff --git a/src/main/java/io/floci/aws/core/common/RequestResourceMembers.java b/src/main/java/io/floci/aws/core/common/RequestResourceMembers.java index 7a8c7123e8..4fd18a17fd 100644 --- a/src/main/java/io/floci/aws/core/common/RequestResourceMembers.java +++ b/src/main/java/io/floci/aws/core/common/RequestResourceMembers.java @@ -37,11 +37,11 @@ final class RequestResourceMembers { "[A-Za-z][A-Za-z0-9_]*(\\[])?(\\.[A-Za-z][A-Za-z0-9_]*(\\[])?)?" + "|[A-Za-z][A-Za-z0-9_]*\\{\\}(\\.[A-Za-z][A-Za-z0-9_]*){1,2}"); /** - * A member filling a variable may also be a field of a structure, or of each of a list's structures, one value - * for each. + * A member filling a variable may also be a field of a structure, or of each of a list's structures or of a map's + * structure values, one value for each. */ - private static final Pattern FILL_MEMBER = Pattern.compile( - "[A-Za-z][A-Za-z0-9_]*(\\[]|\\[]\\.[A-Za-z][A-Za-z0-9_]*|\\.[A-Za-z][A-Za-z0-9_]*)?"); + private static final Pattern FILL_MEMBER = Pattern.compile("[A-Za-z][A-Za-z0-9_]*(\\[]|\\[]\\.[A-Za-z][A-Za-z0-9_]*" + + "|\\{}\\.[A-Za-z][A-Za-z0-9_]*|\\.[A-Za-z][A-Za-z0-9_]*)?"); /** An ARN format's leading resource type word, and the rest of its resource. */ private static final Pattern RESOURCE_PART = Pattern.compile( "^arn:\\$\\{Partition}:[^:]*:[^:]*:[^:]*:([A-Za-z][A-Za-z0-9-]*)(.*)$"); @@ -56,6 +56,8 @@ final class RequestResourceMembers { private static final List FOUND_ONLY = List.of("absent", "arnOf", "fixed", "before"); /** The keys of a resource named through a member naming another of its service's own: it is read no other way. */ private static final Set THROUGH_KEYS = Set.of("types", "through", "when", "endpoint"); + /** The keys of a resource its service acts on for a request naming none of it: it is read no other way. */ + private static final Set DEFAULT_KEYS = Set.of("type", "fill", "when", "default", "endpoint"); /** * A request selector that holds a string, an array when {@code list}, or map values when {@code map}. @@ -154,12 +156,22 @@ final class RequestResourceMembers { * of {@code types} may be named {@code through} a member naming, by each of its values, a resource of its * service's own that runs on it, is in it or reaches it (a Data API session, by its {@code SessionId}; an EMR * instance group, by its {@code InstanceGroups[].InstanceGroupId}), {@code when} the request gives the values it - * names, and read no other way. + * names, and read no other way. A resource {@code byDefault} is the one of its type its service acts on for a + * request naming none of it, {@code when} the request leaves out the member that would (Resource Explorer's + * {@code Search} with no {@code ViewArn}, on the Region's default view), read no other way. */ record Resource(List types, Member arn, Map fill, Map> when, Map> unless, Map absent, Map arnOf, Member account, String before, Map fixed, boolean made, List find, - String endpoint, Member through) { + String endpoint, Member through, boolean byDefault) { + + Resource(List types, Member arn, Map fill, Map> when, + Map> unless, Map absent, Map arnOf, + Member account, String before, Map fixed, boolean made, List find, + String endpoint, Member through) { + this(types, arn, fill, when, unless, absent, arnOf, account, before, fixed, made, find, endpoint, through, + false); + } Resource(List types, Member arn, Map fill, Map> when, Map> unless, Map absent, Map arnOf, @@ -181,13 +193,15 @@ final class RequestResourceMembers { } /** - * The file: each operation's resources and the resources it creates under a parent, as + * 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 makes ({@code makes}), as * {@code :}, 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 * query, {@code ?name}, by the member's name. */ - record Table(Map> operations, Map> creates, + record Table(Map> operations, Map> types, + Map> creates, Map> makes, Map targets, Map> located, Map> formats, Set namespaces, Set handBuilt, Set notCovered, Set otherNamespaces) { @@ -244,7 +258,9 @@ final class RequestResourceMembers { } }); Map> entries = new LinkedHashMap<>(); + Map> actsOn = new LinkedHashMap<>(); Map> creates = new LinkedHashMap<>(); + Map> makes = new LinkedHashMap<>(); Map targets = new LinkedHashMap<>(); Map> located = new LinkedHashMap<>(); operations.properties().forEach(operation -> { @@ -258,6 +274,20 @@ final class RequestResourceMembers { resources.add(resource(operation.getKey(), resource, formats.getOrDefault(namespace, Map.of()))); } entries.put(operation.getKey(), List.copyOf(resources)); + List types = operation.getValue().path("types").valueStream().map(JsonNode::asText).toList(); + actsOn.put(operation.getKey(), types); + List made = new ArrayList<>(); + for (JsonNode resource : operation.getValue().path("makes")) { + if (!types.isEmpty() || !resource.isObject() || resource.size() != 2 || !resource.has("type") + || !resource.has("fill")) { + throw new IllegalStateException(RESOURCE_NAME + " makes " + resource + " for " + operation.getKey() + + ", no type's variables of a create acting on none"); + } + made.add(resource(operation.getKey(), resource, formats.getOrDefault(namespace, Map.of()))); + } + if (!made.isEmpty()) { + makes.put(operation.getKey(), List.copyOf(made)); + } JsonNode target = operation.getValue().path("targets"); if (!target.isMissingNode()) { String member = target.path("member").asText(""); @@ -285,12 +315,12 @@ final class RequestResourceMembers { targets.put(operation.getKey(), new Targets(new Member(member.substring(0, member.length() - 2), true), query, Map.copyOf(prefixes))); } - List made = new ArrayList<>(); + List under = new ArrayList<>(); for (JsonNode created : operation.getValue().path("creates")) { - made.add(created(operation.getKey(), created, formats.getOrDefault(namespace, Map.of()))); + under.add(created(operation.getKey(), created, formats.getOrDefault(namespace, Map.of()))); } - if (!made.isEmpty()) { - creates.put(operation.getKey(), List.copyOf(made)); + if (!under.isEmpty()) { + creates.put(operation.getKey(), List.copyOf(under)); } Map where = new LinkedHashMap<>(); operation.getValue().path("located").properties().forEach(member -> { @@ -305,7 +335,8 @@ final class RequestResourceMembers { located.put(operation.getKey(), Map.copyOf(where)); } }); - return new Table(Map.copyOf(entries), Map.copyOf(creates), Map.copyOf(targets), Map.copyOf(located), Map.copyOf(formats), namespaces, + return new Table(Map.copyOf(entries), Map.copyOf(actsOn), Map.copyOf(creates), Map.copyOf(makes), + Map.copyOf(targets), Map.copyOf(located), Map.copyOf(formats), namespaces, names(document.path("handBuilt")), Set.copyOf(document.path("notCovered").propertyStream().map(Map.Entry::getKey).toList()), names(document.path("otherNamespaces"))); @@ -389,12 +420,19 @@ final class RequestResourceMembers { throw new IllegalStateException(RESOURCE_NAME + " finds a " + type + " for " + operation + " by " + resource.path("find") + ", no members of one value each, or beside members reading it otherwise"); } - if (fill.values().stream().filter(Member::list).count() > 1) { + if (fill.values().stream().filter(member -> member.list() || member.map()).count() > 1) { throw new IllegalStateException(RESOURCE_NAME + " fills " + type + " for " + operation + " from more than one list"); } Map> when = values(operation, type, resource.path("when")); Map> unless = values(operation, type, resource.path("unless")); + boolean byDefault = resource.has("default"); + if (byDefault && (!resource.path("default").isBoolean() || !resource.path("default").booleanValue() + || !fill.isEmpty() || when.isEmpty() || resource.properties().stream().map(Map.Entry::getKey) + .anyMatch(key -> !DEFAULT_KEYS.contains(key)))) { + throw new IllegalStateException(RESOURCE_NAME + " names " + type + " for " + operation + + " as its service's default, which is not for a request naming none"); + } Set filled = Set.copyOf(fill.values().stream().map(Member::path).toList()); Map absent = new LinkedHashMap<>(); resource.path("absent").properties().forEach(member -> { @@ -421,7 +459,7 @@ final class RequestResourceMembers { + " from " + account.name() + ", no member of one account or a type of none"); } return new Resource(List.of(type), null, Map.copyOf(fill), when, unless, Map.copyOf(absent), Map.copyOf(arnOf), - account, before, Map.copyOf(fixed), made, List.copyOf(find), endpoint, null); + account, before, Map.copyOf(fixed), made, List.copyOf(find), endpoint, null, byDefault); } /** The values each member named in {@code when} or {@code unless} may have, an empty one for the member absent. */ @@ -465,8 +503,8 @@ final class RequestResourceMembers { } /** - * A member filling a variable: {@code Name}, {@code Name[]}, or a field of a structure, {@code Name.Field}, or of - * each of a list's structures, {@code Name[].Field}. + * A member filling a variable: {@code Name}, {@code Name[]}, or a field of a structure, {@code Name.Field}, of + * each of a list's structures, {@code Name[].Field}, or of each of a map's structure values, {@code Name{}.Field}. */ private static Member fillMember(String operation, String path) { if (!FILL_MEMBER.matcher(path).matches()) { @@ -477,10 +515,10 @@ final class RequestResourceMembers { /** * Whether a member gives one value as it is read: one that is no list, top-level or a field of a structure, or a - * field of each of a list's structures that fills a variable, one value for each structure. + * field of each of a list's or a map's structures that fills a variable, one value for each structure. */ private static boolean readAsOne(String operation, String path, Set filled) { - if (FILL_MEMBER.matcher(path).matches() && path.contains("[].")) { + if (FILL_MEMBER.matcher(path).matches() && (path.contains("[].") || path.contains("{}."))) { return filled.contains(path); } Member member = path.contains(".") ? fillMember(operation, path) : member(operation, path); diff --git a/src/main/java/io/floci/aws/core/common/RequestResources.java b/src/main/java/io/floci/aws/core/common/RequestResources.java index fa252038eb..fdda12ca3e 100644 --- a/src/main/java/io/floci/aws/core/common/RequestResources.java +++ b/src/main/java/io/floci/aws/core/common/RequestResources.java @@ -35,7 +35,10 @@ import java.util.regex.Pattern; * another account or Region than the request's is checked as given and as each resource of that name a handler may * act on instead, in the ARN's account or the caller's and in the ARN's Region or the request's, and the request is * refused if any is denied, as handlers mix them (ECR's tag handlers keep the ARN's account in the request's - * Region); one of a resource AWS owns, whose account is {@code aws}, is checked in that account alone. + * Region); one of a resource AWS owns, whose account is {@code aws}, is checked in that account alone, and so is one + * its service says it acts on in the account the ARN names (an OAM sink a link is made to). A request leaving out a + * member naming a resource its service then uses one of its own for is checked on the one the service finds + * (Resource Explorer's default view). */ public final class RequestResources { @@ -189,12 +192,17 @@ public final class RequestResources { resource.types().stream().map(formats::get).filter(format -> format.pattern().matcher(named).matches()) .min(Comparator.comparing(format -> !format.awsOwned())) .ifPresent(format -> addNamed(arns, format.checked(named), format.awsOwned(), - partition, region, accountId)); + partition, region, accountId, stored)); } } else if (resource.through() != null) { through(arns, resource, formats, form, body, region, stored); } else if (!resource.find().isEmpty()) { found(arns, resource, formats, form, body, partition, region, accountId, stored); + } else if (resource.byDefault()) { + // The one its service acts on for a request naming none, as it finds it; none when it has none. + if (stored != null) { + stored.findDefault(resource.types().getFirst(), region).ifPresent(arns::add); + } } else { fill(arns, resource, formats, form, body, partition, region, accountId, stored); } @@ -221,11 +229,30 @@ public final class RequestResources { */ public static List created(String operation, ContainerRequestContext ctx, String partition, String region, String accountId, Map labels) { + return created(operation, null, ctx, partition, region, accountId, labels); + } + + /** + * As {@link #created(String, ContainerRequestContext, String, String, String, Map)}, for a request whose tags need + * the {@code tagging} action: a create whose action acts on no resource type tags the resource it makes + * ({@code makes}) where that action acts on the resource's type, as AWS checks a tagging action on the resource + * being tagged, and its tags go where the operation is checked otherwise (a Cloud Map namespace, whose + * {@code TagResource} acts on no type, on {@code *}); a null {@code tagging}, or one the table does not hold, acts + * on it. + */ + public static List created(String operation, String tagging, ContainerRequestContext ctx, String partition, + String region, String accountId, Map labels) { RequestResourceMembers.Table table = RequestResourceMembers.table(); List creates = operation == null ? null : table.creates().get(operation); List made = operation == null || creates != null ? List.of() : served(table.operations().getOrDefault(operation, List.of()), ctx).stream() .filter(RequestResourceMembers.Resource::made).toList(); + if (creates == null && made.isEmpty() && operation != null) { + made = table.makes().getOrDefault(operation, List.of()).stream() + .filter(resource -> tagging == null || table.types().getOrDefault(tagging, resource.types()) + .contains(resource.types().getFirst())) + .toList(); + } if (creates == null && made.isEmpty()) { return List.of(); } @@ -251,7 +278,7 @@ public final class RequestResources { String under = parent.resource().substring(created.parentWord().length()); addNamed(arns, new AwsArnUtils.Arn(parent.partition(), parent.service(), parent.region(), parent.accountId(), created.childWord() + under + created.separator() + "*").toString(), - false, partition, region, accountId); + false, partition, region, accountId, null); } } return List.copyOf(arns); @@ -493,7 +520,7 @@ public final class RequestResources { .filter(value -> !isArnOf(named, value) && format.pattern().matcher(value).matches()).toList(); asArns.forEach(value -> addNamed(arns, format.checked(value), format.awsOwned(), partition, region, - accountId)); + accountId, stored)); values = values.stream().filter(value -> !asArns.contains(value)).toList(); if (values.isEmpty()) { return; @@ -523,7 +550,7 @@ public final class RequestResources { from.region().isEmpty() ? region : from.region(), from.accountId().isEmpty() ? accountId : from.accountId()), format, resource.types().getFirst(), filling.variables(), null, region), format.awsOwned(), partition, - region, accountId); + region, accountId, null); } } } @@ -657,15 +684,21 @@ public final class RequestResources { * An ARN the request names: as given, and, when it names another partition, account or Region than the * request's, as each resource of that name in the request's partition, in the ARN's account or the caller's and * the ARN's Region or the request's, whichever its handler acts on. An ARN with no account or Region keeps none, - * and one of a type AWS owns ({@code awsOwned}) its account, {@code aws}, which is no caller's. + * and one of a type AWS owns ({@code awsOwned}) its account, {@code aws}, which is no caller's. One naming another + * account whose resource {@code stored} says the service acts on there (an OAM sink a link is made to, a RAM + * invitation sent to the caller) is that resource alone. */ private static void addNamed(Set arns, String arn, boolean awsOwned, String partition, String region, - String accountId) { + String accountId, StoredResourceArns stored) { arns.add(arn); if (!AwsArnUtils.isArn(arn)) { return; } AwsArnUtils.Arn named = AwsArnUtils.parse(arn); + if (!awsOwned && stored != null && !named.accountId().isEmpty() && !named.accountId().equals(accountId) + && stored.reachedInItsAccount(arn, accountId)) { + return; + } List accounts = named.accountId().isEmpty() || awsOwned ? List.of(named.accountId()) : List.of(named.accountId(), accountId); List regions = named.region().isEmpty() ? List.of("") : List.of(named.region(), region); diff --git a/src/main/java/io/floci/aws/core/common/StoredResourceArns.java b/src/main/java/io/floci/aws/core/common/StoredResourceArns.java index eaae76f28c..ef76ede660 100644 --- a/src/main/java/io/floci/aws/core/common/StoredResourceArns.java +++ b/src/main/java/io/floci/aws/core/common/StoredResourceArns.java @@ -20,7 +20,8 @@ import java.util.Optional; * connections and API destinations; Application Auto Scaling, for its scalable targets; Redshift Data, for the * Redshift Serverless workgroups it runs statements on and the targets of its sessions; Payment Cryptography, for * the key an alias names; EMR, for the clusters of its instance groups; IAM Identity Center, for the accounts its - * permission sets are provisioned to); looked up lazily by {@code ResourceArnBuilder} through {@code Instance} + * permission sets are provisioned to; Resource Explorer, for its default view; OAM and RAM, for the sinks, + * invitations and shares of other accounts they act on); looked up lazily by {@code ResourceArnBuilder} through {@code Instance} * for the namespace a request is of, so IAM never depends on that service directly.

*/ public interface StoredResourceArns { @@ -57,6 +58,26 @@ public interface StoredResourceArns { return Optional.empty(); } + /** + * The ARN of the caller's resource of the type the service acts on in the Region for a request naming none of + * that type (the default view Resource Explorer searches with); empty when there is none, or the type is not one + * it acts on so. + */ + default Optional findDefault(String type, String region) { + return Optional.empty(); + } + + /** + * Whether an ARN naming another account than the caller's, {@code accountId}, names a resource the service holds + * in that account and acts on there, never as the caller's resource of that name (the sink an OAM link is made + * to, a RAM invitation sent to the caller or a share another account owns), so a request naming it is checked on + * that ARN alone; false when that account holds no such resource. Whether the caller may use it is the handler's + * to answer after the check. Read by the ARN alone, as it runs on every such request. + */ + default boolean reachedInItsAccount(String arn, String accountId) { + return false; + } + /** * Resolves an explicit {@code find} selector. An empty list indicates an incomplete selector, which a service * may reject before IAM evaluation. This is distinct from an ordinary name filling an ARN's variables: diff --git a/src/main/java/io/floci/aws/services/oam/OamService.java b/src/main/java/io/floci/aws/services/oam/OamService.java index 2d011b5f5f..f9242eb478 100644 --- a/src/main/java/io/floci/aws/services/oam/OamService.java +++ b/src/main/java/io/floci/aws/services/oam/OamService.java @@ -7,6 +7,7 @@ import io.floci.aws.core.common.AwsArnUtils; import io.floci.aws.core.common.AwsException; import io.floci.aws.core.common.Base64Url; import io.floci.aws.core.common.RegionResolver; +import io.floci.aws.core.common.StoredResourceArns; import io.floci.aws.core.storage.AccountAwareStorageBackend; import io.floci.aws.core.storage.StorageBackend; import io.floci.aws.core.storage.StorageFactory; @@ -23,12 +24,13 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.regex.Pattern; @ApplicationScoped -public class OamService { +public class OamService implements StoredResourceArns { private static final Pattern SINK_NAME = Pattern.compile("[A-Za-z0-9_.-]{1,255}"); private static final Set RESOURCE_TYPES = Set.of( "AWS::CloudWatch::Metric", "AWS::Logs::LogGroup", "AWS::XRay::Trace", @@ -206,14 +208,39 @@ public class OamService { } private OamSink getSinkAcrossAccounts(String arn) { + if (arnAccount(arn) == null) { + throw invalid("SinkIdentifier must be a sink ARN."); + } + return sinkAcrossAccounts(arn).orElseThrow(() -> notFound("Sink", arn)); + } + + /** The sink stored under the ARN in the account it names, which a link is made to from another account. */ + private Optional sinkAcrossAccounts(String arn) { String owner = arnAccount(arn); - if (owner == null) throw invalid("SinkIdentifier must be a sink ARN."); if (sinks instanceof AccountAwareStorageBackend aware) { @SuppressWarnings("unchecked") AccountAwareStorageBackend typed = (AccountAwareStorageBackend) aware; - return typed.getForAccount(owner, arn).orElseThrow(() -> notFound("Sink", arn)); + return typed.getForAccount(owner, arn); } - return sinks.get(arn).orElseThrow(() -> notFound("Sink", arn)); + return sinks.get(arn); + } + + @Override + public String namespace() { + return "oam"; + } + + @Override + public Optional find(String type, List names, String region) { + return Optional.empty(); + } + + /** A sink another account owns, which {@code CreateLink} finds in that account and links the caller's to. */ + @Override + public boolean reachedInItsAccount(String arn, String accountId) { + String owner = arnAccount(arn); + return owner != null && !owner.isEmpty() && !owner.equals(accountId) && arn.contains(":sink/") + && sinkAcrossAccounts(arn).isPresent(); } private Map resourceTags(String arn) { diff --git a/src/main/java/io/floci/aws/services/ram/RamService.java b/src/main/java/io/floci/aws/services/ram/RamService.java index 9afe75f53c..0bbb6e40b1 100644 --- a/src/main/java/io/floci/aws/services/ram/RamService.java +++ b/src/main/java/io/floci/aws/services/ram/RamService.java @@ -7,6 +7,7 @@ import io.floci.aws.core.common.AwsPartitions; import io.floci.aws.core.common.Base64Url; import io.floci.aws.core.common.PaginatedResult; import io.floci.aws.core.common.Pagination; +import io.floci.aws.core.common.StoredResourceArns; import io.floci.aws.core.storage.AccountAwareStorageBackend; import io.floci.aws.core.storage.StorageBackend; import io.floci.aws.core.storage.StorageFactory; @@ -55,7 +56,7 @@ import java.util.regex.Pattern; * never-created ARN gets. */ @ApplicationScoped -public class RamService { +public class RamService implements StoredResourceArns { private static final String ORGANIZATION_SHARING_KEY = "sharing-with-organization-enabled"; /** The modeled ResourceShareStatus enum. */ @@ -341,6 +342,39 @@ public class RamService { invitations.put(invitation.resourceShareInvitationArn(), invitation); } + @Override + public String namespace() { + return "ram"; + } + + @Override + public Optional find(String type, List names, String region) { + return Optional.empty(); + } + + /** + * An invitation another account sent the caller, which it accepts or rejects there, or a share another account + * owns, which RAM finds by its ARN in that account and never as the caller's: whether the caller may see it is + * for the handler to answer after the check. Each is read by its key alone, nothing scanned. + */ + @Override + public boolean reachedInItsAccount(String arn, String accountId) { + String owner = AwsArnUtils.isArn(arn) ? AwsArnUtils.parse(arn).accountId() : ""; + if (owner.isEmpty()) { + return false; + } + // An invitation is stored under the account it was sent to, a share under the one that owns it. + Optional invitation = + invitations instanceof AccountAwareStorageBackend accountAware + ? accountAware.getForAccount(accountId, arn) : invitations.get(arn); + if (invitation.filter(sent -> accountId.equals(sent.receiverAccountId())).isPresent()) { + return true; + } + Optional share = shares instanceof AccountAwareStorageBackend accountAware + ? accountAware.getForAccount(owner, arn) : shares.get(arn); + return share.filter(shared -> !"DELETED".equals(shared.getStatus())).isPresent(); + } + private List allInvitations() { if (invitations instanceof AccountAwareStorageBackend accountAware) { return accountAware.scanAllAccounts(); diff --git a/src/main/java/io/floci/aws/services/resourceexplorer2/ResourceExplorer2RequestContext.java b/src/main/java/io/floci/aws/services/resourceexplorer2/ResourceExplorer2RequestContext.java new file mode 100644 index 0000000000..56a7a2c833 --- /dev/null +++ b/src/main/java/io/floci/aws/services/resourceexplorer2/ResourceExplorer2RequestContext.java @@ -0,0 +1,33 @@ +package io.floci.aws.services.resourceexplorer2; + +import jakarta.enterprise.context.RequestScoped; + +import java.util.HashMap; +import java.util.Map; + +/** + * What this request's permission check resolved, kept for the request. + * + *

A {@code Search} or {@code ListResources} naming no view searches the Region's default view, and another + * request may associate another default while this one is running. The permission check reads the default before + * the request runs, and the request must search the view that was checked. + */ +@RequestScoped +public class ResourceExplorer2RequestContext { + + /** + * The default view the permission check found, by Region: its ARN, the ARN of the baseline view about to be + * provisioned with its id open, or an empty one for none. + */ + private final Map checkedDefaultViews = new HashMap<>(); + + /** The default view the check found in the Region, as {@link #checkedDefaultViews} holds it; null when it found none. */ + String checkedDefaultView(String region) { + return checkedDefaultViews.get(region); + } + + /** Remembers the default view the check found, so that the request searches that one and not another. */ + void pinCheckedDefaultView(String region, String viewArn) { + checkedDefaultViews.put(region, viewArn); + } +} diff --git a/src/main/java/io/floci/aws/services/resourceexplorer2/ResourceExplorer2Service.java b/src/main/java/io/floci/aws/services/resourceexplorer2/ResourceExplorer2Service.java index ed12d5a996..b9e7b4ca90 100644 --- a/src/main/java/io/floci/aws/services/resourceexplorer2/ResourceExplorer2Service.java +++ b/src/main/java/io/floci/aws/services/resourceexplorer2/ResourceExplorer2Service.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import io.floci.aws.core.common.AwsArnUtils; import io.floci.aws.core.common.AwsException; import io.floci.aws.core.common.RegionResolver; +import io.floci.aws.core.common.StoredResourceArns; import io.floci.aws.core.resource.ExplorerResource; import io.floci.aws.core.resource.ResourceProvider; import io.floci.aws.core.resource.SupportedResourceType; @@ -48,7 +49,7 @@ import java.util.function.Consumer; import java.util.regex.Pattern; @ApplicationScoped -public class ResourceExplorer2Service { +public class ResourceExplorer2Service implements StoredResourceArns { private static final Logger LOG = Logger.getLogger(ResourceExplorer2Service.class); @@ -61,6 +62,7 @@ public class ResourceExplorer2Service { private final StorageBackend defaultViewStore; /** Completed setup tasks, keyed by the TaskId GetResourceExplorerSetup reads back. */ private final StorageBackend setupTaskStore; + private final ResourceExplorer2RequestContext requestContext; /** * The maximum number of matching resources {@code Search} returns across all pages. Per the AWS @@ -88,15 +90,19 @@ public class ResourceExplorer2Service { private static final Pattern REGION_PATTERN = Pattern.compile("[a-z-]+-[a-z]+-[0-9]"); /** AWS caps AggregatorRegions at one entry, since an account has at most one aggregator index. */ private static final int MAX_AGGREGATOR_REGIONS = 1; + /** The name of the view the default region's baseline makes its default. */ + private static final String DEFAULT_VIEW_NAME = "default-view"; @Inject public ResourceExplorer2Service(Instance providers, RegionResolver regionResolver, ObjectMapper objectMapper, - StorageFactory storageFactory) { + StorageFactory storageFactory, + ResourceExplorer2RequestContext requestContext) { this.providers = providers; this.regionResolver = regionResolver; this.objectMapper = objectMapper; + this.requestContext = requestContext; this.indexStore = storageFactory.create("resourceexplorer2", "resourceexplorer2-indexes.json", new TypeReference<>() {}); @@ -132,6 +138,20 @@ public class ResourceExplorer2Service { StorageBackend viewStore, StorageBackend defaultViewStore, StorageBackend setupTaskStore) { + this(providers, regionResolver, objectMapper, indexStore, viewStore, defaultViewStore, setupTaskStore, + new ResourceExplorer2RequestContext()); + } + + /** As above, with the context of the request the service runs in. */ + ResourceExplorer2Service(Instance providers, + RegionResolver regionResolver, + ObjectMapper objectMapper, + StorageBackend indexStore, + StorageBackend viewStore, + StorageBackend defaultViewStore, + StorageBackend setupTaskStore, + ResourceExplorer2RequestContext requestContext) { + this.requestContext = requestContext; this.providers = providers; this.regionResolver = regionResolver; this.objectMapper = objectMapper; @@ -155,13 +175,13 @@ public class ResourceExplorer2Service { *

The guard keys on an ACTIVE index, not "store is empty": a restart with persisted storage * keeps the index active, so this is a no-op and an explicit DisassociateDefaultView stays in * effect. Only a genuine loss of the index (fresh boot or a reset) triggers re-provisioning. + * + *

Synchronized so concurrent first requests check and provision as one step, and provision once. */ - private void ensureDefaultRegionProvisioned() { + private synchronized void ensureDefaultRegionProvisioned() { String region = regionResolver.getDefaultRegion(); String accountId = regionResolver.getAccountId(); - boolean hasActiveDefaultRegionIndex = indexStore.scan(_ -> true).stream() - .anyMatch(i -> region.equals(i.region()) && i.state() != IndexState.DELETED); - if (hasActiveDefaultRegionIndex) { + if (defaultRegionIndexed()) { return; } String indexArn = regionResolver.buildArn("resource-explorer-2", region, @@ -172,8 +192,8 @@ public class ResourceExplorer2Service { String viewId = UUID.randomUUID().toString(); String viewArn = regionResolver.buildArn("resource-explorer-2", region, - "view/default-view/" + viewId); - View view = new View(viewArn, "default-view", accountId, + "view/" + DEFAULT_VIEW_NAME + "/" + viewId); + View view = new View(viewArn, DEFAULT_VIEW_NAME, accountId, regionResolver.buildGlobalArn("iam", accountId, "root"), null, List.of(new IncludedProperty("tags")), @@ -182,6 +202,13 @@ public class ResourceExplorer2Service { defaultViewStore.put(region, viewArn); } + /** Whether the default region has an active index, so a request provisions no baseline there. */ + private boolean defaultRegionIndexed() { + String region = regionResolver.getDefaultRegion(); + return indexStore.scan(_ -> true).stream() + .anyMatch(i -> region.equals(i.region()) && i.state() != IndexState.DELETED); + } + private static String regionOf(View view) { return AwsArnUtils.parse(view.viewArn()).region(); } @@ -457,6 +484,35 @@ public class ResourceExplorer2Service { defaultViewStore.delete(region); } + @Override + public String namespace() { + return "resource-explorer-2"; + } + + @Override + public Optional find(String type, List names, String region) { + return Optional.empty(); + } + + /** + * The Region's default view, which {@code Search} and {@code ListResources} use for a request naming no view, read + * without writing anything, since IAM asks before it decides: the one stored, or, where such a request first + * provisions the default Region's baseline, that baseline's view, its id not minted yet. The request then searches + * the view found here (see {@link #defaultViewArn}). + */ + @Override + public Optional findDefault(String type, String region) { + if (!"view".equals(type)) { + return Optional.empty(); + } + Optional stored = defaultViewStore.get(region); + Optional found = stored.isPresent() || !region.equals(regionResolver.getDefaultRegion()) + || defaultRegionIndexed() ? stored + : Optional.of(regionResolver.buildArn("resource-explorer-2", region, "view/" + DEFAULT_VIEW_NAME + "/*")); + requestContext.pinCheckedDefaultView(region, found.orElse("")); + return found; + } + public String getDefaultView(String region) { ensureDefaultRegionProvisioned(); return defaultViewStore.get(region).orElse(null); @@ -983,7 +1039,7 @@ public class ResourceExplorer2Service { private View resolveView(String viewArn, String region) { ensureDefaultRegionProvisioned(); - String arn = (viewArn != null) ? viewArn : defaultViewStore.get(region).orElse(null); + String arn = (viewArn != null) ? viewArn : defaultViewArn(region); if (arn == null) { throw new AwsException("UnauthorizedException", "No default view is configured for region " + region @@ -994,6 +1050,23 @@ public class ResourceExplorer2Service { "View not found: " + arn, 404)); } + /** + * The Region's default view this request searches: the one its permission check found, when it checked one, since + * another request may associate another default in between; the baseline view provisioned since, when the check + * found it about to be; the one stored otherwise. Null for none. + */ + private String defaultViewArn(String region) { + String stored = defaultViewStore.get(region).orElse(null); + String checked = requestContext.checkedDefaultView(region); + if (checked == null) { + return stored; + } + if (checked.endsWith("/*")) { + return stored != null && stored.startsWith(checked.substring(0, checked.length() - 1)) ? stored : null; + } + return checked.isEmpty() ? null : checked; + } + private static int decodeNextToken(String token) { if (token == null) { return 0; diff --git a/src/main/resources/aws/iam-request-resources.json b/src/main/resources/aws/iam-request-resources.json index 86b74137ee..0f05363c3a 100644 --- a/src/main/resources/aws/iam-request-resources.json +++ b/src/main/resources/aws/iam-request-resources.json @@ -68,7 +68,7 @@ "account:VerifyPhoneNumber": {"action": "account:VerifyPhoneNumber", "types": ["account", "accountInOrganization"], "resources": [{"type": "account", "fill": {}, "when": {"AccountId": [null]}}, {"type": "accountInOrganization", "fill": {"MemberAccountId": "AccountId"}}]}, "acm:AddTagsToCertificate": {"action": "acm:AddTagsToCertificate", "types": ["certificate"], "resources": [{"types": ["certificate"], "arn": "CertificateArn"}]}, "acm:CreateAcmeDomainValidation": {"action": "acm:CreateAcmeDomainValidation", "types": ["acme-endpoint"], "resources": [{"types": ["acme-endpoint"], "arn": "AcmeEndpointArn"}]}, - "acm:CreateAcmeEndpoint": {"action": "acm:CreateAcmeEndpoint", "types": [], "resources": []}, + "acm:CreateAcmeEndpoint": {"action": "acm:CreateAcmeEndpoint", "types": [], "resources": [], "makes": [{"type": "acme-endpoint", "fill": {}}]}, "acm:CreateAcmeExternalAccountBinding": {"action": "acm:CreateAcmeExternalAccountBinding", "types": ["acme-endpoint"], "resources": [{"types": ["acme-endpoint"], "arn": "AcmeEndpointArn"}, {"types": ["acme-endpoint"], "arn": "RoleArn"}]}, "acm:DeleteAcmeDomainValidation": {"action": "acm:DeleteAcmeDomainValidation", "types": ["acme-domain-validation"], "resources": [{"types": ["acme-domain-validation"], "arn": "AcmeDomainValidationArn"}]}, "acm:DeleteAcmeEndpoint": {"action": "acm:DeleteAcmeEndpoint", "types": ["acme-endpoint"], "resources": [{"types": ["acme-endpoint"], "arn": "AcmeEndpointArn"}]}, @@ -83,7 +83,7 @@ "acm:GetAccountConfiguration": {"action": "acm:GetAccountConfiguration", "types": [], "resources": []}, "acm:GetAcmeExternalAccountBindingCredentials": {"action": "acm:GetAcmeExternalAccountBindingCredentials", "types": ["acme-external-account-binding"], "resources": [{"types": ["acme-external-account-binding"], "arn": "AcmeExternalAccountBindingArn"}]}, "acm:GetCertificate": {"action": "acm:GetCertificate", "types": ["certificate"], "resources": [{"types": ["certificate"], "arn": "CertificateArn"}]}, - "acm:ImportCertificate": {"action": "acm:ImportCertificate", "types": ["certificate"], "resources": [{"types": ["certificate"], "arn": "CertificateArn"}]}, + "acm:ImportCertificate": {"action": "acm:ImportCertificate", "types": ["certificate"], "resources": [{"types": ["certificate"], "arn": "CertificateArn"}, {"type": "certificate", "fill": {}, "when": {"CertificateArn": [null]}, "default": true}]}, "acm:ListAcmeAccounts": {"action": "acm:ListAcmeAccounts", "types": ["acme-endpoint"], "resources": [{"types": ["acme-endpoint"], "arn": "AcmeEndpointArn"}]}, "acm:ListAcmeDomainValidations": {"action": "acm:ListAcmeDomainValidations", "types": ["acme-endpoint"], "resources": [{"types": ["acme-endpoint"], "arn": "AcmeEndpointArn"}]}, "acm:ListAcmeEndpoints": {"action": "acm:ListAcmeEndpoints", "types": [], "resources": []}, @@ -95,7 +95,7 @@ "acm:PutAccountConfiguration": {"action": "acm:PutAccountConfiguration", "types": [], "resources": []}, "acm:RemoveTagsFromCertificate": {"action": "acm:RemoveTagsFromCertificate", "types": ["certificate"], "resources": [{"types": ["certificate"], "arn": "CertificateArn"}]}, "acm:RenewCertificate": {"action": "acm:RenewCertificate", "types": ["certificate"], "resources": [{"types": ["certificate"], "arn": "CertificateArn"}]}, - "acm:RequestCertificate": {"action": "acm:RequestCertificate", "types": [], "resources": []}, + "acm:RequestCertificate": {"action": "acm:RequestCertificate", "types": [], "resources": [], "makes": [{"type": "certificate", "fill": {}}]}, "acm:ResendValidationEmail": {"action": "acm:ResendValidationEmail", "types": ["certificate"], "resources": [{"types": ["certificate"], "arn": "CertificateArn"}]}, "acm:RevokeAcmeAccount": {"action": "acm:RevokeAcmeAccount", "types": ["acme-endpoint"], "resources": [{"types": ["acme-endpoint"], "arn": "AcmeEndpointArn"}]}, "acm:RevokeAcmeExternalAccountBinding": {"action": "acm:RevokeAcmeExternalAccountBinding", "types": ["acme-external-account-binding"], "resources": [{"types": ["acme-external-account-binding"], "arn": "AcmeExternalAccountBindingArn"}]}, @@ -217,8 +217,8 @@ "bcm-pricing-calculator:BatchUpdateBillScenarioUsageModification": {"action": "bcm-pricing-calculator:UpdateBillScenarioUsageModification", "types": ["bill-scenario"], "resources": [{"type": "bill-scenario", "fill": {"BillScenarioId": "billScenarioId"}}]}, "bcm-pricing-calculator:BatchUpdateWorkloadEstimateUsage": {"action": "bcm-pricing-calculator:UpdateWorkloadEstimateUsage", "types": ["workload-estimate"], "resources": [{"type": "workload-estimate", "fill": {"WorkloadEstimateId": "workloadEstimateId"}}]}, "bcm-pricing-calculator:CreateBillEstimate": {"action": "bcm-pricing-calculator:CreateBillEstimate", "types": ["bill-scenario"], "resources": [{"type": "bill-scenario", "fill": {"BillScenarioId": "billScenarioId"}}]}, - "bcm-pricing-calculator:CreateBillScenario": {"action": "bcm-pricing-calculator:CreateBillScenario", "types": [], "resources": []}, - "bcm-pricing-calculator:CreateWorkloadEstimate": {"action": "bcm-pricing-calculator:CreateWorkloadEstimate", "types": [], "resources": []}, + "bcm-pricing-calculator:CreateBillScenario": {"action": "bcm-pricing-calculator:CreateBillScenario", "types": [], "resources": [], "makes": [{"type": "bill-scenario", "fill": {}}]}, + "bcm-pricing-calculator:CreateWorkloadEstimate": {"action": "bcm-pricing-calculator:CreateWorkloadEstimate", "types": [], "resources": [], "makes": [{"type": "workload-estimate", "fill": {}}]}, "bcm-pricing-calculator:DeleteBillEstimate": {"action": "bcm-pricing-calculator:DeleteBillEstimate", "types": ["bill-estimate"], "resources": [{"type": "bill-estimate", "fill": {"BillEstimateId": "identifier"}}]}, "bcm-pricing-calculator:DeleteBillScenario": {"action": "bcm-pricing-calculator:DeleteBillScenario", "types": ["bill-scenario"], "resources": [{"type": "bill-scenario", "fill": {"BillScenarioId": "identifier"}}]}, "bcm-pricing-calculator:DeleteWorkloadEstimate": {"action": "bcm-pricing-calculator:DeleteWorkloadEstimate", "types": ["workload-estimate"], "resources": [{"type": "workload-estimate", "fill": {"WorkloadEstimateId": "identifier"}}]}, @@ -269,14 +269,14 @@ "budgets:UpdateBudgetAction": {"action": "budgets:UpdateBudgetAction", "types": ["budgetAction"], "resources": [{"types": ["budgetAction"], "arn": "ExecutionRoleArn"}, {"type": "budgetAction", "fill": {"ActionId": "ActionId", "BudgetName": "BudgetName"}, "account": "AccountId"}]}, "budgets:UpdateNotification": {"action": "budgets:ModifyBudget", "types": ["budget"], "resources": [{"type": "budget", "fill": {"BudgetName": "BudgetName"}, "account": "AccountId"}]}, "budgets:UpdateSubscriber": {"action": "budgets:ModifyBudget", "types": ["budget"], "resources": [{"type": "budget", "fill": {"BudgetName": "BudgetName"}, "account": "AccountId"}]}, - "ce:CreateAnomalyMonitor": {"action": "ce:CreateAnomalyMonitor", "types": [], "resources": []}, - "ce:CreateAnomalySubscription": {"action": "ce:CreateAnomalySubscription", "types": [], "resources": []}, + "ce:CreateAnomalyMonitor": {"action": "ce:CreateAnomalyMonitor", "types": [], "resources": [], "makes": [{"type": "anomalymonitor", "fill": {}}]}, + "ce:CreateAnomalySubscription": {"action": "ce:CreateAnomalySubscription", "types": [], "resources": [], "makes": [{"type": "anomalysubscription", "fill": {}}]}, "ce:CreateCostCategoryDefinition": {"action": "ce:CreateCostCategoryDefinition", "types": [], "resources": []}, "ce:DeleteAnomalyMonitor": {"action": "ce:DeleteAnomalyMonitor", "types": ["anomalymonitor"], "resources": [{"types": ["anomalymonitor"], "arn": "MonitorArn"}]}, "ce:DeleteAnomalySubscription": {"action": "ce:DeleteAnomalySubscription", "types": ["anomalysubscription"], "resources": [{"types": ["anomalysubscription"], "arn": "SubscriptionArn"}]}, "ce:DeleteCostCategoryDefinition": {"action": "ce:DeleteCostCategoryDefinition", "types": ["costcategory"], "resources": [{"types": ["costcategory"], "arn": "CostCategoryArn"}]}, "ce:DescribeCostCategoryDefinition": {"action": "ce:DescribeCostCategoryDefinition", "types": ["costcategory"], "resources": [{"types": ["costcategory"], "arn": "CostCategoryArn"}]}, - "ce:GetAnomalies": {"action": "ce:GetAnomalies", "types": ["anomalymonitor"], "resources": [{"types": ["anomalymonitor"], "arn": "MonitorArn"}]}, + "ce:GetAnomalies": {"action": "ce:GetAnomalies", "types": ["anomalymonitor"], "resources": [{"types": ["anomalymonitor"], "arn": "MonitorArn"}, {"type": "anomalymonitor", "fill": {}, "when": {"MonitorArn": [null]}, "default": true}]}, "ce:GetAnomalyMonitors": {"action": "ce:GetAnomalyMonitors", "types": ["anomalymonitor"], "resources": [{"types": ["anomalymonitor"], "arn": "MonitorArnList[]"}]}, "ce:GetAnomalySubscriptions": {"action": "ce:GetAnomalySubscriptions", "types": ["anomalysubscription"], "resources": [{"types": ["anomalysubscription"], "arn": "SubscriptionArnList[]"}]}, "ce:GetApproximateUsageRecords": {"action": "ce:GetApproximateUsageRecords", "types": [], "resources": []}, @@ -326,32 +326,32 @@ "cloudfront:AssociateDistributionTenantWebACL": {"action": "cloudfront:AssociateDistributionTenantWebACL", "types": ["distribution-tenant"], "resources": [{"type": "distribution-tenant", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}}, "cloudfront:AssociateDistributionWebACL": {"action": "cloudfront:AssociateDistributionWebACL", "types": ["distribution"], "resources": [{"type": "distribution", "fill": {"DistributionId": "Id"}}], "located": {"Id": "{Id}"}}, "cloudfront:CopyDistribution": {"action": "cloudfront:CopyDistribution", "types": ["distribution"], "resources": [{"type": "distribution", "fill": {"DistributionId": "PrimaryDistributionId"}}], "located": {"PrimaryDistributionId": "{PrimaryDistributionId}"}}, - "cloudfront:CreateAnycastIpList": {"action": "cloudfront:CreateAnycastIpList", "types": [], "resources": []}, - "cloudfront:CreateCachePolicy": {"action": "cloudfront:CreateCachePolicy", "types": [], "resources": []}, - "cloudfront:CreateCloudFrontOriginAccessIdentity": {"action": "cloudfront:CreateCloudFrontOriginAccessIdentity", "types": [], "resources": []}, - "cloudfront:CreateConnectionFunction": {"action": "cloudfront:CreateConnectionFunction", "types": [], "resources": []}, - "cloudfront:CreateConnectionGroup": {"action": "cloudfront:CreateConnectionGroup", "types": [], "resources": []}, - "cloudfront:CreateContinuousDeploymentPolicy": {"action": "cloudfront:CreateContinuousDeploymentPolicy", "types": [], "resources": []}, - "cloudfront:CreateDistribution": {"action": "cloudfront:CreateDistribution", "types": [], "resources": []}, - "cloudfront:CreateDistributionTenant": {"action": "cloudfront:CreateDistributionTenant", "types": [], "resources": []}, + "cloudfront:CreateAnycastIpList": {"action": "cloudfront:CreateAnycastIpList", "types": [], "resources": [], "makes": [{"type": "anycast-ip-list", "fill": {}}]}, + "cloudfront:CreateCachePolicy": {"action": "cloudfront:CreateCachePolicy", "types": [], "resources": [], "makes": [{"type": "cache-policy", "fill": {}}]}, + "cloudfront:CreateCloudFrontOriginAccessIdentity": {"action": "cloudfront:CreateCloudFrontOriginAccessIdentity", "types": [], "resources": [], "makes": [{"type": "origin-access-identity", "fill": {}}]}, + "cloudfront:CreateConnectionFunction": {"action": "cloudfront:CreateConnectionFunction", "types": [], "resources": [], "makes": [{"type": "connection-function", "fill": {}}]}, + "cloudfront:CreateConnectionGroup": {"action": "cloudfront:CreateConnectionGroup", "types": [], "resources": [], "makes": [{"type": "connection-group", "fill": {}}]}, + "cloudfront:CreateContinuousDeploymentPolicy": {"action": "cloudfront:CreateContinuousDeploymentPolicy", "types": [], "resources": [], "makes": [{"type": "continuous-deployment-policy", "fill": {}}]}, + "cloudfront:CreateDistribution": {"action": "cloudfront:CreateDistribution", "types": [], "resources": [], "makes": [{"type": "distribution", "fill": {}}]}, + "cloudfront:CreateDistributionTenant": {"action": "cloudfront:CreateDistributionTenant", "types": [], "resources": [], "makes": [{"type": "distribution-tenant", "fill": {}}]}, "cloudfront:CreateDistributionWithTags": {"action": "cloudfront:CreateDistribution", "types": [], "resources": []}, - "cloudfront:CreateFieldLevelEncryptionConfig": {"action": "cloudfront:CreateFieldLevelEncryptionConfig", "types": [], "resources": []}, - "cloudfront:CreateFieldLevelEncryptionProfile": {"action": "cloudfront:CreateFieldLevelEncryptionProfile", "types": [], "resources": []}, - "cloudfront:CreateFunction": {"action": "cloudfront:CreateFunction", "types": [], "resources": []}, + "cloudfront:CreateFieldLevelEncryptionConfig": {"action": "cloudfront:CreateFieldLevelEncryptionConfig", "types": [], "resources": [], "makes": [{"type": "field-level-encryption-config", "fill": {}}]}, + "cloudfront:CreateFieldLevelEncryptionProfile": {"action": "cloudfront:CreateFieldLevelEncryptionProfile", "types": [], "resources": [], "makes": [{"type": "field-level-encryption-profile", "fill": {}}]}, + "cloudfront:CreateFunction": {"action": "cloudfront:CreateFunction", "types": [], "resources": [], "makes": [{"type": "function", "fill": {}}]}, "cloudfront:CreateInvalidation": {"action": "cloudfront:CreateInvalidation", "types": ["distribution"], "resources": [{"type": "distribution", "fill": {"DistributionId": "DistributionId"}}], "located": {"DistributionId": "{DistributionId}"}}, "cloudfront:CreateInvalidationForDistributionTenant": {"action": "cloudfront:CreateInvalidationForDistributionTenant", "types": ["distribution-tenant"], "resources": [{"type": "distribution-tenant", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}}, "cloudfront:CreateKeyGroup": {"action": "cloudfront:CreateKeyGroup", "types": [], "resources": []}, - "cloudfront:CreateKeyValueStore": {"action": "cloudfront:CreateKeyValueStore", "types": [], "resources": []}, + "cloudfront:CreateKeyValueStore": {"action": "cloudfront:CreateKeyValueStore", "types": [], "resources": [], "makes": [{"type": "key-value-store", "fill": {}}]}, "cloudfront:CreateMonitoringSubscription": {"action": "cloudfront:CreateMonitoringSubscription", "types": [], "resources": []}, - "cloudfront:CreateOriginAccessControl": {"action": "cloudfront:CreateOriginAccessControl", "types": [], "resources": []}, - "cloudfront:CreateOriginRequestPolicy": {"action": "cloudfront:CreateOriginRequestPolicy", "types": [], "resources": []}, + "cloudfront:CreateOriginAccessControl": {"action": "cloudfront:CreateOriginAccessControl", "types": [], "resources": [], "makes": [{"type": "origin-access-control", "fill": {}}]}, + "cloudfront:CreateOriginRequestPolicy": {"action": "cloudfront:CreateOriginRequestPolicy", "types": [], "resources": [], "makes": [{"type": "origin-request-policy", "fill": {}}]}, "cloudfront:CreatePublicKey": {"action": "cloudfront:CreatePublicKey", "types": [], "resources": []}, - "cloudfront:CreateRealtimeLogConfig": {"action": "cloudfront:CreateRealtimeLogConfig", "types": [], "resources": []}, - "cloudfront:CreateResponseHeadersPolicy": {"action": "cloudfront:CreateResponseHeadersPolicy", "types": [], "resources": []}, - "cloudfront:CreateStreamingDistribution": {"action": "cloudfront:CreateStreamingDistribution", "types": [], "resources": []}, + "cloudfront:CreateRealtimeLogConfig": {"action": "cloudfront:CreateRealtimeLogConfig", "types": [], "resources": [], "makes": [{"type": "realtime-log-config", "fill": {}}]}, + "cloudfront:CreateResponseHeadersPolicy": {"action": "cloudfront:CreateResponseHeadersPolicy", "types": [], "resources": [], "makes": [{"type": "response-headers-policy", "fill": {}}]}, + "cloudfront:CreateStreamingDistribution": {"action": "cloudfront:CreateStreamingDistribution", "types": [], "resources": [], "makes": [{"type": "streaming-distribution", "fill": {}}]}, "cloudfront:CreateStreamingDistributionWithTags": {"action": "cloudfront:CreateStreamingDistributionWithTags", "types": [], "resources": []}, - "cloudfront:CreateTrustStore": {"action": "cloudfront:CreateTrustStore", "types": [], "resources": []}, - "cloudfront:CreateVpcOrigin": {"action": "cloudfront:CreateVpcOrigin", "types": [], "resources": []}, + "cloudfront:CreateTrustStore": {"action": "cloudfront:CreateTrustStore", "types": [], "resources": [], "makes": [{"type": "trust-store", "fill": {}}]}, + "cloudfront:CreateVpcOrigin": {"action": "cloudfront:CreateVpcOrigin", "types": [], "resources": [], "makes": [{"type": "vpcorigin", "fill": {}}]}, "cloudfront:DeleteAnycastIpList": {"action": "cloudfront:DeleteAnycastIpList", "types": ["anycast-ip-list"], "resources": [{"type": "anycast-ip-list", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}}, "cloudfront:DeleteCachePolicy": {"action": "cloudfront:DeleteCachePolicy", "types": ["cache-policy"], "resources": [{"type": "cache-policy", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}}, "cloudfront:DeleteCloudFrontOriginAccessIdentity": {"action": "cloudfront:DeleteCloudFrontOriginAccessIdentity", "types": ["origin-access-identity"], "resources": [{"type": "origin-access-identity", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}}, @@ -653,7 +653,7 @@ "codepipeline:UntagResource": {"action": "codepipeline:UntagResource", "types": ["actiontype", "pipeline", "webhook"], "resources": [{"types": ["actiontype", "pipeline", "webhook"], "arn": "resourceArn"}]}, "codepipeline:UpdateActionType": {"action": "codepipeline:UpdateActionType", "types": ["actiontype"], "resources": []}, "codepipeline:UpdatePipeline": {"action": "codepipeline:UpdatePipeline", "types": ["pipeline"], "resources": [{"type": "pipeline", "fill": {"PipelineName": "pipeline.name"}}]}, - "cognito-identity:CreateIdentityPool": {"action": "cognito-identity:CreateIdentityPool", "types": [], "resources": []}, + "cognito-identity:CreateIdentityPool": {"action": "cognito-identity:CreateIdentityPool", "types": [], "resources": [], "makes": [{"type": "identitypool", "fill": {}}]}, "cognito-identity:DeleteIdentities": {"action": "cognito-identity:DeleteIdentities", "types": [], "resources": []}, "cognito-identity:DeleteIdentityPool": {"action": "cognito-identity:DeleteIdentityPool", "types": ["identitypool"], "resources": [{"type": "identitypool", "fill": {"IdentityPoolId": "IdentityPoolId"}}]}, "cognito-identity:DescribeIdentity": {"action": "cognito-identity:DescribeIdentity", "types": [], "resources": []}, @@ -720,7 +720,7 @@ "cognito-idp:CreateResourceServer": {"action": "cognito-idp:CreateResourceServer", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:CreateTerms": {"action": "cognito-idp:CreateTerms", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:CreateUserImportJob": {"action": "cognito-idp:CreateUserImportJob", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "CloudWatchLogsRoleArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, - "cognito-idp:CreateUserPool": {"action": "cognito-idp:CreateUserPool", "types": [], "resources": []}, + "cognito-idp:CreateUserPool": {"action": "cognito-idp:CreateUserPool", "types": [], "resources": [], "makes": [{"type": "userpool", "fill": {}}]}, "cognito-idp:CreateUserPoolClient": {"action": "cognito-idp:CreateUserPoolClient", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "AnalyticsConfiguration.ApplicationArn"}, {"types": ["userpool"], "arn": "AnalyticsConfiguration.RoleArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:CreateUserPoolDomain": {"action": "cognito-idp:CreateUserPoolDomain", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "CustomDomainConfig.CertificateArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:CreateUserPoolReplica": {"action": "cognito-idp:CreateUserPoolReplica", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, @@ -822,10 +822,10 @@ "controlcatalog:ListControls": {"action": "controlcatalog:ListControls", "types": ["control"], "resources": []}, "controlcatalog:ListDomains": {"action": "controlcatalog:ListDomains", "types": [], "resources": []}, "controlcatalog:ListObjectives": {"action": "controlcatalog:ListObjectives", "types": [], "resources": []}, - "controltower:CreateLandingZone": {"action": "controltower:CreateLandingZone", "types": [], "resources": []}, + "controltower:CreateLandingZone": {"action": "controltower:CreateLandingZone", "types": [], "resources": [], "makes": [{"type": "LandingZone", "fill": {}}]}, "controltower:DeleteLandingZone": {"action": "controltower:DeleteLandingZone", "types": ["LandingZone"], "resources": [{"type": "LandingZone", "fill": {"LandingZoneId": "landingZoneIdentifier"}}]}, "controltower:DisableBaseline": {"action": "controltower:DisableBaseline", "types": ["EnabledBaseline"], "resources": [{"types": ["EnabledBaseline"], "arn": "enabledBaselineIdentifier"}]}, - "controltower:DisableControl": {"action": "controltower:DisableControl", "types": ["EnabledControl"], "resources": [{"types": ["EnabledControl"], "arn": "controlIdentifier"}, {"types": ["EnabledControl"], "arn": "enabledControlIdentifier"}, {"types": ["EnabledControl"], "arn": "targetIdentifier"}]}, + "controltower:DisableControl": {"action": "controltower:DisableControl", "types": ["EnabledControl"], "resources": [{"types": ["EnabledControl"], "arn": "controlIdentifier"}, {"types": ["EnabledControl"], "arn": "enabledControlIdentifier"}, {"types": ["EnabledControl"], "arn": "targetIdentifier"}, {"type": "EnabledControl", "fill": {}, "when": {"controlIdentifier": [null]}, "default": true}]}, "controltower:EnableBaseline": {"action": "controltower:EnableBaseline", "types": [], "resources": []}, "controltower:EnableControl": {"action": "controltower:EnableControl", "types": ["EnabledControl"], "resources": [{"types": ["EnabledControl"], "arn": "controlIdentifier"}, {"types": ["EnabledControl"], "arn": "targetIdentifier"}, {"type": "EnabledControl", "fill": {}}]}, "controltower:GetBaseline": {"action": "controltower:GetBaseline", "types": ["Baseline"], "resources": [{"types": ["Baseline"], "arn": "baselineIdentifier"}]}, @@ -858,7 +858,7 @@ "cur:TagResource": {"action": "cur:TagResource", "types": ["cur"], "resources": [{"type": "cur", "fill": {"ReportName": "ReportName"}}]}, "cur:UntagResource": {"action": "cur:UntagResource", "types": ["cur"], "resources": [{"type": "cur", "fill": {"ReportName": "ReportName"}}]}, "datasync:CancelTaskExecution": {"action": "datasync:CancelTaskExecution", "types": ["taskexecution"], "resources": [{"types": ["taskexecution"], "arn": "TaskExecutionArn"}]}, - "datasync:CreateAgent": {"action": "datasync:CreateAgent", "types": [], "resources": []}, + "datasync:CreateAgent": {"action": "datasync:CreateAgent", "types": [], "resources": [], "makes": [{"type": "agent", "fill": {}}]}, "datasync:CreateLocationAzureBlob": {"action": "datasync:CreateLocationAzureBlob", "types": ["agent"], "resources": [{"types": ["agent"], "arn": "AgentArns[]"}, {"types": ["agent"], "arn": "CmkSecretConfig.KmsKeyArn"}, {"types": ["agent"], "arn": "CmkSecretConfig.SecretArn"}, {"types": ["agent"], "arn": "CustomSecretConfig.SecretAccessRoleArn"}, {"types": ["agent"], "arn": "CustomSecretConfig.SecretArn"}]}, "datasync:CreateLocationEfs": {"action": "datasync:CreateLocationEfs", "types": [], "resources": []}, "datasync:CreateLocationFsxLustre": {"action": "datasync:CreateLocationFsxLustre", "types": [], "resources": []}, @@ -1866,7 +1866,7 @@ "elasticmapreduce:CancelSteps": {"action": "elasticmapreduce:CancelSteps", "types": ["cluster"], "resources": [{"type": "cluster", "fill": {"ClusterId": "ClusterId"}}]}, "elasticmapreduce:CreatePersistentAppUI": {"action": "elasticmapreduce:CreatePersistentAppUI", "types": ["cluster"], "resources": [{"types": ["cluster"], "arn": "TargetResourceArn"}]}, "elasticmapreduce:CreateSecurityConfiguration": {"action": "elasticmapreduce:CreateSecurityConfiguration", "types": [], "resources": []}, - "elasticmapreduce:CreateStudio": {"action": "elasticmapreduce:CreateStudio", "types": [], "resources": []}, + "elasticmapreduce:CreateStudio": {"action": "elasticmapreduce:CreateStudio", "types": [], "resources": [], "makes": [{"type": "studio", "fill": {}}]}, "elasticmapreduce:CreateStudioSessionMapping": {"action": "elasticmapreduce:CreateStudioSessionMapping", "types": ["studio"], "resources": [{"types": ["studio"], "arn": "SessionPolicyArn"}, {"type": "studio", "fill": {"StudioId": "StudioId"}}]}, "elasticmapreduce:DeleteSecurityConfiguration": {"action": "elasticmapreduce:DeleteSecurityConfiguration", "types": [], "resources": []}, "elasticmapreduce:DeleteStudio": {"action": "elasticmapreduce:DeleteStudio", "types": ["studio"], "resources": [{"type": "studio", "fill": {"StudioId": "StudioId"}}]}, @@ -1925,7 +1925,7 @@ "elasticmapreduce:UpdateStudio": {"action": "elasticmapreduce:UpdateStudio", "types": ["studio"], "resources": [{"types": ["studio"], "arn": "EncryptionKeyArn"}, {"type": "studio", "fill": {"StudioId": "StudioId"}}]}, "elasticmapreduce:UpdateStudioSessionMapping": {"action": "elasticmapreduce:UpdateStudioSessionMapping", "types": ["studio"], "resources": [{"types": ["studio"], "arn": "SessionPolicyArn"}, {"type": "studio", "fill": {"StudioId": "StudioId"}}]}, "emr-serverless:CancelJobRun": {"action": "emr-serverless:CancelJobRun", "types": ["jobRun"], "resources": [{"type": "jobRun", "fill": {"ApplicationId": "applicationId", "JobRunId": "jobRunId"}}], "located": {"applicationId": "{applicationId}", "jobRunId": "{jobRunId}"}}, - "emr-serverless:CreateApplication": {"action": "emr-serverless:CreateApplication", "types": [], "resources": []}, + "emr-serverless:CreateApplication": {"action": "emr-serverless:CreateApplication", "types": [], "resources": [], "makes": [{"type": "application", "fill": {}}]}, "emr-serverless:DeleteApplication": {"action": "emr-serverless:DeleteApplication", "types": ["application"], "resources": [{"type": "application", "fill": {"ApplicationId": "applicationId"}}], "located": {"applicationId": "{applicationId}"}}, "emr-serverless:GetApplication": {"action": "emr-serverless:GetApplication", "types": ["application"], "resources": [{"type": "application", "fill": {"ApplicationId": "applicationId"}}], "located": {"applicationId": "{applicationId}"}}, "emr-serverless:GetDashboardForJobRun": {"action": "emr-serverless:GetDashboardForJobRun", "types": ["jobRun"], "resources": [{"type": "jobRun", "fill": {"ApplicationId": "applicationId", "JobRunId": "jobRunId"}}], "located": {"applicationId": "{applicationId}", "jobRunId": "{jobRunId}"}}, @@ -1958,7 +1958,7 @@ "es:CancelDomainConfigChange": {"action": "es:CancelDomainConfigChange", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}}, "es:CancelElasticsearchServiceSoftwareUpdate": {"action": "es:CancelElasticsearchServiceSoftwareUpdate", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]}, "es:CancelServiceSoftwareUpdate": {"action": "es:CancelServiceSoftwareUpdate", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]}, - "es:CreateApplication": {"action": "es:CreateApplication", "types": [], "resources": []}, + "es:CreateApplication": {"action": "es:CreateApplication", "types": [], "resources": [], "makes": [{"type": "application", "fill": {}}]}, "es:CreateDomain": {"action": "es:CreateDomain", "types": ["domain"], "resources": [{"types": ["domain"], "arn": "CognitoOptions.RoleArn"}, {"types": ["domain"], "arn": "DomainEndpointOptions.CustomEndpointCertificateArn"}, {"types": ["domain"], "arn": "IdentityCenterOptions.IdentityCenterInstanceARN"}, {"type": "domain", "fill": {"DomainName": "DomainName"}}]}, "es:CreateElasticsearchDomain": {"action": "es:CreateElasticsearchDomain", "types": ["domain"], "resources": [{"types": ["domain"], "arn": "CognitoOptions.RoleArn"}, {"types": ["domain"], "arn": "DomainEndpointOptions.CustomEndpointCertificateArn"}, {"type": "domain", "fill": {"DomainName": "DomainName"}}]}, "es:CreateIndex": {"action": "es:CreateIndex", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}}, @@ -2150,7 +2150,7 @@ "firehose:TagDeliveryStream": {"action": "firehose:TagDeliveryStream", "types": ["deliverystream"], "resources": [{"type": "deliverystream", "fill": {"DeliveryStreamName": "DeliveryStreamName"}}]}, "firehose:UntagDeliveryStream": {"action": "firehose:UntagDeliveryStream", "types": ["deliverystream"], "resources": [{"type": "deliverystream", "fill": {"DeliveryStreamName": "DeliveryStreamName"}}]}, "firehose:UpdateDestination": {"action": "firehose:UpdateDestination", "types": ["deliverystream"], "resources": [{"types": ["deliverystream"], "arn": "AmazonOpenSearchServerlessDestinationUpdate.RoleARN"}, {"types": ["deliverystream"], "arn": "AmazonopensearchserviceDestinationUpdate.DomainARN"}, {"types": ["deliverystream"], "arn": "AmazonopensearchserviceDestinationUpdate.RoleARN"}, {"types": ["deliverystream"], "arn": "ElasticsearchDestinationUpdate.DomainARN"}, {"types": ["deliverystream"], "arn": "ElasticsearchDestinationUpdate.RoleARN"}, {"types": ["deliverystream"], "arn": "ExtendedS3DestinationUpdate.BucketARN"}, {"types": ["deliverystream"], "arn": "ExtendedS3DestinationUpdate.RoleARN"}, {"types": ["deliverystream"], "arn": "HttpEndpointDestinationUpdate.RoleARN"}, {"types": ["deliverystream"], "arn": "IcebergDestinationUpdate.RoleARN"}, {"types": ["deliverystream"], "arn": "RedshiftDestinationUpdate.RoleARN"}, {"types": ["deliverystream"], "arn": "S3DestinationUpdate.BucketARN"}, {"types": ["deliverystream"], "arn": "S3DestinationUpdate.RoleARN"}, {"types": ["deliverystream"], "arn": "SnowflakeDestinationUpdate.RoleARN"}, {"type": "deliverystream", "fill": {"DeliveryStreamName": "DeliveryStreamName"}}]}, - "fis:CreateExperimentTemplate": {"action": "fis:CreateExperimentTemplate", "types": ["action", "experiment-template"], "resources": [{"types": ["action", "experiment-template"], "arn": "roleArn"}, {"type": "experiment-template", "fill": {}, "made": true}]}, + "fis:CreateExperimentTemplate": {"action": "fis:CreateExperimentTemplate", "types": ["action", "experiment-template"], "resources": [{"types": ["action", "experiment-template"], "arn": "roleArn"}, {"type": "experiment-template", "fill": {}, "made": true}, {"type": "action", "fill": {"Id": "actions{}.actionId"}}]}, "fis:CreateTargetAccountConfiguration": {"action": "fis:CreateTargetAccountConfiguration", "types": ["experiment-template"], "resources": [{"types": ["experiment-template"], "arn": "roleArn"}, {"type": "experiment-template", "fill": {"Id": "experimentTemplateId"}}], "located": {"experimentTemplateId": "{id}"}}, "fis:DeleteExperimentTemplate": {"action": "fis:DeleteExperimentTemplate", "types": ["experiment-template"], "resources": [{"type": "experiment-template", "fill": {"Id": "id"}}], "located": {"id": "{id}"}}, "fis:DeleteTargetAccountConfiguration": {"action": "fis:DeleteTargetAccountConfiguration", "types": ["experiment-template"], "resources": [{"type": "experiment-template", "fill": {"Id": "experimentTemplateId"}}], "located": {"experimentTemplateId": "{id}"}}, @@ -2173,16 +2173,16 @@ "fis:StopExperiment": {"action": "fis:StopExperiment", "types": ["experiment"], "resources": [{"type": "experiment", "fill": {"Id": "id"}}], "located": {"id": "{id}"}}, "fis:TagResource": {"action": "fis:TagResource", "types": ["action", "experiment", "experiment-template"], "resources": [{"types": ["action", "experiment", "experiment-template"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}}, "fis:UntagResource": {"action": "fis:UntagResource", "types": ["action", "experiment", "experiment-template"], "resources": [{"types": ["action", "experiment", "experiment-template"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}}, - "fis:UpdateExperimentTemplate": {"action": "fis:UpdateExperimentTemplate", "types": ["action", "experiment-template"], "resources": [{"types": ["action", "experiment-template"], "arn": "roleArn"}, {"type": "experiment-template", "fill": {"Id": "id"}}], "located": {"id": "{id}"}}, + "fis:UpdateExperimentTemplate": {"action": "fis:UpdateExperimentTemplate", "types": ["action", "experiment-template"], "resources": [{"types": ["action", "experiment-template"], "arn": "roleArn"}, {"type": "experiment-template", "fill": {"Id": "id"}}, {"type": "action", "fill": {"Id": "actions{}.actionId"}}], "located": {"id": "{id}"}}, "fis:UpdateSafetyLeverState": {"action": "fis:UpdateSafetyLeverState", "types": ["safety-lever"], "resources": [{"type": "safety-lever", "fill": {"Id": "id"}}], "located": {"id": "{id}"}}, "fis:UpdateTargetAccountConfiguration": {"action": "fis:UpdateTargetAccountConfiguration", "types": ["experiment-template"], "resources": [{"types": ["experiment-template"], "arn": "roleArn"}, {"type": "experiment-template", "fill": {"Id": "experimentTemplateId"}}], "located": {"experimentTemplateId": "{id}"}}, "globalaccelerator:AddCustomRoutingEndpoints": {"action": "globalaccelerator:AddCustomRoutingEndpoints", "types": ["endpointgroup"], "resources": [{"types": ["endpointgroup"], "arn": "EndpointConfigurations[].AttachmentArn"}, {"types": ["endpointgroup"], "arn": "EndpointGroupArn"}]}, "globalaccelerator:AddEndpoints": {"action": "globalaccelerator:AddEndpoints", "types": ["endpointgroup"], "resources": [{"types": ["endpointgroup"], "arn": "EndpointConfigurations[].AttachmentArn"}, {"types": ["endpointgroup"], "arn": "EndpointGroupArn"}]}, "globalaccelerator:AdvertiseByoipCidr": {"action": "globalaccelerator:AdvertiseByoipCidr", "types": [], "resources": []}, "globalaccelerator:AllowCustomRoutingTraffic": {"action": "globalaccelerator:AllowCustomRoutingTraffic", "types": ["endpointgroup"], "resources": [{"types": ["endpointgroup"], "arn": "EndpointGroupArn"}]}, - "globalaccelerator:CreateAccelerator": {"action": "globalaccelerator:CreateAccelerator", "types": [], "resources": []}, - "globalaccelerator:CreateCrossAccountAttachment": {"action": "globalaccelerator:CreateCrossAccountAttachment", "types": [], "resources": []}, - "globalaccelerator:CreateCustomRoutingAccelerator": {"action": "globalaccelerator:CreateCustomRoutingAccelerator", "types": [], "resources": []}, + "globalaccelerator:CreateAccelerator": {"action": "globalaccelerator:CreateAccelerator", "types": [], "resources": [], "makes": [{"type": "accelerator", "fill": {}}]}, + "globalaccelerator:CreateCrossAccountAttachment": {"action": "globalaccelerator:CreateCrossAccountAttachment", "types": [], "resources": [], "makes": [{"type": "attachment", "fill": {}}]}, + "globalaccelerator:CreateCustomRoutingAccelerator": {"action": "globalaccelerator:CreateCustomRoutingAccelerator", "types": [], "resources": [], "makes": [{"type": "accelerator", "fill": {}}]}, "globalaccelerator:CreateCustomRoutingEndpointGroup": {"action": "globalaccelerator:CreateCustomRoutingEndpointGroup", "types": ["listener"], "resources": [{"types": ["listener"], "arn": "ListenerArn"}]}, "globalaccelerator:CreateCustomRoutingListener": {"action": "globalaccelerator:CreateCustomRoutingListener", "types": ["accelerator"], "resources": [{"types": ["accelerator"], "arn": "AcceleratorArn"}]}, "globalaccelerator:CreateEndpointGroup": {"action": "globalaccelerator:CreateEndpointGroup", "types": ["listener"], "resources": [{"types": ["listener"], "arn": "EndpointConfigurations[].AttachmentArn"}, {"types": ["listener"], "arn": "ListenerArn"}]}, @@ -2235,19 +2235,19 @@ "guardduty:AcceptAdministratorInvitation": {"action": "guardduty:AcceptAdministratorInvitation", "types": [], "resources": []}, "guardduty:AcceptInvitation": {"action": "guardduty:AcceptInvitation", "types": [], "resources": []}, "guardduty:ArchiveFindings": {"action": "guardduty:ArchiveFindings", "types": [], "resources": []}, - "guardduty:CreateCustomDetectionRuleAssociation": {"action": "guardduty:CreateCustomDetectionRuleAssociation", "types": [], "resources": []}, + "guardduty:CreateCustomDetectionRuleAssociation": {"action": "guardduty:CreateCustomDetectionRuleAssociation", "types": [], "resources": [], "makes": [{"type": "customdetectionruleassociation", "fill": {"RuleId": "RuleId"}}]}, "guardduty:CreateCustomDetectionRuleOrgConfiguration": {"action": "guardduty:CreateCustomDetectionRuleOrgConfiguration", "types": [], "resources": []}, - "guardduty:CreateDetector": {"action": "guardduty:CreateDetector", "types": [], "resources": []}, + "guardduty:CreateDetector": {"action": "guardduty:CreateDetector", "types": [], "resources": [], "makes": [{"type": "detector", "fill": {}}]}, "guardduty:CreateFilter": {"action": "guardduty:CreateFilter", "types": ["filter"], "resources": [{"type": "filter", "fill": {"DetectorId": "DetectorId", "FilterName": "Name"}}], "located": {"DetectorId": "{DetectorId}"}}, - "guardduty:CreateIPSet": {"action": "guardduty:CreateIPSet", "types": [], "resources": []}, + "guardduty:CreateIPSet": {"action": "guardduty:CreateIPSet", "types": [], "resources": [], "makes": [{"type": "ipset", "fill": {"DetectorId": "DetectorId"}}], "located": {"DetectorId": "{DetectorId}"}}, "guardduty:CreateInvestigation": {"action": "guardduty:CreateInvestigation", "types": [], "resources": []}, - "guardduty:CreateMalwareProtectionPlan": {"action": "guardduty:CreateMalwareProtectionPlan", "types": [], "resources": []}, + "guardduty:CreateMalwareProtectionPlan": {"action": "guardduty:CreateMalwareProtectionPlan", "types": [], "resources": [], "makes": [{"type": "malwareprotectionplan", "fill": {}}]}, "guardduty:CreateMembers": {"action": "guardduty:CreateMembers", "types": [], "resources": []}, - "guardduty:CreatePublishingDestination": {"action": "guardduty:CreatePublishingDestination", "types": [], "resources": []}, + "guardduty:CreatePublishingDestination": {"action": "guardduty:CreatePublishingDestination", "types": [], "resources": [], "makes": [{"type": "publishingDestination", "fill": {"DetectorId": "DetectorId"}}], "located": {"DetectorId": "{DetectorId}"}}, "guardduty:CreateSampleFindings": {"action": "guardduty:CreateSampleFindings", "types": [], "resources": []}, - "guardduty:CreateThreatEntitySet": {"action": "guardduty:CreateThreatEntitySet", "types": [], "resources": []}, - "guardduty:CreateThreatIntelSet": {"action": "guardduty:CreateThreatIntelSet", "types": [], "resources": []}, - "guardduty:CreateTrustedEntitySet": {"action": "guardduty:CreateTrustedEntitySet", "types": [], "resources": []}, + "guardduty:CreateThreatEntitySet": {"action": "guardduty:CreateThreatEntitySet", "types": [], "resources": [], "makes": [{"type": "threatentityset", "fill": {"DetectorId": "DetectorId"}}], "located": {"DetectorId": "{DetectorId}"}}, + "guardduty:CreateThreatIntelSet": {"action": "guardduty:CreateThreatIntelSet", "types": [], "resources": [], "makes": [{"type": "threatintelset", "fill": {"DetectorId": "DetectorId"}}], "located": {"DetectorId": "{DetectorId}"}}, + "guardduty:CreateTrustedEntitySet": {"action": "guardduty:CreateTrustedEntitySet", "types": [], "resources": [], "makes": [{"type": "trustedentityset", "fill": {"DetectorId": "DetectorId"}}], "located": {"DetectorId": "{DetectorId}"}}, "guardduty:DeclineInvitations": {"action": "guardduty:DeclineInvitations", "types": [], "resources": []}, "guardduty:DeleteCustomDetectionRuleAssociation": {"action": "guardduty:DeleteCustomDetectionRuleAssociation", "types": ["customdetectionruleassociation"], "resources": [{"type": "customdetectionruleassociation", "fill": {"AssociationId": "AssociationId", "RuleId": "RuleId"}}], "located": {"AssociationId": "{AssociationId}", "RuleId": "{RuleId}"}}, "guardduty:DeleteCustomDetectionRuleOrgConfiguration": {"action": "guardduty:DeleteCustomDetectionRuleOrgConfiguration", "types": [], "resources": []}, @@ -2425,7 +2425,7 @@ "kinesisanalytics:AddApplicationOutput": {"action": "kinesisanalytics:AddApplicationOutput", "types": ["application"], "resources": [{"type": "application", "fill": {"ApplicationName": "ApplicationName"}}]}, "kinesisanalytics:AddApplicationReferenceDataSource": {"action": "kinesisanalytics:AddApplicationReferenceDataSource", "types": ["application"], "resources": [{"type": "application", "fill": {"ApplicationName": "ApplicationName"}}]}, "kinesisanalytics:AddApplicationVpcConfiguration": {"action": "kinesisanalytics:AddApplicationVpcConfiguration", "types": ["application"], "resources": [{"type": "application", "fill": {"ApplicationName": "ApplicationName"}}]}, - "kinesisanalytics:CreateApplication": {"action": "kinesisanalytics:CreateApplication", "types": [], "resources": []}, + "kinesisanalytics:CreateApplication": {"action": "kinesisanalytics:CreateApplication", "types": [], "resources": [], "makes": [{"type": "application", "fill": {"ApplicationName": "ApplicationName"}}]}, "kinesisanalytics:CreateApplicationPresignedUrl": {"action": "kinesisanalytics:CreateApplicationPresignedUrl", "types": ["application"], "resources": [{"type": "application", "fill": {"ApplicationName": "ApplicationName"}}]}, "kinesisanalytics:CreateApplicationSnapshot": {"action": "kinesisanalytics:CreateApplicationSnapshot", "types": ["application"], "resources": [{"type": "application", "fill": {"ApplicationName": "ApplicationName"}}]}, "kinesisanalytics:CreateSnapshot": {"action": "kinesisanalytics:CreateSnapshot", "types": [], "resources": []}, @@ -2477,7 +2477,7 @@ "macie2:AcceptInvitation": {"action": "macie2:AcceptInvitation", "types": [], "resources": []}, "macie2:BatchGetCustomDataIdentifiers": {"action": "macie2:BatchGetCustomDataIdentifiers", "types": ["CustomDataIdentifier"], "resources": [{"type": "CustomDataIdentifier", "fill": {"ResourceId": "ids[]"}}]}, "macie2:BatchUpdateAutomatedDiscoveryAccounts": {"action": "macie2:BatchUpdateAutomatedDiscoveryAccounts", "types": [], "resources": []}, - "macie2:CreateAllowList": {"action": "macie2:CreateAllowList", "types": [], "resources": []}, + "macie2:CreateAllowList": {"action": "macie2:CreateAllowList", "types": [], "resources": [], "makes": [{"type": "AllowList", "fill": {}}]}, "macie2:CreateClassificationJob": {"action": "macie2:CreateClassificationJob", "types": ["ClassificationJob"], "resources": [{"type": "ClassificationJob", "fill": {}}]}, "macie2:CreateCustomDataIdentifier": {"action": "macie2:CreateCustomDataIdentifier", "types": ["CustomDataIdentifier"], "resources": [{"type": "CustomDataIdentifier", "fill": {}}]}, "macie2:CreateFindingsFilter": {"action": "macie2:CreateFindingsFilter", "types": ["FindingsFilter"], "resources": [{"type": "FindingsFilter", "fill": {}}]}, @@ -2556,7 +2556,7 @@ "macie2:UpdateRevealConfiguration": {"action": "macie2:UpdateRevealConfiguration", "types": [], "resources": []}, "macie2:UpdateSensitivityInspectionTemplate": {"action": "macie2:UpdateSensitivityInspectionTemplate", "types": [], "resources": []}, "oam:CreateLink": {"action": "oam:CreateLink", "types": ["Sink"], "resources": [{"type": "Sink", "fill": {"ResourceId": "SinkIdentifier"}}]}, - "oam:CreateSink": {"action": "oam:CreateSink", "types": [], "resources": []}, + "oam:CreateSink": {"action": "oam:CreateSink", "types": [], "resources": [], "makes": [{"type": "Sink", "fill": {}}]}, "oam:DeleteLink": {"action": "oam:DeleteLink", "types": ["Link"], "resources": [{"type": "Link", "fill": {"ResourceId": "Identifier"}}]}, "oam:DeleteSink": {"action": "oam:DeleteSink", "types": ["Sink"], "resources": [{"type": "Sink", "fill": {"ResourceId": "Identifier"}}]}, "oam:GetLink": {"action": "oam:GetLink", "types": ["Link"], "resources": [{"type": "Link", "fill": {"ResourceId": "Identifier"}}]}, @@ -2572,8 +2572,8 @@ "oam:UpdateLink": {"action": "oam:UpdateLink", "types": ["Link"], "resources": [{"type": "Link", "fill": {"ResourceId": "Identifier"}}]}, "payment-cryptography:AddKeyReplicationRegions": {"action": "payment-cryptography:AddKeyReplicationRegions", "types": ["alias", "key"], "resources": [{"type": "key", "fill": {"KeyId": "KeyIdentifier"}}]}, "payment-cryptography:AssociateMpaTeam": {"action": "payment-cryptography:AssociateMpaTeam", "types": ["approval-team"], "resources": [{"types": ["approval-team"], "arn": "MpaTeamArn"}]}, - "payment-cryptography:CreateAlias": {"action": "payment-cryptography:CreateAlias", "types": ["alias", "key"], "resources": [{"types": ["alias", "key"], "arn": "KeyArn"}, {"type": "alias", "fill": {"Alias": "AliasName"}, "made": true}]}, - "payment-cryptography:CreateKey": {"action": "payment-cryptography:CreateKey", "types": [], "resources": []}, + "payment-cryptography:CreateAlias": {"action": "payment-cryptography:CreateAlias", "types": ["alias", "key"], "resources": [{"types": ["alias", "key"], "arn": "KeyArn"}, {"type": "alias", "fill": {"Alias": "AliasName"}, "made": true}, {"type": "key", "fill": {}, "when": {"KeyArn": [null]}, "default": true}]}, + "payment-cryptography:CreateKey": {"action": "payment-cryptography:CreateKey", "types": [], "resources": [], "makes": [{"type": "key", "fill": {}}]}, "payment-cryptography:DecryptData": {"action": "payment-cryptography:DecryptData", "types": ["alias", "key"], "resources": [{"type": "key", "fill": {"KeyId": "KeyIdentifier"}}], "located": {"KeyIdentifier": "{KeyIdentifier}"}}, "payment-cryptography:DeleteAlias": {"action": "payment-cryptography:DeleteAlias", "types": ["alias"], "resources": [{"type": "alias", "fill": {"Alias": "AliasName"}}]}, "payment-cryptography:DeleteKey": {"action": "payment-cryptography:DeleteKey", "types": ["key"], "resources": [{"type": "key", "fill": {"KeyId": "KeyIdentifier"}}]}, @@ -2598,7 +2598,7 @@ "payment-cryptography:GetParametersForImport": {"action": "payment-cryptography:GetParametersForImport", "types": [], "resources": []}, "payment-cryptography:GetPublicKeyCertificate": {"action": "payment-cryptography:GetPublicKeyCertificate", "types": ["key"], "resources": [{"type": "key", "fill": {"KeyId": "KeyIdentifier"}}]}, "payment-cryptography:GetResourcePolicy": {"action": "payment-cryptography:GetResourcePolicy", "types": ["key"], "resources": [{"types": ["key"], "arn": "ResourceArn"}]}, - "payment-cryptography:ImportKey": {"action": "payment-cryptography:ImportKey", "types": [], "resources": []}, + "payment-cryptography:ImportKey": {"action": "payment-cryptography:ImportKey", "types": [], "resources": [], "makes": [{"type": "key", "fill": {}}]}, "payment-cryptography:ListAliases": {"action": "payment-cryptography:ListAliases", "types": [], "resources": []}, "payment-cryptography:ListKeys": {"action": "payment-cryptography:ListKeys", "types": [], "resources": []}, "payment-cryptography:ListTagsForResource": {"action": "payment-cryptography:ListTagsForResource", "types": ["key"], "resources": [{"types": ["key"], "arn": "ResourceArn"}]}, @@ -2612,7 +2612,7 @@ "payment-cryptography:TranslateKeyMaterial": {"action": "payment-cryptography:TranslateKeyMaterial", "types": ["alias", "key"], "resources": []}, "payment-cryptography:TranslatePinData": {"action": "payment-cryptography:TranslatePinData", "types": ["alias", "key"], "resources": [{"type": "key", "fill": {"KeyId": "IncomingKeyIdentifier"}}, {"type": "key", "fill": {"KeyId": "OutgoingKeyIdentifier"}}]}, "payment-cryptography:UntagResource": {"action": "payment-cryptography:UntagResource", "types": ["key"], "resources": [{"types": ["key"], "arn": "ResourceArn"}]}, - "payment-cryptography:UpdateAlias": {"action": "payment-cryptography:UpdateAlias", "types": ["alias", "key"], "resources": [{"types": ["alias", "key"], "arn": "KeyArn"}, {"type": "alias", "fill": {"Alias": "AliasName"}}]}, + "payment-cryptography:UpdateAlias": {"action": "payment-cryptography:UpdateAlias", "types": ["alias", "key"], "resources": [{"types": ["alias", "key"], "arn": "KeyArn"}, {"type": "alias", "fill": {"Alias": "AliasName"}}, {"type": "key", "fill": {}, "when": {"KeyArn": [null]}, "default": true}]}, "payment-cryptography:VerifyAuthRequestCryptogram": {"action": "payment-cryptography:VerifyAuthRequestCryptogram", "types": ["alias", "key"], "resources": [{"type": "key", "fill": {"KeyId": "KeyIdentifier"}}]}, "payment-cryptography:VerifyCardValidationData": {"action": "payment-cryptography:VerifyCardValidationData", "types": ["alias", "key"], "resources": [{"type": "key", "fill": {"KeyId": "KeyIdentifier"}}]}, "payment-cryptography:VerifyMac": {"action": "payment-cryptography:VerifyMac", "types": ["alias", "key"], "resources": [{"type": "key", "fill": {"KeyId": "KeyIdentifier"}}]}, @@ -2622,7 +2622,7 @@ "quicksight:BatchDeleteTopicReviewedAnswer": {"action": "quicksight:BatchDeleteTopicReviewedAnswer", "types": ["topic"], "resources": [{"type": "topic", "fill": {"ResourceId": "TopicId"}}], "located": {"TopicId": "{TopicId}"}}, "quicksight:BatchDescribeUserLimits": {"action": "quicksight:BatchDescribeUserLimits", "types": ["limitsProfile"], "resources": []}, "quicksight:CancelIngestion": {"action": "quicksight:CancelIngestion", "types": ["ingestion"], "resources": [{"type": "ingestion", "fill": {"DatasetId": "DataSetId"}}], "located": {"DataSetId": "{DataSetId}"}}, - "quicksight:CreateAccountCustomization": {"action": "quicksight:CreateAccountCustomization", "types": [], "resources": []}, + "quicksight:CreateAccountCustomization": {"action": "quicksight:CreateAccountCustomization", "types": [], "resources": [], "makes": [{"type": "customization", "fill": {}}]}, "quicksight:CreateAccountSubscription": {"action": "quicksight:CreateAccountSubscription", "types": [], "resources": []}, "quicksight:CreateActionConnector": {"action": "quicksight:CreateActionConnector", "types": ["actionconnector"], "resources": [{"types": ["actionconnector"], "arn": "VpcConnectionArn"}, {"type": "actionconnector", "fill": {"ResourceId": "ActionConnectorId"}}]}, "quicksight:CreateAgent": {"action": "quicksight:CreateAgent", "types": ["agent"], "resources": [{"type": "agent", "fill": {"ResourceId": "AgentId"}}]}, @@ -2632,7 +2632,7 @@ "quicksight:CreateCustomPermissions": {"action": "quicksight:CreateCustomPermissions", "types": ["custompermissions"], "resources": [{"type": "custompermissions", "fill": {}}]}, "quicksight:CreateDashboard": {"action": "quicksight:CreateDashboard", "types": ["dashboard"], "resources": [{"type": "dashboard", "fill": {"ResourceId": "DashboardId"}}], "located": {"DashboardId": "{DashboardId}"}}, "quicksight:CreateDataSet": {"action": "quicksight:CreateDataSet", "types": ["datasource"], "resources": [{"types": ["datasource"], "arn": "PhysicalTableMap{}.S3Source.DataSourceArn"}, {"types": ["datasource"], "arn": "PhysicalTableMap{}.RelationalTable.DataSourceArn"}, {"types": ["datasource"], "arn": "PhysicalTableMap{}.CustomSql.DataSourceArn"}, {"types": ["datasource"], "arn": "PhysicalTableMap{}.SaaSTable.DataSourceArn"}, {"types": ["datasource"], "arn": "PhysicalTableMap{}.FileSource.DataSourceArn"}]}, - "quicksight:CreateDataSource": {"action": "quicksight:CreateDataSource", "types": [], "resources": []}, + "quicksight:CreateDataSource": {"action": "quicksight:CreateDataSource", "types": [], "resources": [], "makes": [{"type": "datasource", "fill": {"ResourceId": "DataSourceId"}}]}, "quicksight:CreateDlpSetting": {"action": "quicksight:CreateDlpSetting", "types": ["dlpSetting"], "resources": [{"type": "dlpSetting", "fill": {"ResourceId": "DlpSettingId"}}], "located": {"DlpSettingId": "{DlpSettingId}"}}, "quicksight:CreateFlow": {"action": "quicksight:CreateFlow", "types": ["flow"], "resources": [{"type": "flow", "fill": {}}]}, "quicksight:CreateFolder": {"action": "quicksight:CreateFolder", "types": ["folder"], "resources": [{"types": ["folder"], "arn": "ParentFolderArn"}, {"type": "folder", "fill": {"ResourceId": "FolderId"}}], "located": {"FolderId": "{FolderId}"}}, @@ -2644,7 +2644,7 @@ "quicksight:CreateKnowledgeBase": {"action": "quicksight:CreateKnowledgeBase", "types": ["datasource", "knowledgeBase"], "resources": [{"types": ["datasource", "knowledgeBase"], "arn": "DataSourceArn"}, {"types": ["datasource", "knowledgeBase"], "arn": "PrimaryOwnerArn"}, {"type": "knowledgeBase", "fill": {"ResourceId": "KnowledgeBaseId"}, "made": true}]}, "quicksight:CreateLimitsProfile": {"action": "quicksight:CreateLimitsProfile", "types": ["limitsProfile"], "resources": [{"type": "limitsProfile", "fill": {}}]}, "quicksight:CreateNamespace": {"action": "quicksight:CreateNamespace", "types": ["namespace"], "resources": [{"type": "namespace", "fill": {"ResourceId": "Namespace"}}]}, - "quicksight:CreateOAuthClientApplication": {"action": "quicksight:CreateOAuthClientApplication", "types": [], "resources": []}, + "quicksight:CreateOAuthClientApplication": {"action": "quicksight:CreateOAuthClientApplication", "types": [], "resources": [], "makes": [{"type": "oauthClientApplication", "fill": {"ResourceId": "OAuthClientApplicationId"}}]}, "quicksight:CreateRefreshSchedule": {"action": "quicksight:CreateRefreshSchedule", "types": ["refreshschedule"], "resources": [{"types": ["refreshschedule"], "arn": "Schedule.Arn"}, {"type": "refreshschedule", "fill": {"DatasetId": "DataSetId"}}], "located": {"DataSetId": "{DataSetId}"}}, "quicksight:CreateRoleMembership": {"action": "quicksight:CreateRoleMembership", "types": [], "resources": []}, "quicksight:CreateSpace": {"action": "quicksight:CreateSpace", "types": ["space"], "resources": [{"type": "space", "fill": {"ResourceId": "SpaceId"}}]}, @@ -2655,7 +2655,7 @@ "quicksight:CreateTopic": {"action": "quicksight:CreateTopic", "types": ["dataset"], "resources": [{"types": ["dataset"], "arn": "FolderArns[]"}]}, "quicksight:CreateTopicRefreshSchedule": {"action": "quicksight:CreateTopicRefreshSchedule", "types": ["topic"], "resources": [{"types": ["topic"], "arn": "DatasetArn"}, {"type": "topic", "fill": {"ResourceId": "TopicId"}}], "located": {"TopicId": "{TopicId}"}}, "quicksight:CreateTopicV2": {"action": "quicksight:CreateTopic", "types": ["dataset"], "resources": [{"types": ["dataset"], "arn": "FolderArns[]"}]}, - "quicksight:CreateVPCConnection": {"action": "quicksight:CreateVPCConnection", "types": [], "resources": []}, + "quicksight:CreateVPCConnection": {"action": "quicksight:CreateVPCConnection", "types": [], "resources": [], "makes": [{"type": "vpcconnection", "fill": {"ResourceId": "VPCConnectionId"}}]}, "quicksight:DeleteAccountCustomPermission": {"action": "quicksight:DeleteAccountCustomPermission", "types": [], "resources": []}, "quicksight:DeleteAccountCustomization": {"action": "quicksight:DeleteAccountCustomization", "types": ["customization"], "resources": []}, "quicksight:DeleteAccountSubscription": {"action": "quicksight:DeleteAccountSubscription", "types": ["account"], "resources": [{"type": "account", "fill": {"ResourceId": "AwsAccountId"}}], "located": {"AwsAccountId": "{AwsAccountId}"}}, @@ -2950,8 +2950,8 @@ "ram:RejectResourceShareInvitation": {"action": "ram:RejectResourceShareInvitation", "types": ["resource-share-invitation"], "resources": [{"types": ["resource-share-invitation"], "arn": "resourceShareInvitationArn"}]}, "ram:ReplacePermissionAssociations": {"action": "ram:ReplacePermissionAssociations", "types": ["customer-managed-permission", "permission"], "resources": [{"types": ["customer-managed-permission", "permission"], "arn": "fromPermissionArn"}, {"types": ["customer-managed-permission", "permission"], "arn": "toPermissionArn"}]}, "ram:SetDefaultPermissionVersion": {"action": "ram:SetDefaultPermissionVersion", "types": ["customer-managed-permission"], "resources": [{"types": ["customer-managed-permission"], "arn": "permissionArn"}]}, - "ram:TagResource": {"action": "ram:TagResource", "types": ["customer-managed-permission", "resource-share"], "resources": [{"types": ["customer-managed-permission", "resource-share"], "arn": "resourceArn"}, {"types": ["customer-managed-permission", "resource-share"], "arn": "resourceShareArn"}]}, - "ram:UntagResource": {"action": "ram:UntagResource", "types": ["customer-managed-permission", "resource-share"], "resources": [{"types": ["customer-managed-permission", "resource-share"], "arn": "resourceArn"}, {"types": ["customer-managed-permission", "resource-share"], "arn": "resourceShareArn"}]}, + "ram:TagResource": {"action": "ram:TagResource", "types": ["customer-managed-permission", "resource-share"], "resources": [{"types": ["customer-managed-permission", "resource-share"], "arn": "resourceArn"}, {"types": ["customer-managed-permission", "resource-share"], "arn": "resourceShareArn"}, {"type": "resource-share", "fill": {}, "when": {"resourceShareArn": [null]}, "default": true}]}, + "ram:UntagResource": {"action": "ram:UntagResource", "types": ["customer-managed-permission", "resource-share"], "resources": [{"types": ["customer-managed-permission", "resource-share"], "arn": "resourceArn"}, {"types": ["customer-managed-permission", "resource-share"], "arn": "resourceShareArn"}, {"type": "resource-share", "fill": {}, "when": {"resourceShareArn": [null]}, "default": true}]}, "ram:UpdatePermission": {"action": "ram:UpdatePermission", "types": ["customer-managed-permission"], "resources": []}, "ram:UpdateResourceShare": {"action": "ram:UpdateResourceShare", "types": ["resource-share"], "resources": [{"types": ["resource-share"], "arn": "resourceShareArn"}]}, "redshift-data:BatchExecuteStatement": {"action": "redshift-data:BatchExecuteStatement", "types": ["cluster", "workgroup"], "resources": [{"types": ["cluster", "workgroup"], "arn": "SecretArn"}, {"type": "cluster", "fill": {"ClusterName": "ClusterIdentifier"}}, {"type": "workgroup", "fill": {}, "find": ["WorkgroupName"]}, {"types": ["cluster", "workgroup"], "through": "SessionId"}]}, @@ -3054,8 +3054,8 @@ "redshift:CreateHsmClientCertificate": {"action": "redshift:CreateHsmClientCertificate", "types": ["hsmclientcertificate"], "resources": [{"type": "hsmclientcertificate", "fill": {"HSMClientCertificateId": "HsmClientCertificateIdentifier"}}]}, "redshift:CreateHsmConfiguration": {"action": "redshift:CreateHsmConfiguration", "types": ["hsmconfiguration"], "resources": [{"type": "hsmconfiguration", "fill": {"HSMConfigurationId": "HsmConfigurationIdentifier"}}]}, "redshift:CreateIntegration": {"action": "redshift:CreateIntegration", "types": ["integration"], "resources": [{"types": ["integration"], "arn": "SourceArn"}, {"types": ["integration"], "arn": "TargetArn"}, {"type": "integration", "fill": {}}]}, - "redshift:CreateQev2IdcApplication": {"action": "redshift:CreateQev2IdcApplication", "types": [], "resources": []}, - "redshift:CreateRedshiftIdcApplication": {"action": "redshift:CreateRedshiftIdcApplication", "types": [], "resources": []}, + "redshift:CreateQev2IdcApplication": {"action": "redshift:CreateQev2IdcApplication", "types": [], "resources": [], "makes": [{"type": "qev2idcapplication", "fill": {}}]}, + "redshift:CreateRedshiftIdcApplication": {"action": "redshift:CreateRedshiftIdcApplication", "types": [], "resources": [], "makes": [{"type": "redshiftidcapplication", "fill": {}}]}, "redshift:CreateScheduledAction": {"action": "redshift:CreateScheduledAction", "types": [], "resources": []}, "redshift:CreateSnapshotCopyGrant": {"action": "redshift:CreateSnapshotCopyGrant", "types": ["snapshotcopygrant"], "resources": [{"type": "snapshotcopygrant", "fill": {"SnapshotCopyGrantName": "SnapshotCopyGrantName"}}]}, "redshift:CreateSnapshotSchedule": {"action": "redshift:CreateSnapshotSchedule", "types": ["snapshotschedule"], "resources": [{"type": "snapshotschedule", "fill": {"ScheduleIdentifier": "ScheduleIdentifier"}}]}, @@ -3108,7 +3108,7 @@ "redshift:DescribeHsmClientCertificates": {"action": "redshift:DescribeHsmClientCertificates", "types": [], "resources": []}, "redshift:DescribeHsmConfigurations": {"action": "redshift:DescribeHsmConfigurations", "types": [], "resources": []}, "redshift:DescribeInboundIntegrations": {"action": "redshift:DescribeInboundIntegrations", "types": [], "resources": []}, - "redshift:DescribeIntegrations": {"action": "redshift:DescribeIntegrations", "types": ["integration"], "resources": [{"types": ["integration"], "arn": "IntegrationArn"}]}, + "redshift:DescribeIntegrations": {"action": "redshift:DescribeIntegrations", "types": ["integration"], "resources": [{"types": ["integration"], "arn": "IntegrationArn"}, {"type": "integration", "fill": {}, "when": {"IntegrationArn": [null]}, "default": true}]}, "redshift:DescribeLoggingStatus": {"action": "redshift:DescribeLoggingStatus", "types": ["cluster"], "resources": [{"type": "cluster", "fill": {"ClusterName": "ClusterIdentifier"}}]}, "redshift:DescribeNodeConfigurationOptions": {"action": "redshift:DescribeNodeConfigurationOptions", "types": ["cluster"], "resources": [{"types": ["cluster"], "arn": "SnapshotArn"}, {"type": "cluster", "fill": {"ClusterName": "ClusterIdentifier"}}]}, "redshift:DescribeOrderableClusterOptions": {"action": "redshift:DescribeOrderableClusterOptions", "types": [], "resources": []}, @@ -3164,7 +3164,7 @@ "redshift:PurchaseReservedNodeOffering": {"action": "redshift:PurchaseReservedNodeOffering", "types": [], "resources": []}, "redshift:PutResourcePolicy": {"action": "redshift:PutResourcePolicy", "types": ["namespace"], "resources": [{"types": ["namespace"], "arn": "ResourceArn"}]}, "redshift:RebootCluster": {"action": "redshift:RebootCluster", "types": ["cluster"], "resources": [{"type": "cluster", "fill": {"ClusterName": "ClusterIdentifier"}}]}, - "redshift:RegisterNamespace": {"action": "redshift:RegisterNamespace", "types": [], "resources": []}, + "redshift:RegisterNamespace": {"action": "redshift:RegisterNamespace", "types": [], "resources": [], "makes": [{"type": "namespace", "fill": {}}]}, "redshift:RejectDataShare": {"action": "redshift:RejectDataShare", "types": ["datashare"], "resources": [{"types": ["datashare"], "arn": "DataShareArn"}]}, "redshift:ResetClusterParameterGroup": {"action": "redshift:ResetClusterParameterGroup", "types": ["parametergroup"], "resources": [{"type": "parametergroup", "fill": {"ParameterGroupName": "ParameterGroupName"}}]}, "redshift:ResizeCluster": {"action": "redshift:ResizeCluster", "types": ["cluster"], "resources": [{"type": "cluster", "fill": {"ClusterName": "ClusterIdentifier"}}]}, @@ -3179,10 +3179,10 @@ "rekognition:AssociateFaces": {"action": "rekognition:AssociateFaces", "types": ["collection"], "resources": [{"type": "collection", "fill": {"CollectionId": "CollectionId"}}]}, "rekognition:CompareFaces": {"action": "rekognition:CompareFaces", "types": [], "resources": []}, "rekognition:CopyProjectVersion": {"action": "rekognition:CopyProjectVersion", "types": ["project", "projectversion"], "resources": [{"types": ["project", "projectversion"], "arn": "DestinationProjectArn"}, {"types": ["project", "projectversion"], "arn": "SourceProjectArn"}, {"types": ["project", "projectversion"], "arn": "SourceProjectVersionArn"}, {"type": "projectversion", "fill": {"VersionName": "VersionName"}, "made": true}]}, - "rekognition:CreateCollection": {"action": "rekognition:CreateCollection", "types": [], "resources": []}, + "rekognition:CreateCollection": {"action": "rekognition:CreateCollection", "types": [], "resources": [], "makes": [{"type": "collection", "fill": {"CollectionId": "CollectionId"}}]}, "rekognition:CreateDataset": {"action": "rekognition:CreateDataset", "types": ["project"], "resources": [{"types": ["project"], "arn": "DatasetSource.DatasetArn"}, {"types": ["project"], "arn": "ProjectArn"}]}, "rekognition:CreateFaceLivenessSession": {"action": "rekognition:CreateFaceLivenessSession", "types": [], "resources": []}, - "rekognition:CreateProject": {"action": "rekognition:CreateProject", "types": [], "resources": []}, + "rekognition:CreateProject": {"action": "rekognition:CreateProject", "types": [], "resources": [], "makes": [{"type": "project", "fill": {"ProjectName": "ProjectName"}}]}, "rekognition:CreateProjectVersion": {"action": "rekognition:CreateProjectVersion", "types": ["project"], "resources": [{"types": ["project"], "arn": "ProjectArn"}]}, "rekognition:CreateStreamProcessor": {"action": "rekognition:CreateStreamProcessor", "types": ["collection"], "resources": [{"types": ["collection"], "arn": "NotificationChannel.SNSTopicArn"}, {"types": ["collection"], "arn": "RoleArn"}]}, "rekognition:CreateUser": {"action": "rekognition:CreateUser", "types": ["collection"], "resources": [{"type": "collection", "fill": {"CollectionId": "CollectionId"}}]}, @@ -3253,9 +3253,9 @@ "rekognition:UpdateStreamProcessor": {"action": "rekognition:UpdateStreamProcessor", "types": ["streamprocessor"], "resources": [{"type": "streamprocessor", "fill": {"StreamprocessorId": "Name"}}]}, "resource-explorer-2:AssociateDefaultView": {"action": "resource-explorer-2:AssociateDefaultView", "types": [], "resources": []}, "resource-explorer-2:BatchGetView": {"action": "resource-explorer-2:BatchGetView", "types": [], "resources": []}, - "resource-explorer-2:CreateIndex": {"action": "resource-explorer-2:CreateIndex", "types": [], "resources": []}, + "resource-explorer-2:CreateIndex": {"action": "resource-explorer-2:CreateIndex", "types": [], "resources": [], "makes": [{"type": "index", "fill": {}}]}, "resource-explorer-2:CreateResourceExplorerSetup": {"action": "resource-explorer-2:CreateResourceExplorerSetup", "types": [], "resources": []}, - "resource-explorer-2:CreateView": {"action": "resource-explorer-2:CreateView", "types": [], "resources": []}, + "resource-explorer-2:CreateView": {"action": "resource-explorer-2:CreateView", "types": [], "resources": [], "makes": [{"type": "view", "fill": {"ViewName": "ViewName"}}]}, "resource-explorer-2:DeleteIndex": {"action": "resource-explorer-2:DeleteIndex", "types": ["index"], "resources": [{"types": ["index"], "arn": "Arn"}]}, "resource-explorer-2:DeleteResourceExplorerSetup": {"action": "resource-explorer-2:DeleteResourceExplorerSetup", "types": [], "resources": []}, "resource-explorer-2:DeleteView": {"action": "resource-explorer-2:DeleteView", "types": ["view"], "resources": [{"types": ["view"], "arn": "ViewArn"}]}, @@ -3271,14 +3271,14 @@ "resource-explorer-2:ListIndexes": {"action": "resource-explorer-2:ListIndexes", "types": [], "resources": []}, "resource-explorer-2:ListIndexesForMembers": {"action": "resource-explorer-2:ListIndexesForMembers", "types": [], "resources": []}, "resource-explorer-2:ListManagedViews": {"action": "resource-explorer-2:ListManagedViews", "types": [], "resources": []}, - "resource-explorer-2:ListResources": {"action": "resource-explorer-2:Search", "types": ["view"], "resources": [{"types": ["view"], "arn": "ViewArn"}]}, + "resource-explorer-2:ListResources": {"action": "resource-explorer-2:Search", "types": ["view"], "resources": [{"types": ["view"], "arn": "ViewArn"}, {"type": "view", "fill": {}, "when": {"ViewArn": [null]}, "default": true}]}, "resource-explorer-2:ListServiceIndexes": {"action": "resource-explorer-2:ListServiceIndexes", "types": [], "resources": []}, "resource-explorer-2:ListServiceViews": {"action": "resource-explorer-2:ListServiceViews", "types": [], "resources": []}, "resource-explorer-2:ListStreamingAccessForServices": {"action": "resource-explorer-2:ListStreamingAccessForServices", "types": [], "resources": []}, "resource-explorer-2:ListSupportedResourceTypes": {"action": "resource-explorer-2:ListSupportedResourceTypes", "types": [], "resources": []}, "resource-explorer-2:ListTagsForResource": {"action": "resource-explorer-2:ListTagsForResource", "types": ["index", "view"], "resources": [{"types": ["index", "view"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}}, "resource-explorer-2:ListViews": {"action": "resource-explorer-2:ListViews", "types": [], "resources": []}, - "resource-explorer-2:Search": {"action": "resource-explorer-2:Search", "types": ["view"], "resources": [{"types": ["view"], "arn": "ViewArn"}]}, + "resource-explorer-2:Search": {"action": "resource-explorer-2:Search", "types": ["view"], "resources": [{"types": ["view"], "arn": "ViewArn"}, {"type": "view", "fill": {}, "when": {"ViewArn": [null]}, "default": true}]}, "resource-explorer-2:TagResource": {"action": "resource-explorer-2:TagResource", "types": ["index", "view"], "resources": [{"types": ["index", "view"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}}, "resource-explorer-2:UntagResource": {"action": "resource-explorer-2:UntagResource", "types": ["index", "view"], "resources": [{"types": ["index", "view"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}}, "resource-explorer-2:UpdateIndexType": {"action": "resource-explorer-2:UpdateIndexType", "types": ["index"], "resources": [{"types": ["index"], "arn": "Arn"}]}, @@ -3373,13 +3373,13 @@ "securityhub:BatchUpdateStandardsControlAssociations": {"action": "securityhub:BatchUpdateStandardsControlAssociations", "types": [], "resources": []}, "securityhub:CancelExportJobV2": {"action": "securityhub:CancelExportJobV2", "types": [], "resources": []}, "securityhub:CreateActionTarget": {"action": "securityhub:CreateActionTarget", "types": ["hub"], "resources": [{"type": "hub", "fill": {}}]}, - "securityhub:CreateAggregatorV2": {"action": "securityhub:CreateAggregatorV2", "types": [], "resources": []}, - "securityhub:CreateAutomationRule": {"action": "securityhub:CreateAutomationRule", "types": [], "resources": []}, - "securityhub:CreateAutomationRuleV2": {"action": "securityhub:CreateAutomationRuleV2", "types": [], "resources": []}, - "securityhub:CreateConfigurationPolicy": {"action": "securityhub:CreateConfigurationPolicy", "types": [], "resources": []}, - "securityhub:CreateConnector": {"action": "securityhub:CreateConnector", "types": [], "resources": []}, - "securityhub:CreateConnectorV2": {"action": "securityhub:CreateConnectorV2", "types": [], "resources": []}, - "securityhub:CreateFindingAggregator": {"action": "securityhub:CreateFindingAggregator", "types": [], "resources": []}, + "securityhub:CreateAggregatorV2": {"action": "securityhub:CreateAggregatorV2", "types": [], "resources": [], "makes": [{"type": "aggregatorv2", "fill": {}}]}, + "securityhub:CreateAutomationRule": {"action": "securityhub:CreateAutomationRule", "types": [], "resources": [], "makes": [{"type": "automation-rule", "fill": {}}]}, + "securityhub:CreateAutomationRuleV2": {"action": "securityhub:CreateAutomationRuleV2", "types": [], "resources": [], "makes": [{"type": "automation-rulev2", "fill": {}}]}, + "securityhub:CreateConfigurationPolicy": {"action": "securityhub:CreateConfigurationPolicy", "types": [], "resources": [], "makes": [{"type": "configuration-policy", "fill": {}}]}, + "securityhub:CreateConnector": {"action": "securityhub:CreateConnector", "types": [], "resources": [], "makes": [{"type": "connector", "fill": {}}]}, + "securityhub:CreateConnectorV2": {"action": "securityhub:CreateConnectorV2", "types": [], "resources": [], "makes": [{"type": "connectorv2", "fill": {}}]}, + "securityhub:CreateFindingAggregator": {"action": "securityhub:CreateFindingAggregator", "types": [], "resources": [], "makes": [{"type": "finding-aggregator", "fill": {}}]}, "securityhub:CreateInsight": {"action": "securityhub:CreateInsight", "types": ["hub"], "resources": [{"type": "hub", "fill": {}}]}, "securityhub:CreateMembers": {"action": "securityhub:CreateMembers", "types": ["hub"], "resources": [{"type": "hub", "fill": {}}]}, "securityhub:CreateTicketV2": {"action": "securityhub:CreateTicketV2", "types": ["connectorv2"], "resources": []}, @@ -3414,7 +3414,7 @@ "securityhub:EnableOrganizationAdminAccount": {"action": "securityhub:EnableOrganizationAdminAccount", "types": ["hub"], "resources": [{"type": "hub", "fill": {}}]}, "securityhub:EnableSecurityHub": {"action": "securityhub:EnableSecurityHub", "types": ["hub"], "resources": [{"type": "hub", "fill": {}}]}, "securityhub:EnableSecurityHubFeatureV2": {"action": "securityhub:EnableSecurityHubFeatureV2", "types": ["hubv2"], "resources": []}, - "securityhub:EnableSecurityHubV2": {"action": "securityhub:EnableSecurityHubV2", "types": [], "resources": []}, + "securityhub:EnableSecurityHubV2": {"action": "securityhub:EnableSecurityHubV2", "types": [], "resources": [], "makes": [{"type": "hubv2", "fill": {}}]}, "securityhub:GenerateRecommendedPolicyV2": {"action": "securityhub:GenerateRecommendedPolicyV2", "types": ["hubv2"], "resources": []}, "securityhub:GetAdministratorAccount": {"action": "securityhub:GetAdministratorAccount", "types": ["hub"], "resources": [{"type": "hub", "fill": {}}]}, "securityhub:GetAggregatorV2": {"action": "securityhub:GetAggregatorV2", "types": ["aggregatorv2"], "resources": [{"types": ["aggregatorv2"], "arn": "AggregatorV2Arn"}], "located": {"AggregatorV2Arn": "{AggregatorV2Arn}"}}, @@ -3464,7 +3464,7 @@ "securityhub:ListSecurityControlDefinitions": {"action": "securityhub:ListSecurityControlDefinitions", "types": [], "resources": []}, "securityhub:ListStandardsControlAssociations": {"action": "securityhub:ListStandardsControlAssociations", "types": [], "resources": []}, "securityhub:ListTagsForResource": {"action": "securityhub:ListTagsForResource", "types": ["automation-rule", "configuration-policy", "hub"], "resources": [{"types": ["automation-rule", "configuration-policy", "hub"], "arn": "ResourceArn"}], "located": {"ResourceArn": "{ResourceArn}"}}, - "securityhub:RegisterConnectorV2": {"action": "securityhub:RegisterConnectorV2", "types": [], "resources": []}, + "securityhub:RegisterConnectorV2": {"action": "securityhub:RegisterConnectorV2", "types": [], "resources": [], "makes": [{"type": "connectorv2", "fill": {}}]}, "securityhub:StartConfigurationPolicyAssociation": {"action": "securityhub:StartConfigurationPolicyAssociation", "types": ["hub"], "resources": [{"type": "hub", "fill": {}}]}, "securityhub:StartConfigurationPolicyDisassociation": {"action": "securityhub:StartConfigurationPolicyDisassociation", "types": ["hub"], "resources": [{"type": "hub", "fill": {}}]}, "securityhub:StartExportJobV2": {"action": "securityhub:StartExportJobV2", "types": ["hubv2"], "resources": []}, @@ -3483,9 +3483,9 @@ "securityhub:UpdateSecurityControl": {"action": "securityhub:UpdateSecurityControl", "types": [], "resources": []}, "securityhub:UpdateSecurityHubConfiguration": {"action": "securityhub:UpdateSecurityHubConfiguration", "types": ["hub"], "resources": [{"type": "hub", "fill": {}}]}, "securityhub:UpdateStandardsControl": {"action": "securityhub:UpdateStandardsControl", "types": ["hub"], "resources": [{"types": ["hub"], "arn": "StandardsControlArn"}, {"type": "hub", "fill": {}}], "located": {"StandardsControlArn": "{StandardsControlArn}"}}, - "servicediscovery:CreateHttpNamespace": {"action": "servicediscovery:CreateHttpNamespace", "types": [], "resources": []}, - "servicediscovery:CreatePrivateDnsNamespace": {"action": "servicediscovery:CreatePrivateDnsNamespace", "types": [], "resources": []}, - "servicediscovery:CreatePublicDnsNamespace": {"action": "servicediscovery:CreatePublicDnsNamespace", "types": [], "resources": []}, + "servicediscovery:CreateHttpNamespace": {"action": "servicediscovery:CreateHttpNamespace", "types": [], "resources": [], "makes": [{"type": "namespace", "fill": {}}]}, + "servicediscovery:CreatePrivateDnsNamespace": {"action": "servicediscovery:CreatePrivateDnsNamespace", "types": [], "resources": [], "makes": [{"type": "namespace", "fill": {}}]}, + "servicediscovery:CreatePublicDnsNamespace": {"action": "servicediscovery:CreatePublicDnsNamespace", "types": [], "resources": [], "makes": [{"type": "namespace", "fill": {}}]}, "servicediscovery:CreateService": {"action": "servicediscovery:CreateService", "types": ["namespace", "service"], "resources": [{"type": "namespace", "fill": {"NamespaceId": "NamespaceId"}, "unless": {"NamespaceId": [null]}}, {"type": "namespace", "fill": {"NamespaceId": "DnsConfig.NamespaceId"}, "when": {"NamespaceId": [null]}}, {"type": "service", "fill": {}, "made": true}]}, "servicediscovery:DeleteNamespace": {"action": "servicediscovery:DeleteNamespace", "types": ["namespace"], "resources": [{"type": "namespace", "fill": {"NamespaceId": "Id"}}]}, "servicediscovery:DeleteService": {"action": "servicediscovery:DeleteService", "types": ["service"], "resources": [{"type": "service", "fill": {"ServiceId": "Id"}}]}, @@ -3550,7 +3550,7 @@ "signer:ListSigningPlatforms": {"action": "signer:ListSigningPlatforms", "types": [], "resources": []}, "signer:ListSigningProfiles": {"action": "signer:ListSigningProfiles", "types": [], "resources": []}, "signer:ListTagsForResource": {"action": "signer:ListTagsForResource", "types": ["signing-profile"], "resources": [{"types": ["signing-profile"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}}, - "signer:PutSigningProfile": {"action": "signer:PutSigningProfile", "types": [], "resources": []}, + "signer:PutSigningProfile": {"action": "signer:PutSigningProfile", "types": [], "resources": [], "makes": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}}], "located": {"profileName": "{profileName}"}}, "signer:RemoveProfilePermission": {"action": "signer:RemoveProfilePermission", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}}], "located": {"profileName": "{profileName}"}}, "signer:RevokeSignature": {"action": "signer:RevokeSignature", "types": ["signing-job"], "resources": [{"type": "signing-job", "fill": {"JobId": "jobId"}, "account": "jobOwner"}], "located": {"jobId": "{jobId}"}}, "signer:RevokeSigningProfile": {"action": "signer:RevokeSigningProfile", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}}], "located": {"profileName": "{profileName}"}}, @@ -3622,7 +3622,7 @@ "sso:ListPermissionSets": {"action": "sso:ListPermissionSets", "types": ["Instance"], "resources": [{"types": ["Instance"], "arn": "InstanceArn"}]}, "sso:ListPermissionSetsProvisionedToAccount": {"action": "sso:ListPermissionSetsProvisionedToAccount", "types": ["Account", "Instance"], "resources": [{"types": ["Account", "Instance"], "arn": "InstanceArn"}, {"type": "Account", "fill": {"AccountId": "AccountId"}}]}, "sso:ListRegions": {"action": "sso:ListRegions", "types": ["Instance"], "resources": [{"types": ["Instance"], "arn": "InstanceArn"}]}, - "sso:ListTagsForResource": {"action": "sso:ListTagsForResource", "types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "resources": [{"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "InstanceArn"}, {"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "ResourceArn"}]}, + "sso:ListTagsForResource": {"action": "sso:ListTagsForResource", "types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "resources": [{"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "InstanceArn"}, {"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "ResourceArn"}, {"type": "Instance", "fill": {}, "when": {"InstanceArn": [null]}, "default": true}]}, "sso:ListTrustedTokenIssuers": {"action": "sso:ListTrustedTokenIssuers", "types": ["Instance"], "resources": [{"types": ["Instance"], "arn": "InstanceArn"}]}, "sso:Logout": {"action": "sso:Logout", "types": [], "resources": []}, "sso:ProvisionPermissionSet": {"action": "sso:ProvisionPermissionSet", "types": ["Account", "Instance", "PermissionSet"], "resources": [{"types": ["Account", "Instance", "PermissionSet"], "arn": "InstanceArn"}, {"types": ["Account", "Instance", "PermissionSet"], "arn": "PermissionSetArn"}, {"type": "Account", "fill": {"AccountId": "TargetId"}, "when": {"TargetType": ["AWS_ACCOUNT"]}}, {"types": ["Account"], "through": "PermissionSetArn", "when": {"TargetType": ["ALL_PROVISIONED_ACCOUNTS"]}}]}, @@ -3634,8 +3634,8 @@ "sso:PutInlinePolicyToPermissionSet": {"action": "sso:PutInlinePolicyToPermissionSet", "types": ["Instance", "PermissionSet"], "resources": [{"types": ["Instance", "PermissionSet"], "arn": "InstanceArn"}, {"types": ["Instance", "PermissionSet"], "arn": "PermissionSetArn"}]}, "sso:PutPermissionsBoundaryToPermissionSet": {"action": "sso:PutPermissionsBoundaryToPermissionSet", "types": ["Instance", "PermissionSet"], "resources": [{"types": ["Instance", "PermissionSet"], "arn": "InstanceArn"}, {"types": ["Instance", "PermissionSet"], "arn": "PermissionSetArn"}, {"types": ["Instance", "PermissionSet"], "arn": "PermissionsBoundary.ManagedPolicyArn"}]}, "sso:RemoveRegion": {"action": "sso:RemoveRegion", "types": ["Instance"], "resources": [{"types": ["Instance"], "arn": "InstanceArn"}]}, - "sso:TagResource": {"action": "sso:TagResource", "types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "resources": [{"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "InstanceArn"}, {"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "ResourceArn"}]}, - "sso:UntagResource": {"action": "sso:UntagResource", "types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "resources": [{"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "InstanceArn"}, {"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "ResourceArn"}]}, + "sso:TagResource": {"action": "sso:TagResource", "types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "resources": [{"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "InstanceArn"}, {"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "ResourceArn"}, {"type": "Instance", "fill": {}, "when": {"InstanceArn": [null]}, "default": true}]}, + "sso:UntagResource": {"action": "sso:UntagResource", "types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "resources": [{"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "InstanceArn"}, {"types": ["Application", "Instance", "PermissionSet", "TrustedTokenIssuer"], "arn": "ResourceArn"}, {"type": "Instance", "fill": {}, "when": {"InstanceArn": [null]}, "default": true}]}, "sso:UpdateApplication": {"action": "sso:UpdateApplication", "types": ["Application"], "resources": [{"types": ["Application"], "arn": "ApplicationArn"}]}, "sso:UpdateInstance": {"action": "sso:UpdateInstance", "types": ["Instance"], "resources": [{"types": ["Instance"], "arn": "EncryptionConfiguration.KmsKeyArn"}, {"types": ["Instance"], "arn": "InstanceArn"}]}, "sso:UpdateInstanceAccessControlAttributeConfiguration": {"action": "sso:UpdateInstanceAccessControlAttributeConfiguration", "types": ["Instance"], "resources": [{"types": ["Instance"], "arn": "InstanceArn"}]}, @@ -3657,7 +3657,7 @@ "states:GetActivityTask": {"action": "states:GetActivityTask", "types": ["activity"], "resources": [{"types": ["activity"], "arn": "activityArn"}]}, "states:GetExecutionHistory": {"action": "states:GetExecutionHistory", "types": ["execution"], "resources": [{"types": ["execution"], "arn": "executionArn"}]}, "states:ListActivities": {"action": "states:ListActivities", "types": [], "resources": []}, - "states:ListExecutions": {"action": "states:ListExecutions", "types": ["maprun", "statemachine"], "resources": [{"types": ["maprun", "statemachine"], "arn": "mapRunArn"}, {"types": ["maprun", "statemachine"], "arn": "stateMachineArn"}]}, + "states:ListExecutions": {"action": "states:ListExecutions", "types": ["maprun", "statemachine"], "resources": [{"types": ["maprun", "statemachine"], "arn": "mapRunArn"}, {"types": ["maprun", "statemachine"], "arn": "stateMachineArn"}, {"type": "maprun", "fill": {}, "when": {"mapRunArn": [null]}, "default": true}, {"type": "statemachine", "fill": {}, "when": {"stateMachineArn": [null]}, "default": true}]}, "states:ListMapRuns": {"action": "states:ListMapRuns", "types": ["execution"], "resources": [{"types": ["execution"], "arn": "executionArn"}]}, "states:ListStateMachineAliases": {"action": "states:ListStateMachineAliases", "types": ["statemachine"], "resources": [{"types": ["statemachine"], "arn": "stateMachineArn"}]}, "states:ListStateMachineVersions": {"action": "states:ListStateMachineVersions", "types": ["statemachine"], "resources": [{"types": ["statemachine"], "arn": "stateMachineArn"}]}, @@ -3681,7 +3681,7 @@ "textract:AnalyzeDocument": {"action": "textract:AnalyzeDocument", "types": [], "resources": []}, "textract:AnalyzeExpense": {"action": "textract:AnalyzeExpense", "types": [], "resources": []}, "textract:AnalyzeID": {"action": "textract:AnalyzeID", "types": [], "resources": []}, - "textract:CreateAdapter": {"action": "textract:CreateAdapter", "types": [], "resources": []}, + "textract:CreateAdapter": {"action": "textract:CreateAdapter", "types": [], "resources": [], "makes": [{"type": "adapter", "fill": {}}]}, "textract:CreateAdapterVersion": {"action": "textract:CreateAdapterVersion", "types": ["adapter"], "resources": [{"type": "adapter", "fill": {"AdapterId": "AdapterId"}}]}, "textract:DeleteAdapter": {"action": "textract:DeleteAdapter", "types": ["adapter"], "resources": [{"type": "adapter", "fill": {"AdapterId": "AdapterId"}}]}, "textract:DeleteAdapterVersion": {"action": "textract:DeleteAdapterVersion", "types": ["adapterversion"], "resources": [{"type": "adapterversion", "fill": {"AdapterId": "AdapterId", "AdapterVersion": "AdapterVersion"}}]}, @@ -3706,7 +3706,7 @@ "timestream-influxdb:CreateDbBackup": {"action": "timestream-influxdb:CreateDbBackup", "types": ["db-backup"], "resources": [{"type": "db-backup", "fill": {}}]}, "timestream-influxdb:CreateDbCluster": {"action": "timestream-influxdb:CreateDbCluster", "types": ["db-parameter-group"], "resources": [{"type": "db-parameter-group", "fill": {"DbParameterGroupIdentifier": "dbParameterGroupIdentifier"}}]}, "timestream-influxdb:CreateDbInstance": {"action": "timestream-influxdb:CreateDbInstance", "types": ["db-parameter-group"], "resources": [{"type": "db-parameter-group", "fill": {"DbParameterGroupIdentifier": "dbParameterGroupIdentifier"}}]}, - "timestream-influxdb:CreateDbParameterGroup": {"action": "timestream-influxdb:CreateDbParameterGroup", "types": [], "resources": []}, + "timestream-influxdb:CreateDbParameterGroup": {"action": "timestream-influxdb:CreateDbParameterGroup", "types": [], "resources": [], "makes": [{"type": "db-parameter-group", "fill": {}}]}, "timestream-influxdb:DeleteDbBackup": {"action": "timestream-influxdb:DeleteDbBackup", "types": ["db-backup"], "resources": [{"type": "db-backup", "fill": {"DbBackupId": "identifier"}}]}, "timestream-influxdb:DeleteDbCluster": {"action": "timestream-influxdb:DeleteDbCluster", "types": ["db-cluster"], "resources": [{"type": "db-cluster", "fill": {"DbClusterId": "dbClusterId"}}]}, "timestream-influxdb:DeleteDbInstance": {"action": "timestream-influxdb:DeleteDbInstance", "types": ["db-instance"], "resources": [{"type": "db-instance", "fill": {"DbInstanceIdentifier": "identifier"}}]}, diff --git a/src/test/java/io/floci/aws/core/common/RequestResourceMembersTest.java b/src/test/java/io/floci/aws/core/common/RequestResourceMembersTest.java index d30a28afe8..bccc112a11 100644 --- a/src/test/java/io/floci/aws/core/common/RequestResourceMembersTest.java +++ b/src/test/java/io/floci/aws/core/common/RequestResourceMembersTest.java @@ -305,6 +305,42 @@ class RequestResourceMembersTest { + "\"account\":\"registryId\"}")).operations().get("a:Op")); } + @Test + void aDefaultTheResourceACreateMakesAndAMapsFieldsAreReadAsWritten() { + String formats = "\"arnFormats\":{\"a\":{\"thing\":\"arn:${Partition}:a:${Region}:${Account}:thing/${ThingName}\"}}"; + // The one its service acts on for a request leaving out the member that would name it, read no other way. + String absent = "\"when\":{\"ThingArn\":[null]}"; + assertTrue(parseUnchecked(document(formats, "{\"type\":\"thing\",\"fill\":{}," + absent + ",\"default\":true}")) + .operations().get("a:Op").getFirst().byDefault()); + for (String bad : List.of("\"fill\":{}," + absent + ",\"default\":false", + "\"fill\":{\"ThingName\":\"Name\"}," + absent + ",\"default\":true", "\"fill\":{},\"default\":true", + "\"fill\":{}," + absent + ",\"default\":true,\"account\":\"registryId\"")) { + assertThrows(IllegalStateException.class, () -> parse(document(formats, "{\"type\":\"thing\"," + bad + "}")), + bad); + } + // The resource a create acting on no type makes, of its variables alone; and none for a create acting on one. + String makes = "\"makes\":[{\"type\":\"thing\",\"fill\":{\"ThingName\":\"Name\"}}]"; + assertEquals(List.of(new Resource(List.of("thing"), null, Map.of("ThingName", new Member("Name", false)), Map.of(), + Map.of(), Map.of(), Map.of(), null, null, Map.of(), false, null)), + parseUnchecked("{\"namespaces\":{\"a\":[]}," + formats + ",\"operations\":{\"a:Op\":{\"types\":[]," + + "\"resources\":[]," + makes + "}}}").makes().get("a:Op")); + for (String bad : List.of("\"types\":[\"thing\"],\"resources\":[]," + makes, "\"types\":[],\"resources\":[]," + + "\"makes\":[{\"type\":\"thing\",\"fill\":{},\"made\":true}]", "\"types\":[],\"resources\":[]," + + "\"makes\":[{\"types\":[\"thing\"],\"arn\":\"ThingArn\"}]")) { + assertThrows(IllegalStateException.class, () -> parse("{\"namespaces\":{\"a\":[]}," + formats + + ",\"operations\":{\"a:Op\":{" + bad + "}}}"), bad); + } + // A field of each of a map's structure values fills a variable, one value for each. + Member each = new Member("A", false, new Member("Name", false), true); + assertEquals(List.of(new Resource(List.of("thing"), null, Map.of("ThingName", each), Map.of(), Map.of(), Map.of(), + Map.of(), null, null, Map.of(), false, null)), + parseUnchecked(document(formats, "{\"type\":\"thing\",\"fill\":{\"ThingName\":\"A{}.Name\"}}")) + .operations().get("a:Op")); + assertEquals("A{}.Name", each.path()); + assertThrows(IllegalStateException.class, () -> parse(document(formats, + "{\"type\":\"thing\",\"fill\":{\"ThingName\":\"A{}.B{}.Name\"}}"))); + } + /** * Each resource alone, from a request naming it and nothing else, gives exactly its ARN, in the account its * account member names when it has one, with those sharing its explicit member selector, those the operation @@ -312,8 +348,9 @@ class RequestResourceMembersTest { * it is read from (a permission set made in an instance), and those a member it shares fills, their other * variables open (Redshift's {@code DeleteClusterSnapshot} names {@code cluster:} by the * {@code SnapshotClusterIdentifier} that also fills {@code snapshot:/}); one named through another - * resource of its service's own, the ARN its service gives for that. A member the table locates in a REST - * request's path or query is given there, and a body or a form giving it another value names nothing. + * resource of its service's own, the ARN its service gives for that, and so is one its service acts on for a + * request naming none of its type (a default view). A member the table locates in a REST request's path or query + * is given there, and a body or a form giving it another value names nothing. */ @TestFactory Stream everyResourceOfTheTableIsReadFromAJsonBodyAndAForm() { @@ -325,7 +362,7 @@ class RequestResourceMembersTest { ArnFormat format = table.formats().get(namespace).get(resource.types().getFirst()); String arn = example(format.format()); String account = resource.account() != null ? "111122223333" : "000000000000"; - String expected = resource.arn() != null || resource.through() != null ? arn + String expected = resource.arn() != null || resource.through() != null || resource.byDefault() ? arn : expected(format.format(), resource, account) + (format.minted() ? "/*" : ""); ObjectNode body = MAPPER.createObjectNode(); StringBuilder form = new StringBuilder("Action=" + name); @@ -370,7 +407,7 @@ class RequestResourceMembersTest { table.formats().get(namespace).get(other.types().getFirst()).format(), other, "000000000000", given.keySet())) .distinct().toList(); - StoredResourceArns stored = runningOn(namespace, arn); + StoredResourceArns stored = runningOn(namespace, arn, resource.byDefault()); assertEquals(named, RequestResources.of(operation.getKey(), sentWith(servedBy(json(body.toString()), resource.endpoint()), query), "aws", "us-east-1", "000000000000", stored, labels), body + " " + labels + " " + query); @@ -382,6 +419,36 @@ class RequestResourceMembersTest { }))); } + /** + * Each resource a create whose action acts on no type makes, from a request naming it, is where its tags go, and + * the create itself names none. + */ + @TestFactory + Stream everyResourceACreateActingOnNoTypeMakesIsWhereItsTagsGo() { + RequestResourceMembers.Table table = RequestResourceMembers.table(); + return table.makes().entrySet().stream().map(operation -> DynamicTest.dynamicTest(operation.getKey(), () -> { + String namespace = operation.getKey().substring(0, operation.getKey().indexOf(':')); + Resource made = operation.getValue().getFirst(); + ObjectNode body = MAPPER.createObjectNode(); + Map labels = new LinkedHashMap<>(); + Map located = table.located().getOrDefault(operation.getKey(), Map.of()); + made.fill().values().forEach(member -> { + String where = located.get(member.name()); + if (where != null && where.startsWith("{")) { + labels.put(where.substring(1, where.length() - 1), "x"); + } else { + put(body, member, "x"); + } + }); + String expected = expected(table.formats().get(namespace).get(made.types().getFirst()).format(), made, + "000000000000"); + assertEquals(List.of(expected), RequestResources.created(operation.getKey(), null, json(body.toString()), + "aws", "us-east-1", "000000000000", labels), body + " " + labels); + assertEquals(List.of(), RequestResources.of(operation.getKey(), json(body.toString()), "aws", + "us-east-1", "000000000000", null, labels)); + })); + } + /** Each resource a create makes under a parent, from a request naming the parent's ARN, is the parent's own. */ @TestFactory Stream everyResourceACreateMakesIsNamedFromItsParentsArn() { @@ -425,9 +492,17 @@ class RequestResourceMembersTest { && resource.through() == null && resource.when().isEmpty() && resource.unless().isEmpty(); } - /** A namespace's stored ARNs that find nothing, and give {@code arn} for whatever a request names a resource through. */ - private static StoredResourceArns runningOn(String namespace, String arn) { + /** + * A namespace's stored ARNs that find nothing, and give {@code arn} for whatever a request names a resource through + * and, when {@code defaults}, as the resource of any type the service acts on for a request naming none. + */ + private static StoredResourceArns runningOn(String namespace, String arn, boolean defaults) { return new StoredResourceArns() { + @Override + public Optional findDefault(String type, String region) { + return defaults ? Optional.of(arn) : Optional.empty(); + } + @Override public String namespace() { return namespace; diff --git a/src/test/java/io/floci/aws/core/common/RequestResourcesTest.java b/src/test/java/io/floci/aws/core/common/RequestResourcesTest.java index 2a27934f2f..a37635bd12 100644 --- a/src/test/java/io/floci/aws/core/common/RequestResourcesTest.java +++ b/src/test/java/io/floci/aws/core/common/RequestResourcesTest.java @@ -191,6 +191,125 @@ class RequestResourcesTest { json("{\"stateMachineArn\":\"" + machine + "\"}"))); } + /** + * An ARN naming another account whose service acts on that account's resource for the caller (the sink an OAM + * link is made to, a RAM invitation sent to it) is that resource alone, never the caller's of that name too; one + * the service holds no such resource under is still checked as the caller's own too. + */ + @Test + void anArnOfAnotherAccountItsServiceActsOnThereIsCheckedAsGivenAlone() { + String sink = "arn:aws:oam:us-east-1:111122223333:sink/abc"; + String invitation = "arn:aws:ram:us-east-1:111122223333:resource-share-invitation/i-1"; + String link = "{\"SinkIdentifier\":\"" + sink + "\",\"LabelTemplate\":\"$AccountName\"}"; + String accept = "{\"resourceShareInvitationArn\":\"" + invitation + "\"}"; + + assertEquals(List.of(sink), RequestResources.of("oam:CreateLink", json(link), "aws", "us-east-1", + "000000000000", reaching("oam", sink))); + assertEquals(List.of(invitation), RequestResources.of("ram:AcceptResourceShareInvitation", json(accept), "aws", + "us-east-1", "000000000000", reaching("ram", invitation))); + assertEquals(List.of(sink, "arn:aws:oam:us-east-1:000000000000:sink/abc"), RequestResources.of("oam:CreateLink", + json(link), "aws", "us-east-1", "000000000000", reaching("oam", "arn:aws:oam:us-east-1:111122223333:sink/x"))); + assertEquals(List.of(sink, "arn:aws:oam:us-east-1:000000000000:sink/abc"), of("oam:CreateLink", json(link))); + } + + /** + * A request leaving out the member naming the resource its service then uses one of its own for is checked on + * the one the service finds: Resource Explorer's {@code Search} and {@code ListResources} with no {@code ViewArn}, + * on the Region's default view; none when it has none, and the view a request names when it names one. + */ + @Test + void aRequestNamingNoViewIsCheckedOnTheDefaultViewItsServiceFinds() { + String view = "arn:aws:resource-explorer-2:us-east-1:000000000000:view/default-view/1"; + String named = "arn:aws:resource-explorer-2:us-east-1:000000000000:view/other/2"; + StoredResourceArns explorer = new StoredResourceArns() { + @Override + public String namespace() { + return "resource-explorer-2"; + } + + @Override + public Optional find(String type, List names, String region) { + return Optional.empty(); + } + + @Override + public Optional findDefault(String type, String region) { + return "view".equals(type) && "us-east-1".equals(region) ? Optional.of(view) : Optional.empty(); + } + }; + for (String operation : List.of("resource-explorer-2:Search", "resource-explorer-2:ListResources")) { + assertEquals(List.of(view), RequestResources.of(operation, json("{\"QueryString\":\"\"}"), "aws", + "us-east-1", "000000000000", explorer)); + assertEquals(List.of(view), RequestResources.of(operation, json("{\"ViewArn\":null}"), "aws", + "us-east-1", "000000000000", explorer)); + assertEquals(List.of(named), RequestResources.of(operation, json("{\"ViewArn\":\"" + named + "\"}"), "aws", + "us-east-1", "000000000000", explorer)); + assertEquals(List.of(), RequestResources.of(operation, json("{}"), "aws", "eu-west-1", "000000000000", + explorer)); + assertEquals(List.of(), of(operation, json("{}"))); + } + } + + /** + * A field of each value of a map of structures names one resource each, beside the others its request names: an + * FIS template's actions, by the {@code actionId} of each, as the template's create and update act on them. + */ + @Test + void eachValueOfAMapNamesTheResourceItsFieldNames() { + String prefix = "arn:aws:fis:us-east-1:000000000000:"; + String actions = "\"actions\":{\"stop\":{\"actionId\":\"aws:ec2:stop-instances\"}," + + "\"wait\":{\"actionId\":\"aws:fis:wait\",\"parameters\":{\"duration\":\"PT1M\"}}}"; + assertEquals(List.of(prefix + "experiment-template/*", prefix + "action/aws:ec2:stop-instances", + prefix + "action/aws:fis:wait"), of("fis:CreateExperimentTemplate", json("{" + actions + "}"))); + assertEquals(List.of(prefix + "experiment-template/EXT1", prefix + "action/aws:ec2:stop-instances", + prefix + "action/aws:fis:wait"), RequestResources.of("fis:UpdateExperimentTemplate", + json("{" + actions + "}"), "aws", "us-east-1", "000000000000", null, Map.of("id", "EXT1"))); + assertEquals(List.of(prefix + "experiment-template/EXT1"), RequestResources.of("fis:UpdateExperimentTemplate", + json("{\"actions\":{}}"), "aws", "us-east-1", "000000000000", null, Map.of("id", "EXT1"))); + } + + /** + * A create whose action acts on no type tags the resource it makes where its tagging action acts on that type, + * and is itself checked on {@code *}: Resource Explorer's {@code CreateView} tags its view; a Cloud Map namespace + * create, whose {@code TagResource} acts on no type, tags nothing of its own, so its tags go where it is checked. + */ + @Test + void aCreateActingOnNoTypeTagsWhatItMakesWhereItsTaggingActionActsOnIt() { + ContainerRequestContext view = json("{\"ViewName\":\"team\"}"); + String made = "arn:aws:resource-explorer-2:us-east-1:000000000000:view/team/*"; + assertEquals(List.of(made), RequestResources.created("resource-explorer-2:CreateView", + "resource-explorer-2:TagResource", view, "aws", "us-east-1", "000000000000", Map.of())); + assertEquals(List.of(made), created("resource-explorer-2:CreateView", view)); + assertEquals(List.of(), of("resource-explorer-2:CreateView", view)); + assertEquals(List.of("arn:aws:oam:us-east-1:000000000000:sink/*"), RequestResources.created("oam:CreateSink", + "oam:TagResource", json("{\"Name\":\"s\"}"), "aws", "us-east-1", "000000000000", Map.of())); + ContainerRequestContext namespace = json("{\"Name\":\"ns\"}"); + assertEquals(List.of(), RequestResources.created("servicediscovery:CreateHttpNamespace", + "servicediscovery:TagResource", namespace, "aws", "us-east-1", "000000000000", Map.of())); + assertEquals(List.of("arn:aws:servicediscovery:us-east-1:000000000000:namespace/*"), + created("servicediscovery:CreateHttpNamespace", namespace)); + } + + /** A namespace's stored ARNs that find nothing, and act on the resource {@code arn} names in its own account. */ + private static StoredResourceArns reaching(String namespace, String arn) { + return new StoredResourceArns() { + @Override + public String namespace() { + return namespace; + } + + @Override + public Optional find(String type, List names, String region) { + return Optional.empty(); + } + + @Override + public boolean reachedInItsAccount(String reached, String accountId) { + return reached.equals(arn) && "000000000000".equals(accountId); + } + }; + } + @Test void aTypesVariablesAreFilledFromTheRequestAndAListGivesAResourceForEachValue() { assertEquals(List.of("arn:aws:ecr:us-east-1:000000000000:repository/web", diff --git a/src/test/java/io/floci/aws/services/iam/IamRestRouteEnforcementIntegrationTest.java b/src/test/java/io/floci/aws/services/iam/IamRestRouteEnforcementIntegrationTest.java index b4c3ed7e88..b8634fa130 100644 --- a/src/test/java/io/floci/aws/services/iam/IamRestRouteEnforcementIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/iam/IamRestRouteEnforcementIntegrationTest.java @@ -44,6 +44,8 @@ class IamRestRouteEnforcementIntegrationTest { private static final String ACCOUNT = "000000000000"; /** The management account of an organization of this class's own, which no other test uses. */ private static final String MANAGEMENT = "731000000154"; + /** Another account, owning the sinks and shares this class's own account reaches across accounts. */ + private static final String PEER = "731000000162"; @TestHTTPResource("/") static URI baseUri; @@ -1069,6 +1071,146 @@ class IamRestRouteEnforcementIntegrationTest { "resource-explorer-2:GetView"); } + @Test + void createsActingOnNoResourceTypeAreCheckedForTheirTagsOnWhatTheyMake() { + String service = "resource-explorer-2"; + String user = user("route-made-tags"); + String views = "arn:aws:resource-explorer-2:us-east-1:" + ACCOUNT + ":view/*"; + String indexes = "arn:aws:resource-explorer-2:eu-west-2:" + ACCOUNT + ":index/*"; + String sinks = "arn:aws:oam:us-east-1:" + ACCOUNT + ":sink/*"; + String tags = "\"Tags\":{\"team\":\"red\"}"; + String creates = allow("resource-explorer-2:CreateView", "*") + "," + allow("resource-explorer-2:CreateIndex", "*") + + "," + allow("oam:CreateSink", "*"); + + // A tagging grant scoped to the type a create makes lets its tags through. + policy(user, creates + "," + allow("resource-explorer-2:TagResource", views) + "," + + allow("resource-explorer-2:TagResource", indexes) + "," + allow("oam:TagResource", sinks)); + String view = request(user, service, "POST", "/CreateView", + "{\"ViewName\":\"route-made-" + suffix() + "\"," + tags + "}").statusCode(200).extract().path("View.ViewArn"); + cleanup.register(() -> adminOf(service).body("{\"ViewArn\":\"" + view + "\"}").post("/DeleteView")); + String sink = request(user, "oam", "POST", "/CreateSink", "{\"Name\":\"route-made-" + suffix() + "\"," + tags + "}") + .statusCode(200).extract().path("Arn"); + cleanup.register(() -> adminOf("oam").body("{\"Identifier\":\"" + sink + "\"}").post("/DeleteSink")); + Response index = as(user, "eu-west-2", service).body("{" + tags + "}").post("/CreateIndex"); + index.then().statusCode(not(403)); + if (index.statusCode() == 200) { + String arn = index.path("Arn"); + cleanup.register(() -> given().header("Authorization", auth(ADMIN, "eu-west-2", service)) + .contentType("application/json").body("{\"Arn\":\"" + arn + "\"}").post("/DeleteIndex")); + } + + // A grant on another type, or a deny on the type made, refuses them. + policy(user, creates + "," + allow("resource-explorer-2:TagResource", indexes.replace("eu-west-2", "us-east-1")) + + "," + allow("oam:TagResource", "*") + "," + deny("oam:TagResource", sinks)); + refused(request(user, service, "POST", "/CreateView", "{\"ViewName\":\"route-made-" + suffix() + "\"," + tags + "}"), + "resource-explorer-2:TagResource"); + refused(as(user, "eu-west-2", service).body("{" + tags + "}").post("/CreateIndex").then(), + "resource-explorer-2:TagResource"); + refused(request(user, "oam", "POST", "/CreateSink", "{\"Name\":\"route-made-" + suffix() + "\"," + tags + "}"), + "oam:TagResource"); + } + + @Test + void oamCreateLinkIsCheckedOnTheSinkOfTheAccountItsArnNamesAlone() { + String sink = given().header("Authorization", auth(PEER, "oam")).contentType("application/json") + .body("{\"Name\":\"route-peer-" + suffix() + "\"}").post("/CreateSink") + .then().statusCode(200).extract().path("Arn"); + cleanup.register(() -> given().header("Authorization", auth(PEER, "oam")).contentType("application/json") + .body("{\"Identifier\":\"" + sink + "\"}").post("/DeleteSink")); + String sinkPolicy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"" + + ACCOUNT + "\"]},\"Action\":[\"oam:CreateLink\"],\"Resource\":\"*\"}]}"; + given().header("Authorization", auth(PEER, "oam")).contentType("application/json") + .body("{\"SinkIdentifier\":\"" + sink + "\",\"Policy\":\"" + sinkPolicy.replace("\"", "\\\"") + "\"}") + .post("/PutSinkPolicy").then().statusCode(200); + String user = user("route-oam-link"); + String action = "oam:CreateLink"; + String body = "{\"SinkIdentifier\":\"" + sink + "\",\"LabelTemplate\":\"$AccountName\"," + + "\"ResourceTypes\":[\"AWS::CloudWatch::Metric\"]}"; + + // The sink is the other account's, which the link is made to: a grant on a sink of that name of the caller's + // own is no grant on it. + policy(user, allow(action, sink.replace(PEER, ACCOUNT))); + refused(request(user, "oam", "POST", "/CreateLink", body), action); + policy(user, allow(action, "*") + "," + deny(action, sink)); + refused(request(user, "oam", "POST", "/CreateLink", body), action); + policy(user, allow(action, sink)); + String link = request(user, "oam", "POST", "/CreateLink", body).statusCode(200).extract().path("Arn"); + cleanup.register(() -> adminOf("oam").body("{\"Identifier\":\"" + link + "\"}").post("/DeleteLink")); + } + + @Test + void ramInvitationIsCheckedOnTheInvitationOfTheAccountThatSentIt() { + String share = given().header("Authorization", auth(PEER, "ram")).contentType("application/json") + .body("{\"name\":\"route-invite-" + suffix() + "\",\"principals\":[\"" + ACCOUNT + "\"]}") + .post("/createresourceshare").then().statusCode(200).extract().path("resourceShare.resourceShareArn"); + cleanup.register(() -> given().header("Authorization", auth(PEER, "ram")).queryParam("resourceShareArn", share) + .delete("/deleteresourceshare")); + String invitation = adminOf("ram").body("{\"resourceShareArns\":[\"" + share + "\"]}") + .post("/getresourceshareinvitations").then().statusCode(200) + .extract().path("resourceShareInvitations[0].resourceShareInvitationArn"); + String user = user("route-ram-invite"); + String action = "ram:AcceptResourceShareInvitation"; + String body = "{\"resourceShareInvitationArn\":\"" + invitation + "\"}"; + + policy(user, allow(action, invitation.replace(PEER, ACCOUNT))); + refused(request(user, "ram", "POST", "/acceptresourceshareinvitation", body), action); + policy(user, allow(action, invitation)); + request(user, "ram", "POST", "/acceptresourceshareinvitation", body).statusCode(200) + .body("resourceShareInvitation.status", equalTo("ACCEPTED")); + // The share it accepted is the other account's, whose permissions it reads there. + policy(user, allow("ram:ListResourceSharePermissions", share)); + request(user, "ram", "POST", "/listresourcesharepermissions", "{\"resourceShareArn\":\"" + share + "\"}") + .statusCode(200); + } + + @Test + void fisTemplatesAreCheckedOnTheActionsTheyName() { + String user = user("route-fis-actions"); + String create = "fis:CreateExperimentTemplate"; + String update = "fis:UpdateExperimentTemplate"; + String wait = "arn:aws:fis:us-east-1:" + ACCOUNT + ":action/aws:fis:wait"; + String templates = "arn:aws:fis:us-east-1:" + ACCOUNT + ":experiment-template/*"; + String template = "{\"clientToken\":\"" + suffix() + "\",\"description\":\"d\",\"roleArn\":\"arn:aws:iam::" + + ACCOUNT + ":role/fis\",\"stopConditions\":[{\"source\":\"none\"}],\"targets\":{},\"actions\":" + + "{\"wait\":{\"actionId\":\"aws:fis:wait\",\"parameters\":{\"duration\":\"PT1M\"}}}}"; + String actions = "{\"actions\":{\"wait\":{\"actionId\":\"aws:fis:wait\",\"parameters\":{\"duration\":\"PT2M\"}}}}"; + String passRole = allow("iam:PassRole", "*"); + + policy(user, allow(create, "*") + "," + deny(create, wait) + "," + passRole); + refused(request(user, "fis", "POST", "/experimentTemplates", template), create); + policy(user, allow(create, templates) + "," + passRole); + refused(request(user, "fis", "POST", "/experimentTemplates", template), create); + policy(user, allow(create, templates) + "," + allow(create, wait) + "," + passRole); + String id = request(user, "fis", "POST", "/experimentTemplates", template) + .statusCode(200).extract().path("experimentTemplate.id"); + cleanup.register(() -> adminOf("fis").delete("/experimentTemplates/" + id)); + + policy(user, allow(update, "*") + "," + deny(update, wait)); + refused(request(user, "fis", "PATCH", "/experimentTemplates/" + id, actions), update); + policy(user, allow(update, templates) + "," + allow(update, wait)); + request(user, "fis", "PATCH", "/experimentTemplates/" + id, actions).statusCode(200); + } + + @Test + void resourceExplorerSearchesNamingNoViewAreCheckedOnTheDefaultView() { + String service = "resource-explorer-2"; + String view = adminOf(service).body("{}").post("/GetDefaultView").then().statusCode(200).extract().path("ViewArn"); + String other = "arn:aws:resource-explorer-2:us-east-1:" + ACCOUNT + ":view/other/1"; + String user = user("route-re2-default"); + String action = "resource-explorer-2:Search"; + String search = "{\"QueryString\":\"\"}"; + + policy(user, allow(action, view)); + request(user, service, "POST", "/Search", search).statusCode(200); + request(user, service, "POST", "/ListResources", "{}").statusCode(200); + policy(user, allow(action, other)); + refused(request(user, service, "POST", "/Search", search), action); + refused(request(user, service, "POST", "/ListResources", "{}"), action); + policy(user, allow(action, "*") + "," + deny(action, view)); + refused(request(user, service, "POST", "/Search", search), action); + refused(request(user, service, "POST", "/ListResources", "{}"), action); + } + @Test void createsAreCheckedWithTheTagsTheyCarry() { // These three name too little to be created, so past the check the service refuses them; RAM makes the share. diff --git a/src/test/java/io/floci/aws/services/ram/RamServiceTest.java b/src/test/java/io/floci/aws/services/ram/RamServiceTest.java index b937b3bd4e..f3b309d319 100644 --- a/src/test/java/io/floci/aws/services/ram/RamServiceTest.java +++ b/src/test/java/io/floci/aws/services/ram/RamServiceTest.java @@ -282,6 +282,28 @@ class RamServiceTest { assertEquals("ACCEPTED", service.acceptResourceShareInvitation(invitationArn, ACCEPTER, "eu-west-1").status()); } + /** + * An invitation the owner sent the caller, and a share the owner holds, are acted on in the owner's account, so a + * request naming them is checked on their own ARNs; an invitation sent to another account, a deleted share, or no + * such resource, is not. + */ + @Test + void anInvitationOrAShareOfAnotherAccountIsReachedThereByTheAccountItIsFor() { + ResourceShare share = service.createResourceShare( + "reached", List.of(ACCEPTER), List.of(TGW_ARN), false, "us-east-1", OWNER); + String invitation = service.getResourceShareInvitations(ACCEPTER, List.of(), List.of(), "us-east-1") + .get(0).resourceShareInvitationArn(); + + assertEquals("ram", service.namespace()); + assertTrue(service.reachedInItsAccount(invitation, ACCEPTER)); + assertFalse(service.reachedInItsAccount(invitation, "333333333333")); + assertTrue(service.reachedInItsAccount(share.getResourceShareArn(), ACCEPTER)); + assertFalse(service.reachedInItsAccount("arn:aws:ram:us-east-1:" + OWNER + ":resource-share/absent", ACCEPTER)); + assertFalse(service.reachedInItsAccount("not-an-arn", ACCEPTER)); + service.deleteResourceShare(share.getResourceShareArn(), OWNER, "us-east-1"); + assertFalse(service.reachedInItsAccount(share.getResourceShareArn(), ACCEPTER)); + } + /** A resource share is regional: the listing operations answer for the request's region only. */ @Test void listingsAnswerForTheRequestsRegionOnly() { diff --git a/src/test/java/io/floci/aws/services/resourceexplorer2/ResourceExplorer2DefaultViewLookupTest.java b/src/test/java/io/floci/aws/services/resourceexplorer2/ResourceExplorer2DefaultViewLookupTest.java new file mode 100644 index 0000000000..968dbde7d6 --- /dev/null +++ b/src/test/java/io/floci/aws/services/resourceexplorer2/ResourceExplorer2DefaultViewLookupTest.java @@ -0,0 +1,115 @@ +package io.floci.aws.services.resourceexplorer2; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.floci.aws.core.common.RegionResolver; +import io.floci.aws.core.resource.ResourceProvider; +import io.floci.aws.core.storage.InMemoryStorage; +import io.floci.aws.core.storage.StorageBackend; +import io.floci.aws.services.resourceexplorer2.model.Index; +import io.floci.aws.services.resourceexplorer2.model.View; +import jakarta.enterprise.inject.Instance; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * The default view a request naming no view searches, as IAM reads it before the request runs: read without writing + * anything, and the view the request then searches, whatever another request associates in between. + */ +class ResourceExplorer2DefaultViewLookupTest { + + private static final String REGION = "us-east-1"; + private static final String ACCOUNT = "000000000000"; + private static final String VIEWS = "arn:aws:resource-explorer-2:" + REGION + ":" + ACCOUNT + ":view/"; + + private final StorageBackend indexStore = new InMemoryStorage<>(); + private final StorageBackend viewStore = new InMemoryStorage<>(); + private final StorageBackend defaultViewStore = new InMemoryStorage<>(); + @SuppressWarnings("unchecked") + private final Instance providers = mock(Instance.class); + private final RegionResolver regionResolver = new RegionResolver(REGION, ACCOUNT); + private final ResourceExplorer2Service service = new ResourceExplorer2Service(providers, regionResolver, + new ObjectMapper(), indexStore, viewStore, defaultViewStore, new InMemoryStorage<>(), + new ResourceExplorer2RequestContext()); + + @Test + void theDefaultViewIsReadWithoutProvisioningTheBaseline() { + // No index yet: a request naming no view would provision the baseline, whose view's id is not minted yet. + assertEquals(Optional.of(VIEWS + "default-view/*"), service.findDefault("view", REGION)); + assertTrue(indexStore.scan(key -> true).isEmpty()); + assertTrue(viewStore.scan(key -> true).isEmpty()); + assertTrue(defaultViewStore.get(REGION).isEmpty()); + + String provisioned = service.getDefaultView(REGION); + assertEquals(Optional.of(provisioned), service.findDefault("view", REGION)); + assertEquals(Optional.empty(), service.findDefault("index", REGION)); + assertEquals(Optional.empty(), service.findDefault("view", "eu-west-1")); + } + + @Test + void aRequestNamingNoViewSearchesTheDefaultViewItsCheckFound() { + when(providers.iterator()).thenAnswer(invocation -> List.of().iterator()); + String checked = service.getDefaultView(REGION); + String other = service.createView(REGION, "other", null, null, List.of(), Map.of()).viewArn(); + + assertEquals(Optional.of(checked), service.findDefault("view", REGION)); + service.associateDefaultView(REGION, other); + assertEquals(checked, service.search(null, null, null, null, REGION).path("ViewArn").asText()); + assertEquals(checked, service.listResources(null, null, null, null, REGION).path("ViewArn").asText()); + // A request no check read the default for searches the one it finds. + ResourceExplorer2Service unchecked = new ResourceExplorer2Service(providers, regionResolver, new ObjectMapper(), + indexStore, viewStore, defaultViewStore); + assertEquals(other, unchecked.search(null, null, null, null, REGION).path("ViewArn").asText()); + } + + @Test + void aBaselineTheCheckFoundAboutToBeProvisionedIsTheOneSearched() { + when(providers.iterator()).thenAnswer(invocation -> List.of().iterator()); + service.findDefault("view", REGION); + + String searched = service.search(null, null, null, null, REGION).path("ViewArn").asText(); + assertEquals(defaultViewStore.get(REGION).orElseThrow(), searched); + assertTrue(searched.startsWith(VIEWS + "default-view/"), searched); + } + + @Test + void concurrentFirstRequestsProvisionTheBaselineOnce() throws Exception { + int requests = 8; + CountDownLatch start = new CountDownLatch(1); + ExecutorService pool = Executors.newFixedThreadPool(requests); + Set defaults = new HashSet<>(); + try { + List> answers = new ArrayList<>(); + for (int i = 0; i < requests; i++) { + answers.add(pool.submit(() -> { + start.await(); + return service.getDefaultView(REGION); + })); + } + start.countDown(); + for (Future answer : answers) { + defaults.add(answer.get(30, TimeUnit.SECONDS)); + } + } finally { + pool.shutdownNow(); + } + assertEquals(1, defaults.size()); + assertEquals(1, indexStore.scan(key -> true).size()); + assertEquals(1, viewStore.scan(key -> true).size()); + } +} diff --git a/tools/aws/regen_iam_request_resources.py b/tools/aws/regen_iam_request_resources.py index ab4b63857f..1e5cc517c1 100644 --- a/tools/aws/regen_iam_request_resources.py +++ b/tools/aws/regen_iam_request_resources.py @@ -731,9 +731,11 @@ def _protocols(model: dict) -> set[str]: def with_absent_arn(resources: list[dict], formats: dict[str, str], optional: set[str]) -> list[dict]: - """Adds, for an optional top-level member holding the ARN of a type whose format has no variable of its own - (Security Hub's `hub/default`), that type for a request leaving the member out: there is one resource of the - type in the caller's account and Region, the one its service acts on then (`DescribeHub` with no `HubArn`).""" + """Adds, for an optional top-level member holding the ARN of a type, that type for a request leaving the member + out. A type whose format has no variable of its own (Security Hub's `hub/default`) has one resource in the caller's + account and Region, the one its service acts on then (`DescribeHub` with no `HubArn`). Any other is the one its + service uses for a request naming none (`default`), which the reader asks the service for, and none when it has + none: Resource Explorer's `Search` with no `ViewArn` searches with the Region's default view.""" named = {resource["type"] for resource in resources if "type" in resource} added = [] for resource in resources: @@ -742,12 +744,50 @@ def with_absent_arn(resources: list[dict], formats: dict[str, str], optional: se continue for kind in resource["types"]: variables = [v for v in VARIABLE_RE.findall(formats.get(kind, "")) if v not in KNOWN_VARIABLES] - if kind in formats and not variables and kind not in named and related(stem(member), stem(kind)): - added.append({"type": kind, "fill": {}, "when": {member: [None]}}) + if kind in formats and kind not in named and related(stem(member), stem(kind)): + added.append({"type": kind, "fill": {}, "when": {member: [None]}} if not variables + else {"type": kind, "fill": {}, "when": {member: [None]}, "default": True}) named.add(kind) return resources + added +def map_fields(models: dict[str, dict], operation: str) -> dict[str, str]: + """The fields of each value of a top-level map of structures in the operation's request body that hold a string and + end as an id, a name or an identifier, by their path, `Name{}.Field`, each with the field's name.""" + found: dict[str, str] = {} + for model in models.values(): + spec = model["operations"].get(operation) + if spec is None or "input" not in spec or _reading(model) != "all": + continue + for name, member in model["shapes"][spec["input"]["shape"]].get("members", {}).items(): + shape = model["shapes"][member["shape"]] + if member.get("location") not in BODY_LOCATIONS or shape["type"] != "map": + continue + value = model["shapes"][shape["value"]["shape"]] + for field, nested in value.get("members", {}).items() if value["type"] == "structure" else (): + if kind_of(field) and model["shapes"][nested["shape"]]["type"] == "string": + found.setdefault(f"{name}{{}}.{field}", field) + return found + + +def with_map_fields(resources: list[dict], types: list[str], formats: dict[str, str], + fields: dict[str, str]) -> list[dict]: + """The resources, and a type the action acts on whose format has one variable of its own and that no resource + names by its variables, named by the one field of each value of a map of structures named after it, one resource + for each value: FIS's `CreateExperimentTemplate` acts on each action its `actions` map names by `actionId`.""" + named = {resource["type"] for resource in resources if "type" in resource} + added = [] + for kind in types: + variables = [v for v in VARIABLE_RE.findall(formats.get(kind, "")) if v not in KNOWN_VARIABLES] + if kind in named or kind not in formats or len(variables) != 1: + continue + filling = [path for path, field in sorted(fields.items()) + if stem(field) == stem(kind) and compatible(field, variables[0])] + if len(filling) == 1: + added.append({"type": kind, "fill": {variables[0]: filling[0]}}) + return resources + added + + def with_absent_account(resources: list[dict], formats: dict[str, str], accounts: list[str], optional: set[str]) -> list[dict]: """The resources, a type whose format has no variable of its own applying only to a request that leaves out its @@ -1048,7 +1088,7 @@ def with_arn_of(resources: list[dict], formats: dict[str, str], members: dict[st arn_of = {member: named_by(members[member], formats) for member in sorted(read) if member in members} arn_of = {member: kind for member, kind in arn_of.items() if kind is not None} found.append(dict(resource, arnOf={**resource.get("arnOf", {}), **arn_of}) - if "fill" in resource and arn_of else resource) + if "fill" in resource and "default" not in resource and arn_of else resource) return found @@ -1086,7 +1126,7 @@ def with_account(resources: list[dict], formats: dict[str, str], accounts: list[ member is absent.""" if len(accounts) != 1: return resources - return [dict(resource, account=accounts[0]) if "fill" in resource + return [dict(resource, account=accounts[0]) if "fill" in resource and "default" not in resource and "${Account}" in formats.get(resource["type"], "") and resource.get("when", {}).get(accounts[0]) != [None] else resource for resource in resources] @@ -1246,6 +1286,25 @@ def creates_for(operation: str, types: list[str], formats: dict[str, str], membe return found +def makes_for(operation: str, types: list[str], formats: dict[str, str], members: dict[str, str], + arn_members: set[str] | None = None, labels: dict[str, str] | None = None) -> list[dict]: + """The resource a create whose action acts on no resource type makes: of the one type of its namespace named as + the operation is past its verb, or else related to that name, named as the rule names a type an action acts on, + its variables nothing fills open. AWS checks the tagging action a create's tags need on the resource being + tagged, so they are checked there (`CreateView` makes `view//*`, `CreateSink` `sink/*`), and the create + itself stays checked on `*`.""" + name = operation.split(":", 1)[1] + if types or not CREATING_RE.match(name): + return [] + created = stem(CREATING_RE.sub("", name)) + kinds = [kind for kind in formats if stem(kind) == created] \ + or [kind for kind in formats if related(created, stem(kind))] + if len(kinds) != 1: + return [] + return [resource for resource in resources_for(operation, kinds, formats, members, arn_members, labels) + if resource.get("type") == kinds[0]][:1] + + def by_members_key_is_empty(kinds: list[str], filled: dict[str, dict[str, str]]) -> bool: """Whether the types are named by no member at all: each a create's own type, all ids minted.""" return all(not filled[kind] for kind in kinds) @@ -1373,6 +1432,7 @@ def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: d resources = with_absent_arn(resources, formats, optional) resources = with_absent_account(resources, formats, account_members(models, operation.split(":", 1)[1]), optional) + resources = with_map_fields(resources, types, formats, map_fields(models, operation.split(":", 1)[1])) resources = with_account(resources, formats, account_members(models, operation.split(":", 1)[1])) resources = with_arn_of(resources, formats, name_or_arn_members(models, operation.split(":", 1)[1])) resources = with_made(resources, operation, formats) @@ -1380,7 +1440,11 @@ def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: d creates = creates_for(operation, types, formats, members) if creates: entry["creates"] = creates - named = _named(resources) | _named(creates) + makes = makes_for(operation, types, formats, members, arn_members, + path_labels(models, operation.split(":", 1)[1])) + if makes: + entry["makes"] = makes + named = _named(resources) | _named(creates) | _named(makes) located = {member: where for member, where in located_members(models, operation.split(":", 1)[1]).items() if member in named} if located: @@ -1587,7 +1651,8 @@ def render(document: dict) -> str: PATH_RE = re.compile(r"^[A-Za-z][A-Za-z0-9_]*(\[])?$") # A member filling a variable may also be a field of a structure, or of each element of a list of structures, one # value for each. -FILL_PATH_RE = re.compile(r"^[A-Za-z][A-Za-z0-9_]*(\[]|\[]\.[A-Za-z][A-Za-z0-9_]*|\.[A-Za-z][A-Za-z0-9_]*)?$") +FILL_PATH_RE = re.compile(r"^[A-Za-z][A-Za-z0-9_]*(\[]|\[]\.[A-Za-z][A-Za-z0-9_]*|\{}\.[A-Za-z][A-Za-z0-9_]*" + r"|\.[A-Za-z][A-Za-z0-9_]*)?$") # ARN paths can traverse structures, array elements ([]) and map values ({}). ARN_PATH_RE = re.compile(r"^(?:[A-Za-z][A-Za-z0-9_]*(\[])?(\.[A-Za-z][A-Za-z0-9_]*(\[])?)?" r"|[A-Za-z][A-Za-z0-9_]*\{\}(\.[A-Za-z][A-Za-z0-9_]*){1,2})$") @@ -1638,7 +1703,8 @@ def validate(document: dict) -> list[str]: if not OPERATION_RE.match(operation) or namespace not in namespaces: problems.append(f"{operation!r} is not an operation of a namespace the file reads") continue - if not isinstance(entry, dict) or not {"action", "types", "resources"} <= set(entry) <= {"action", "types", "resources", "creates", "located", "targets"}: + if not isinstance(entry, dict) or not {"action", "types", "resources"} <= set(entry) <= { + "action", "types", "resources", "creates", "makes", "located", "targets"}: problems.append(f"{operation} is not an action, its types and its resources") continue if not isinstance(entry["action"], str) or not OPERATION_RE.match(entry["action"]) \ @@ -1652,6 +1718,11 @@ def validate(document: dict) -> list[str]: problems += _resource_problems(operation, resource, set(types), formats.get(namespace, {})) for created in entry.get("creates", []) if isinstance(entry.get("creates", []), list) else [None]: problems += _created_problems(operation, created, set(types), formats.get(namespace, {})) + for made in entry.get("makes", []) if isinstance(entry.get("makes", []), list) else [None]: + if types or not isinstance(made, dict) or set(made) != {"type", "fill"}: + problems.append(f"{operation} makes {made!r}, which is no type's variables of a create acting on none") + else: + problems += _resource_problems(operation, made, {made["type"]}, formats.get(namespace, {})) targets = entry.get("targets") if targets is not None: if not isinstance(targets, dict) or set(targets) != {"member", "query", "prefixes"}: @@ -1685,8 +1756,12 @@ def _resource_problems(operation: str, resource: object, types: set[str], format or {"types", "through"} <= set(resource) <= {"types", "through", "when", "endpoint"} or {"type", "fill"} <= set(resource) <= {"type", "fill", "when", "unless", "absent", "arnOf", "account", - "fixed", "made", "before", "find", "endpoint"}): + "fixed", "made", "before", "find", "endpoint", + "default"}): return [f"{operation} names {resource!r}, which is neither an ARN member nor a type's variables"] + if "default" in resource and (resource["default"] is not True or resource["fill"] or not resource.get("when") + or set(resource) - {"type", "fill", "when", "default", "endpoint"}): + return [f"{operation} names {resource!r} as its service's default, which is not for a request naming none"] if "endpoint" in resource and not (isinstance(resource["endpoint"], str) and resource["endpoint"]): return [f"{operation} serves {resource!r} on {resource['endpoint']!r}, which is no endpoint prefix"] if resource.get("made", True) is not True: @@ -1718,7 +1793,7 @@ def _resource_problems(operation: str, resource: object, types: set[str], format if not isinstance(fill, dict) or set(fill) - variables or not all( isinstance(path, str) and FILL_PATH_RE.match(path) for path in fill.values()): return [f"{operation} fills {fill!r}, which are no variables of {kinds[0]}'s ARN by members"] - if sum("[]" in path for path in fill.values()) > 1: + if sum("[]" in path or "{}" in path for path in fill.values()) > 1: return [f"{operation} fills {kinds[0]} from more than one list"] fixed = resource.get("fixed", {}) if not isinstance(fixed, dict) or set(fixed) - variables or set(fixed) & set(fill) or not all( @@ -1760,7 +1835,7 @@ def _read_as_one(path: object, fill: dict) -> bool: field of each element of a list of structures that fills a variable, one value for each element.""" if not isinstance(path, str): return False - if "[]." in path: + if "[]." in path or "{}." in path: return bool(FILL_PATH_RE.match(path)) and path in fill.values() return bool(FILL_PATH_RE.match(path)) and not path.endswith("[]") diff --git a/tools/aws/test_regen_iam_request_resources.py b/tools/aws/test_regen_iam_request_resources.py index 64b87a3bcd..b13cc14cec 100644 --- a/tools/aws/test_regen_iam_request_resources.py +++ b/tools/aws/test_regen_iam_request_resources.py @@ -77,10 +77,66 @@ def test_an_optional_arn_member_of_a_type_without_variables_names_it_when_absent named = [{"types": ["catalog", "thing"], "arn": "CatalogArn"}] assert r.with_absent_arn(named, FORMATS, {"CatalogArn"}) == named + [ {"type": "catalog", "fill": {}, "when": {"CatalogArn": [None]}}] - # A required member is always there, and a type with a variable of its own names no one resource without it. + # A required member is always there. assert r.with_absent_arn(named, FORMATS, set()) == named - assert r.with_absent_arn([{"types": ["thing"], "arn": "ThingArn"}], FORMATS, {"ThingArn"}) == [ - {"types": ["thing"], "arn": "ThingArn"}] + + +def test_an_optional_arn_member_of_a_type_with_variables_names_its_services_default_when_absent(): + # Resource Explorer's Search with no ViewArn searches with the Region's default view, which its service finds. + named = [{"types": ["thing"], "arn": "ThingArn"}] + default = {"type": "thing", "fill": {}, "when": {"ThingArn": [None]}, "default": True} + assert r.with_absent_arn(named, FORMATS, {"ThingArn"}) == named + [default] + assert r.with_absent_arn(named, FORMATS, set()) == named + # A member named after another type names no default of this one, and the default takes no account member. + assert r.with_absent_arn([{"types": ["thing"], "arn": "PoolArn"}], FORMATS, {"PoolArn"}) == [ + {"types": ["thing"], "arn": "PoolArn"}] + assert r.with_account([default], FORMATS, ["registryId"]) == [default] + + +VIEWS = {"view": "arn:${Partition}:svc:${Region}:${Account}:view/${ViewName}/${ViewUuid}", + "managed-view": "arn:${Partition}:svc:${Region}:${Account}:managed-view/${ManagedViewName}/${ManagedViewUuid}", + "index": "arn:${Partition}:svc:${Region}:${Account}:index/${IndexUuid}", + "userpool": "arn:${Partition}:svc:${Region}:${Account}:userpool/${UserPoolId}", + "grouppool": "arn:${Partition}:svc:${Region}:${Account}:grouppool/${GroupPoolId}"} + + +def test_a_create_whose_action_acts_on_no_type_makes_the_one_named_as_it_is(): + # Its tags are checked on what it makes: the type of its own name before one ending with it, its ids open. + assert r.makes_for("svc:CreateView", [], VIEWS, members("ViewName", "ClientToken")) == [ + {"type": "view", "fill": {"ViewName": "ViewName"}}] + assert r.makes_for("svc:CreateIndex", [], VIEWS, members("ClientToken")) == [{"type": "index", "fill": {}}] + # A create whose action acts on types is checked on them, and an operation creating nothing makes nothing. + assert r.makes_for("svc:CreateView", ["view"], VIEWS, members("ViewName")) == [] + assert r.makes_for("svc:DescribeView", [], VIEWS, members("ViewName")) == [] + # Nor does a create named after no type, or one named after none exactly and related to two. + assert r.makes_for("svc:CreateSearch", [], VIEWS, {}) == [] + assert r.makes_for("svc:CreatePool", [], VIEWS, {}) == [] + + +def test_a_built_document_with_what_a_create_makes_a_default_and_a_maps_ids_validates(corrections, tmp_path): + service = model({"CreateThing": {"ThingName": "String"}, "ListThings": {"ThingArn": "String"}, "ApplySteps": {}}) + service["shapes"]["Step"] = {"type": "structure", "members": {"poolId": {"shape": "String"}, + "note": {"shape": "String"}}} + service["shapes"]["Steps"] = {"type": "map", "key": {"shape": "String"}, "value": {"shape": "Step"}} + service["shapes"]["ApplyStepsIn"]["members"]["steps"] = {"shape": "Steps"} + write_models(tmp_path, {"svc": service}) + documents = [reference("svc", {"CreateThing": [], "ListThings": ["thing"], "ApplySteps": ["pool"]}, + {"thing": FORMATS["thing"], "pool": FORMATS["pool"]})] + document = r.build(documents, "test", tmp_path, "botocore test") + assert r.validate(document) == [] and r.derive(document, tmp_path) == [] + operations = document["operations"] + assert operations["svc:CreateThing"] == {"action": "svc:CreateThing", "types": [], "resources": [], + "makes": [{"type": "thing", "fill": {"ThingName": "ThingName"}}]} + assert operations["svc:ListThings"]["resources"] == [ + {"types": ["thing"], "arn": "ThingArn"}, {"type": "thing", "fill": {}, "when": {"ThingArn": [None]}, "default": True}] + # A field of each value of a map of structures, named after a type the action acts on, names one of it each. + assert operations["svc:ApplySteps"]["resources"] == [{"type": "pool", "fill": {"PoolId": "steps{}.poolId"}}] + assert json.loads(r.render(document)) == document + # A create acting on types makes nothing this way, and a default is for a request naming none, by no member. + operations["svc:ListThings"]["makes"] = [{"type": "thing", "fill": {}}] + operations["svc:CreateThing"]["resources"] = [{"type": "thing", "fill": {"ThingName": "ThingName"}, + "when": {"ThingArn": [None]}, "default": True}] + assert len(r.validate(document)) == 2 def test_types_named_only_through_the_same_members_are_alternatives():