mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(ssm): keep document and association tags and tag them by resource type (#8132)
CreateDocument and CreateAssociation now keep their Tags, and AddTagsToResource, ListTagsForResource and RemoveTagsFromResource pick a document by name or an association by ID from ResourceType instead of always looking up a parameter. A document's tags are returned in its DocumentDescription and ListDocuments entry. Read the SSM tag calls, CreateDocument and CreateAssociation from the generated request-resource table instead of building their ARNs by hand. A ResourceType enum value now picks its resource type ignoring case and hyphens, ResourceId fills it whatever its kind, and a variable named for leaving out the leading slash drops it, as a parameter ARN does. Closes #7959
This commit is contained in:
1 parent
410ed8e817
commit
236e20003f
12 files changed
+501
-36
No files matched your search
@@ -19,15 +19,21 @@
|
||||
| `DescribeParameters` | List parameters with optional filters |
|
||||
| `LabelParameterVersion` | Attach a label to a specific version |
|
||||
| `UnlabelParameterVersion` | Remove labels from a specific version |
|
||||
| `AddTagsToResource` | Tag a parameter |
|
||||
| `ListTagsForResource` | List tags on a parameter |
|
||||
| `RemoveTagsFromResource` | Remove tags from a parameter |
|
||||
| `AddTagsToResource` | Tag a parameter, a document (by name) or an association (by ID), picked by `ResourceType` |
|
||||
| `ListTagsForResource` | List tags on a parameter, a document or an association |
|
||||
| `RemoveTagsFromResource` | Remove tags from a parameter, a document or an association |
|
||||
| `PutResourcePolicy` | Attach or update the resource policy of an Advanced-tier parameter |
|
||||
| `GetResourcePolicies` | List the resource policy attached to a parameter |
|
||||
| `DeleteResourcePolicy` | Remove a parameter's resource policy |
|
||||
| `DescribePatchBaselines` | List AWS-owned predefined patch baselines (filter by `OWNER`, `OPERATING_SYSTEM`, `NAME_PREFIX`) |
|
||||
| `GetDefaultPatchBaseline` | Get the default patch baseline id for an operating system |
|
||||
|
||||
`CreateDocument` and `CreateAssociation` keep their `Tags`. A document's tags are also returned in
|
||||
the `DocumentDescription` of `CreateDocument`, `UpdateDocument` and `DescribeDocument`, and in each
|
||||
`ListDocuments` entry. With IAM enforcement on, the tag calls are checked against the resource their
|
||||
`ResourceType` and `ResourceId` name: `document/<name>`, `association/<id>` or `parameter/<name>`
|
||||
without its leading `/`. `CreateDocument` is checked against `document/<name>`.
|
||||
|
||||
`DescribeParameters` includes the stored parameter's `ARN` in each metadata entry, matching
|
||||
`GetParameter`. This applies to filtered and paginated results as well.
|
||||
|
||||
|
||||
@@ -509,6 +509,7 @@ public final class RequestResources {
|
||||
for (Map.Entry<String, RequestResourceMembers.Member> variable : resource.fill().entrySet()) {
|
||||
List<String> values = read(resource, form, body, variable.getValue()).stream()
|
||||
.map(value -> withoutTypePath(before(value, resource.before()), resource.types().getFirst()))
|
||||
.map(value -> asVariable(variable.getKey(), value))
|
||||
.toList();
|
||||
if (values.isEmpty()) {
|
||||
continue;
|
||||
@@ -555,6 +556,14 @@ public final class RequestResources {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The value as the variable takes it: without the leading {@code /} a variable named for leaving it out drops,
|
||||
* as an SSM parameter's ARN names {@code /team/x} as {@code parameter/team/x}.
|
||||
*/
|
||||
static String asVariable(String variable, String value) {
|
||||
return variable.endsWith("WithoutLeadingSlash") && value.startsWith("/") ? value.substring(1) : value;
|
||||
}
|
||||
|
||||
/** The value without a leading {@code /<type>/}, the path a service may return an id of that type under. */
|
||||
static String withoutTypePath(String value, String type) {
|
||||
String path = "/" + type + "/";
|
||||
|
||||
@@ -657,7 +657,7 @@ public class SsmJsonHandler {
|
||||
String content = requireDocumentContent(request);
|
||||
String documentType = requireDocumentType(request);
|
||||
|
||||
SsmDocument document = ssmService.createDocument(name, content, documentType, region);
|
||||
SsmDocument document = ssmService.createDocument(name, content, documentType, requestTags(request), region);
|
||||
return Response.ok(documentDescriptionResponse(document)).build();
|
||||
}
|
||||
|
||||
@@ -695,6 +695,7 @@ public class SsmJsonHandler {
|
||||
description.put("Status", document.getStatus());
|
||||
description.put("LatestVersion", String.valueOf(document.getDocumentVersion()));
|
||||
description.put("DefaultVersion", String.valueOf(document.getDocumentVersion()));
|
||||
description.set("Tags", tagList(document.getTags()));
|
||||
response.set("DocumentDescription", description);
|
||||
return response;
|
||||
}
|
||||
@@ -794,6 +795,7 @@ public class SsmJsonHandler {
|
||||
if (d.getDocumentFormat() != null) {
|
||||
docNode.put("DocumentFormat", d.getDocumentFormat());
|
||||
}
|
||||
docNode.set("Tags", tagList(d.getTags()));
|
||||
docArray.add(docNode);
|
||||
}
|
||||
response.set("DocumentIdentifiers", docArray);
|
||||
@@ -863,7 +865,7 @@ public class SsmJsonHandler {
|
||||
|
||||
SsmAssociation assoc = ssmService.createAssociation(
|
||||
name, associationName, documentVersion, instanceId, targets, parameters, scheduleExpression,
|
||||
maxErrors, maxConcurrency, complianceSeverity, region);
|
||||
maxErrors, maxConcurrency, complianceSeverity, requestTags(request), region);
|
||||
|
||||
return Response.ok(associationDescriptionResponse(assoc)).build();
|
||||
}
|
||||
@@ -1200,40 +1202,40 @@ public class SsmJsonHandler {
|
||||
}
|
||||
|
||||
private Response handleAddTagsToResource(JsonNode request, String region) {
|
||||
String resourceId = request.path("ResourceId").asText();
|
||||
Map<String, String> tags = new LinkedHashMap<>();
|
||||
request.path("Tags").forEach(t ->
|
||||
tags.put(t.path("Key").asText(), t.path("Value").asText()));
|
||||
|
||||
ssmService.addTagsToResource(resourceId, tags, region);
|
||||
ssmService.addTagsToResource(request.path("ResourceType").asText(), request.path("ResourceId").asText(),
|
||||
requestTags(request), region);
|
||||
return Response.ok(objectMapper.createObjectNode()).build();
|
||||
}
|
||||
|
||||
private Response handleListTagsForResource(JsonNode request, String region) {
|
||||
String resourceId = request.path("ResourceId").asText();
|
||||
Map<String, String> tags = ssmService.listTagsForResource(resourceId, region);
|
||||
|
||||
Map<String, String> tags = ssmService.listTagsForResource(request.path("ResourceType").asText(),
|
||||
request.path("ResourceId").asText(), region);
|
||||
ObjectNode response = objectMapper.createObjectNode();
|
||||
ArrayNode tagsArray = objectMapper.createArrayNode();
|
||||
for (Map.Entry<String, String> entry : tags.entrySet()) {
|
||||
ObjectNode tagNode = objectMapper.createObjectNode();
|
||||
tagNode.put("Key", entry.getKey());
|
||||
tagNode.put("Value", entry.getValue());
|
||||
tagsArray.add(tagNode);
|
||||
}
|
||||
response.set("TagList", tagsArray);
|
||||
response.set("TagList", tagList(tags));
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
|
||||
private Response handleRemoveTagsFromResource(JsonNode request, String region) {
|
||||
String resourceId = request.path("ResourceId").asText();
|
||||
List<String> tagKeys = new ArrayList<>();
|
||||
request.path("TagKeys").forEach(k -> tagKeys.add(k.asText()));
|
||||
|
||||
ssmService.removeTagsFromResource(resourceId, tagKeys, region);
|
||||
ssmService.removeTagsFromResource(request.path("ResourceType").asText(), request.path("ResourceId").asText(),
|
||||
tagKeys, region);
|
||||
return Response.ok(objectMapper.createObjectNode()).build();
|
||||
}
|
||||
|
||||
/** A request's {@code Tags} list as a map; empty when it has none. */
|
||||
private static Map<String, String> requestTags(JsonNode request) {
|
||||
Map<String, String> tags = new LinkedHashMap<>();
|
||||
request.path("Tags").forEach(t -> tags.put(t.path("Key").asText(), t.path("Value").asText()));
|
||||
return tags;
|
||||
}
|
||||
|
||||
private ArrayNode tagList(Map<String, String> tags) {
|
||||
ArrayNode list = objectMapper.createArrayNode();
|
||||
tags.forEach((key, value) -> list.addObject().put("Key", key).put("Value", value));
|
||||
return list;
|
||||
}
|
||||
|
||||
private static final int GET_RESOURCE_POLICIES_MAX_RESULTS = 50;
|
||||
private static final String GET_RESOURCE_POLICIES_TOKEN = "GetResourcePolicies:";
|
||||
private static final String POLICY_PATTERN = "^(?!\\s*$).+";
|
||||
@@ -1604,6 +1606,7 @@ public class SsmJsonHandler {
|
||||
if (document.getCreatedDate() != null) {
|
||||
documentNode.put("CreatedDate", EpochSeconds.fromInstant(document.getCreatedDate()));
|
||||
}
|
||||
documentNode.set("Tags", tagList(document.getTags()));
|
||||
response.set("Document", documentNode);
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
@@ -1120,6 +1121,72 @@ public class SsmService implements ResourceProvider {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code AddTagsToResource} on the resource of {@code resourceType}: a document by its name, an
|
||||
* association by its ID, and a parameter, or any type Floci does not tag yet, as before.
|
||||
*/
|
||||
public synchronized void addTagsToResource(String resourceType, String resourceId, Map<String, String> tags,
|
||||
String region) {
|
||||
validateTagKeys(tags);
|
||||
if (!updateTags(resourceType, resourceId, region, current -> current.putAll(tags))) {
|
||||
addTagsToResource(resourceId, tags, region);
|
||||
}
|
||||
}
|
||||
|
||||
/** {@code ListTagsForResource} on the resource of {@code resourceType}. */
|
||||
public Map<String, String> listTagsForResource(String resourceType, String resourceId, String region) {
|
||||
return switch (resourceType) {
|
||||
case "Document" -> taggableDocument(resourceId, region).getTags();
|
||||
case "Association" -> taggableAssociation(resourceId, region).getTags();
|
||||
default -> listTagsForResource(resourceId, region);
|
||||
};
|
||||
}
|
||||
|
||||
/** {@code RemoveTagsFromResource} on the resource of {@code resourceType}; a key it lacks is ignored. */
|
||||
public synchronized void removeTagsFromResource(String resourceType, String resourceId, List<String> tagKeys,
|
||||
String region) {
|
||||
if (!updateTags(resourceType, resourceId, region, current -> tagKeys.forEach(current::remove))) {
|
||||
removeTagsFromResource(resourceId, tagKeys, region);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies {@code change} to the tags of the document or association {@code resourceId} names and stores
|
||||
* it; {@code false}, changing nothing, for any other {@code resourceType}.
|
||||
*/
|
||||
private boolean updateTags(String resourceType, String resourceId, String region,
|
||||
Consumer<Map<String, String>> change) {
|
||||
String storageKey = regionKey(region, resourceId);
|
||||
switch (resourceType) {
|
||||
case "Document" -> {
|
||||
SsmDocument document = taggableDocument(resourceId, region);
|
||||
change.accept(document.getTags());
|
||||
documentStore.put(storageKey, document);
|
||||
}
|
||||
case "Association" -> {
|
||||
SsmAssociation association = taggableAssociation(resourceId, region);
|
||||
change.accept(association.getTags());
|
||||
associationStore.put(storageKey, association);
|
||||
}
|
||||
default -> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private SsmDocument taggableDocument(String name, String region) {
|
||||
return documentStore.get(regionKey(region, name)).orElseThrow(() -> resourceNotFound(name));
|
||||
}
|
||||
|
||||
private SsmAssociation taggableAssociation(String associationId, String region) {
|
||||
return associationStore.get(regionKey(region, associationId)).orElseThrow(() -> resourceNotFound(associationId));
|
||||
}
|
||||
|
||||
private static AwsException resourceNotFound(String resourceId) {
|
||||
return new AwsException("InvalidResourceId", "Resource " + resourceId + " not found.", 400);
|
||||
}
|
||||
|
||||
public void addTagsToResource(String resourceId, Map<String, String> tags, String region) {
|
||||
validateTagKeys(tags);
|
||||
String storageKey = regionKey(region, parameterTagName(resourceId, region));
|
||||
@@ -1426,6 +1493,12 @@ public class SsmService implements ResourceProvider {
|
||||
}
|
||||
|
||||
public synchronized SsmDocument createDocument(String name, String content, String documentType, String region) {
|
||||
return createDocument(name, content, documentType, Map.of(), region);
|
||||
}
|
||||
|
||||
public synchronized SsmDocument createDocument(String name, String content, String documentType,
|
||||
Map<String, String> tags, String region) {
|
||||
validateTagKeys(tags);
|
||||
String storageKey = regionKey(region, name);
|
||||
if (documentStore.get(storageKey).isPresent()) {
|
||||
throw new AwsException("DocumentAlreadyExists",
|
||||
@@ -1433,6 +1506,7 @@ public class SsmService implements ResourceProvider {
|
||||
}
|
||||
SsmDocument document = new SsmDocument(name, content, documentType);
|
||||
document.setOwner(regionResolver.getAccountId());
|
||||
document.setTags(tags);
|
||||
documentStore.put(storageKey, document);
|
||||
return document;
|
||||
}
|
||||
@@ -1609,6 +1683,24 @@ public class SsmService implements ResourceProvider {
|
||||
String maxConcurrency,
|
||||
String complianceSeverity,
|
||||
String region) {
|
||||
return createAssociation(name, associationName, documentVersion, instanceId, targets, parameters,
|
||||
scheduleExpression, maxErrors, maxConcurrency, complianceSeverity, Map.of(), region);
|
||||
}
|
||||
|
||||
public synchronized SsmAssociation createAssociation(
|
||||
String name,
|
||||
String associationName,
|
||||
String documentVersion,
|
||||
String instanceId,
|
||||
List<SsmAssociation.Target> targets,
|
||||
Map<String, List<String>> parameters,
|
||||
String scheduleExpression,
|
||||
String maxErrors,
|
||||
String maxConcurrency,
|
||||
String complianceSeverity,
|
||||
Map<String, String> tags,
|
||||
String region) {
|
||||
validateTagKeys(tags);
|
||||
SsmDocument document = getDocument(name, region);
|
||||
validateDocumentVersion(document, documentVersion);
|
||||
|
||||
@@ -1644,6 +1736,7 @@ public class SsmService implements ResourceProvider {
|
||||
association.setMaxConcurrency(maxConcurrency);
|
||||
association.setComplianceSeverity(complianceSeverity);
|
||||
association.setAssociationVersion("1");
|
||||
association.setTags(tags);
|
||||
// Real SSM starts an association at "Pending" and transitions it to "Success"/"Failed" once
|
||||
// its execution engine runs it. This emulator has no execution engine, so it reports
|
||||
// "Success" immediately rather than modeling a state that would never change on its own.
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -61,6 +62,9 @@ public class SsmAssociation {
|
||||
@JsonProperty("AssociationVersion")
|
||||
private String associationVersion;
|
||||
|
||||
@JsonProperty("Tags")
|
||||
private Map<String, String> tags = new LinkedHashMap<>();
|
||||
|
||||
public SsmAssociation() {}
|
||||
|
||||
public SsmAssociation(
|
||||
@@ -224,6 +228,14 @@ public class SsmAssociation {
|
||||
this.associationVersion = associationVersion;
|
||||
}
|
||||
|
||||
public Map<String, String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(Map<String, String> tags) {
|
||||
this.tags = tags == null ? new LinkedHashMap<>() : new LinkedHashMap<>(tags);
|
||||
}
|
||||
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Target {
|
||||
|
||||
@@ -46,6 +46,9 @@ public class SsmDocument {
|
||||
@JsonProperty("Versions")
|
||||
private Map<String, String> versions = new LinkedHashMap<>();
|
||||
|
||||
@JsonProperty("Tags")
|
||||
private Map<String, String> tags = new LinkedHashMap<>();
|
||||
|
||||
public SsmDocument() {}
|
||||
|
||||
public SsmDocument(String name, String content, String documentType) {
|
||||
@@ -156,4 +159,12 @@ public class SsmDocument {
|
||||
public String getContentForVersion(String version) {
|
||||
return getVersions().get(version);
|
||||
}
|
||||
|
||||
public Map<String, String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(Map<String, String> tags) {
|
||||
this.tags = tags == null ? new LinkedHashMap<>() : new LinkedHashMap<>(tags);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.118 (installed package)", "retrieved": "2026-11-13", "note": "make iam-request-resources-check re-derives every operation's resources from botocore; make iam-request-resources-verify checks every action, type and format against AWS."},
|
||||
"namespaces": {"access-analyzer": ["accessanalyzer"], "account": ["account"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudfront": ["cloudfront"], "cloudfront-keyvaluestore": ["cloudfront-keyvaluestore"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "controlcatalog": ["controlcatalog"], "controltower": ["controltower"], "cur": ["cur"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ec2": ["ec2"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "emr-serverless": ["emr-serverless"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "fis": ["fis"], "globalaccelerator": ["globalaccelerator"], "guardduty": ["guardduty"], "inspector2": ["inspector2"], "kinesisanalytics": ["kinesisanalyticsv2"], "logs": ["logs"], "macie2": ["macie2"], "oam": ["oam"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "ram": ["ram"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-explorer-2": ["resource-explorer-2"], "route53": ["route53"], "securityhub": ["securityhub"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "signer": ["signer", "signer-data"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"], "xray": ["xray"]},
|
||||
"namespaces": {"access-analyzer": ["accessanalyzer"], "account": ["account"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudfront": ["cloudfront"], "cloudfront-keyvaluestore": ["cloudfront-keyvaluestore"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "controlcatalog": ["controlcatalog"], "controltower": ["controltower"], "cur": ["cur"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ec2": ["ec2"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "emr-serverless": ["emr-serverless"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "fis": ["fis"], "globalaccelerator": ["globalaccelerator"], "guardduty": ["guardduty"], "inspector2": ["inspector2"], "kinesisanalytics": ["kinesisanalyticsv2"], "logs": ["logs"], "macie2": ["macie2"], "oam": ["oam"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "ram": ["ram"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-explorer-2": ["resource-explorer-2"], "route53": ["route53"], "securityhub": ["securityhub"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "signer": ["signer", "signer-data"], "ssm": ["ssm"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"], "xray": ["xray"]},
|
||||
"clientsNotRead": {"kinesisanalytics": "Kinesis Data Analytics v1, SQL applications on the KinesisAnalytics_20150814 target, which Floci does not serve (it serves v2, kinesisanalyticsv2); its operations share v2's names and name their resources by other members"},
|
||||
"handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "ssm", "sts"],
|
||||
"notCovered": {"airflow": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appsync": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "aps": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "autoscaling": "not read yet: AWS's group and launch configuration ARNs carry an id the service mints, `autoScalingGroup:<id>:autoScalingGroupName/<name>`, while Floci mints `autoScalingGroup:<name>`, which other services (ECS capacity providers) read back; the mint is fixed first", "aws-marketplace": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "backup": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "batch": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudhsm": "not read yet: its ARN formats end in ${CloudHsmClusterInstanceName} and ${CloudHsmBackupInstanceName}, names, while its requests give ClusterId and BackupId, ids, which the rule does not fill a name from, so nearly every operation needs a correction", "cloudwatch": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codeartifact": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "codedeploy": "not read yet: the Service Reference gives an on-premises instance's ARN as `instance:${InstanceName}`, while the CodeDeploy permissions reference gives arn:aws:codedeploy:region:account-id:instance/instance-ID and AWS's GetOnPremisesInstance example answers instance/<name>_<id>, an id the service mints after the name; reading it needs that format corrected", "codeguru-reviewer": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "comprehend": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "config": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "connect": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "detective": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dlm": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2-instance-connect": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ecs": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticache": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticbeanstalk": "not read yet: an environment's ARN carries its application's name, `environment/<application>/<name>`, while most of its requests name it by EnvironmentName or EnvironmentId alone, so reaLine truncated
|
||||
"otherNamespaces": ["a4b", "account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifybackend", "amplifyuibuilder", "aoss", "appfabric", "appflow", "application-signals", "application-signals-mcp", "appmesh", "appmesh-preview", "apprunner", "appstream", "apptest", "arc-region-switch", "arc-zonal-shift", "artifact", "assurance", "auditmanager", "aws-external-anthropic", "b2bi", "backup-gateway", "backup-search", "bedrock-mantle", "bedrock-websearch", "billing", "billingconductor", "braket", "bugbust", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "clouddirectory", "cloudsearch", "cloudshell", "cloudtrail-data", "codecatalyst", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "codewhisperer", "cognito-sync", "connect-campaigns", "consoleapp", "continuum", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "devicefarm", "devops-guru", "directconnect", "docdb-elastic", "drs", "ds", "ds-data", "ebs", "ecr-public", "eks-auth", "elastictranscoder", "elemental-appliances-software", "elemental-inference", "elemental-support-cases", "emr-containers", "end-user-messaging", "entityresolution", "evs", "finspace", "finspace-api", "fms", "forecast", "frauddetector", "freertos", "fsx", "gamelift", "gameliftstreams", "geo", "geo-maps", "geo-places", "geo-routes", "glacier", "grafana", "greengrass", "groundstation", "health", "health-agent", "healthlake", "honeycode", "identity-sync", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotanalytics", "iotdeviceadvisor", "iotfleethub", "iotfleetwise", "iotjobsdata", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "iq", "iq-permission", "ivs", "ivschat", "kafka-cluster", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "lookoutmetrics", "lookoutvision", "m2", "machinelearning", "managedblockchain", "mapcredits", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgh", "mgn", "migrationhub-orchestrator", "mobiletargeting", "monitron", "mpa", "neptune-db", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "nimble", "notifications", "notifications-contacts", "nova-act", "observabilityadmin", "odb", "omics", "one", "opensearch", "opsworks", "osis", "outposts", "panorama", "partnercentral", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "rbin", "rds-db", "refactor-spaces", "repostspace", "resiliencehub", "robomaker", "rolesanywhere", "route53-recovery-cluster", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3-object-lambda", "s3-outposts", "s3express", "s3files", "sagemaker-geospatial", "sagemaker-mlflow", "savingsplans", "schemas", "scn", "sdb", "security-ir", "securityagent", "securitylake", "serverlessrepo", "shield", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "ssmmessages", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "tnb", "transform", "transform-custom", "trustedadvisor", "ts", "vendor-insights", "voiceid", "vpc-lattice", "vpc-lattice-svcs", "vpce", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workdocs", "worklink", "workmail", "workmailmessageflow", "workspaces", "workspaces-instances", "workspaces-web"],
|
||||
"arnFormats": {"access-analyzer": {"Analyzer": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}", "ArchiveRule": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}/archive-rule/${RuleName}"}, "account": {"account": "arn:${Partition}:account::${Account}:account", "accountInOrganization": "arn:${Partition}:account::${ManagementAccountId}:account/o-${OrganizationId}/${MemberAccountId}"}, "acm": {"acme-domain-validation": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-domain-validation/${AcmeDomainValidationId}", "acme-endpoint": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}", "acme-external-account-binding": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-external-account-binding/${ExternalAccountBindingId}", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/${CertificateId}"}, "application-autoscaling": {"ScalableTarget": "arn:${Partition}:application-autoscaling:${Region}:${Account}:scalable-target/${ResourceId}"}, "athena": {"capacity-reservation": "arn:${Partition}:athena:${Region}:${Account}:capacity-reservation/${CapacityReservationName}", "datacatalog": "arn:${Partition}:athena:${Region}:${Account}:datacatalog/${DataCatalogName}", "session": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}/session/${SessionId}", "system-table": "arn:${Partition}:athena:${Region}:${Account}:system-table/${TableName}", "workgroup": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}"}, "bcm-data-exports": {"billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "export": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:export/${Identifier}", "table": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:table/${Identifier}"}, "bcm-pricing-calculator": {"bill-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-estimate/${BillEstimateId}", "bill-scenario": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-scenario/${BillScenarioId}", "workload-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:workload-estimate/${WorkloadEstimateId}"}, "budgets": {"budget": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}", "budgetAction": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}/action/${ActionId}"}, "ce": {"anomalymonitor": "arn:${Partition}:ce::${Account}:anomalymonitor/${Identifier}", "anomalysubscription": "arn:${Partition}:ce::${Account}:anomalysubscription/${Identifier}", "billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "costcategory": "arn:${Partition}:ce::${Account}:costcategory/${Identifier}"}, "cloudfront": {"anycast-ip-list": "arn:${Partition}:cloudfront::${Account}:anycast-ip-list/${Id}", "cache-policy": "arn:${Partition}:cloudfront::${Account}:cache-policy/${Id}", "connection-function": "arn:${Partition}:cloudfront::${Account}:connection-function/${Id}", "connection-group": "arn:${Partition}:cloudfront::${Account}:connection-group/${Id}", "continuous-deployment-policy": "arn:${Partition}:cloudfront::${Account}:continuous-deployment-policy/${Id}", "distribution": "arn:${Partition}:cloudfront::${Account}:distribution/${DistributionId}", "distribution-tenant": "arn:${Partition}:cloudfront::${Account}:distribution-tenant/${Id}", "field-level-encryption-config": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-config/${Id}", "field-level-encryption-profile": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-profile/${Id}", "function": "arn:${Partition}:cloudfront::${Account}:function/${Name}", "key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${Name}", "origin-access-control": "arn:${Partition}:cloudfront::${Account}:origin-access-control/${Id}", "origin-access-identity": "arn:${Partition}:cloudfront::${Account}:origin-access-identity/${Id}", "origin-request-policy": "arn:${Partition}:cloudfront::${Account}:origin-request-policy/${Id}", "realtime-log-config": "arn:${Partition}:cloudfront::${Account}:realtime-log-config/${Name}", "response-headers-policy": "arn:${Partition}:cloudfront::${Account}:response-headers-policy/${Id}", "streaming-distribution": "arn:${Partition}:cloudfront::${Account}:streaming-distribution/${DistributionId}", "trust-store": "arn:${Partition}:cloudfront::${Account}:trust-store/${Id}", "vpcorigin": "arn:${Partition}:cloudfront::${Account}:vpcorigin/${Id}"}, "cloudfront-keyvaluestore": {"key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${ResourceId}"}, "cloudtrail": {"channel": "arn:${Partition}:cloudtrail:${Region}:${Account}:channel/${ChannelId}", "dashboard": "arn:${Partition}:cloudtrail:${Region}:${Account}:dashboard/${DashboardName}", "eventdatastore": "arn:${Partition}:cloudtrail:${Region}:${Account}:eventdatastore/${EventDataStoreId}", "trail": "arn:${Partition}:cloudtrail:${Line truncated
|
||||
"arnFormats": {"access-analyzer": {"Analyzer": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}", "ArchiveRule": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}/archive-rule/${RuleName}"}, "account": {"account": "arn:${Partition}:account::${Account}:account", "accountInOrganization": "arn:${Partition}:account::${ManagementAccountId}:account/o-${OrganizationId}/${MemberAccountId}"}, "acm": {"acme-domain-validation": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-domain-validation/${AcmeDomainValidationId}", "acme-endpoint": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}", "acme-external-account-binding": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-external-account-binding/${ExternalAccountBindingId}", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/${CertificateId}"}, "application-autoscaling": {"ScalableTarget": "arn:${Partition}:application-autoscaling:${Region}:${Account}:scalable-target/${ResourceId}"}, "athena": {"capacity-reservation": "arn:${Partition}:athena:${Region}:${Account}:capacity-reservation/${CapacityReservationName}", "datacatalog": "arn:${Partition}:athena:${Region}:${Account}:datacatalog/${DataCatalogName}", "session": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}/session/${SessionId}", "system-table": "arn:${Partition}:athena:${Region}:${Account}:system-table/${TableName}", "workgroup": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}"}, "bcm-data-exports": {"billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "export": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:export/${Identifier}", "table": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:table/${Identifier}"}, "bcm-pricing-calculator": {"bill-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-estimate/${BillEstimateId}", "bill-scenario": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-scenario/${BillScenarioId}", "workload-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:workload-estimate/${WorkloadEstimateId}"}, "budgets": {"budget": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}", "budgetAction": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}/action/${ActionId}"}, "ce": {"anomalymonitor": "arn:${Partition}:ce::${Account}:anomalymonitor/${Identifier}", "anomalysubscription": "arn:${Partition}:ce::${Account}:anomalysubscription/${Identifier}", "billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "costcategory": "arn:${Partition}:ce::${Account}:costcategory/${Identifier}"}, "cloudfront": {"anycast-ip-list": "arn:${Partition}:cloudfront::${Account}:anycast-ip-list/${Id}", "cache-policy": "arn:${Partition}:cloudfront::${Account}:cache-policy/${Id}", "connection-function": "arn:${Partition}:cloudfront::${Account}:connection-function/${Id}", "connection-group": "arn:${Partition}:cloudfront::${Account}:connection-group/${Id}", "continuous-deployment-policy": "arn:${Partition}:cloudfront::${Account}:continuous-deployment-policy/${Id}", "distribution": "arn:${Partition}:cloudfront::${Account}:distribution/${DistributionId}", "distribution-tenant": "arn:${Partition}:cloudfront::${Account}:distribution-tenant/${Id}", "field-level-encryption-config": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-config/${Id}", "field-level-encryption-profile": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-profile/${Id}", "function": "arn:${Partition}:cloudfront::${Account}:function/${Name}", "key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${Name}", "origin-access-control": "arn:${Partition}:cloudfront::${Account}:origin-access-control/${Id}", "origin-access-identity": "arn:${Partition}:cloudfront::${Account}:origin-access-identity/${Id}", "origin-request-policy": "arn:${Partition}:cloudfront::${Account}:origin-request-policy/${Id}", "realtime-log-config": "arn:${Partition}:cloudfront::${Account}:realtime-log-config/${Name}", "response-headers-policy": "arn:${Partition}:cloudfront::${Account}:response-headers-policy/${Id}", "streaming-distribution": "arn:${Partition}:cloudfront::${Account}:streaming-distribution/${DistributionId}", "trust-store": "arn:${Partition}:cloudfront::${Account}:trust-store/${Id}", "vpcorigin": "arn:${Partition}:cloudfront::${Account}:vpcorigin/${Id}"}, "cloudfront-keyvaluestore": {"key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${ResourceId}"}, "cloudtrail": {"channel": "arn:${Partition}:cloudtrail:${Region}:${Account}:channel/${ChannelId}", "dashboard": "arn:${Partition}:cloudtrail:${Region}:${Account}:dashboard/${DashboardName}", "eventdatastore": "arn:${Partition}:cloudtrail:${Region}:${Account}:eventdatastore/${EventDataStoreId}", "trail": "arn:${Partition}:cloudtrail:${Line truncated
|
||||
"unqualified": {"states": ["statemachine"]},
|
||||
"mintedIds": {"events": ["api-destination", "connection"]},
|
||||
"operations": {
|
||||
@@ -3558,6 +3558,11 @@
|
||||
"signer:StartSigningJob": {"action": "signer:StartSigningJob", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}, "account": "profileOwner"}]},
|
||||
"signer:TagResource": {"action": "signer:TagResource", "types": ["signing-profile"], "resources": [{"types": ["signing-profile"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}},
|
||||
"signer:UntagResource": {"action": "signer:UntagResource", "types": ["signing-profile"], "resources": [{"types": ["signing-profile"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}},
|
||||
"ssm:AddTagsToResource": {"action": "ssm:AddTagsToResource", "types": ["association", "automation-execution", "cloud-connector", "document", "instance", "maintenancewindow", "managed-instance", "opsitem", "opsmetadata", "parameter", "patchbaseline", "task"], "resources": [{"type": "association", "fill": {"AssociationId": "ResourceId"}, "when": {"ResourceType": ["Association"]}}, {"type": "cloud-connector", "fill": {"CloudConnectorId": "ResourceId"}, "when": {"ResourceType": ["CloudConnector"]}}, {"type": "document", "fill": {"DocumentName": "ResourceId"}, "when": {"ResourceType": ["Document"]}}, {"type": "maintenancewindow", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["MaintenanceWindow"]}}, {"type": "managed-instance", "fill": {"InstanceId": "ResourceId"}, "when": {"ResourceType": ["ManagedInstance"]}}, {"type": "opsitem", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsItem"]}}, {"type": "opsmetadata", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsMetadata"]}}, {"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "ResourceId"}, "when": {"ResourceType": ["Parameter"]}}, {"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "ResourceId"}, "when": {"ResourceType": ["PatchBaseline"]}}]},
|
||||
"ssm:CreateAssociation": {"action": "ssm:CreateAssociation", "types": ["association", "document", "instance", "managed-instance"], "resources": [{"type": "association", "fill": {}}]},
|
||||
"ssm:CreateDocument": {"action": "ssm:CreateDocument", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:ListTagsForResource": {"action": "ssm:ListTagsForResource", "types": ["association", "automation-execution", "cloud-connector", "document", "maintenancewindow", "managed-instance", "opsitem", "opsmetadata", "parameter", "patchbaseline"], "resources": [{"type": "association", "fill": {"AssociationId": "ResourceId"}, "when": {"ResourceType": ["Association"]}}, {"type": "cloud-connector", "fill": {"CloudConnectorId": "ResourceId"}, "when": {"ResourceType": ["CloudConnector"]}}, {"type": "document", "fill": {"DocumentName": "ResourceId"}, "when": {"ResourceType": ["Document"]}}, {"type": "maintenancewindow", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["MaintenanceWindow"]}}, {"type": "managed-instance", "fill": {"InstanceId": "ResourceId"}, "when": {"ResourceType": ["ManagedInstance"]}}, {"type": "opsitem", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsItem"]}}, {"type": "opsmetadata", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsMetadata"]}}, {"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "ResourceId"}, "when": {"ResourceType": ["Parameter"]}}, {"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "ResourceId"}, "when": {"ResourceType": ["PatchBaseline"]}}]},
|
||||
"ssm:RemoveTagsFromResource": {"action": "ssm:RemoveTagsFromResource", "types": ["association", "automation-execution", "cloud-connector", "document", "instance", "maintenancewindow", "managed-instance", "opsitem", "opsmetadata", "parameter", "patchbaseline", "task"], "resources": [{"type": "association", "fill": {"AssociationId": "ResourceId"}, "when": {"ResourceType": ["Association"]}}, {"type": "cloud-connector", "fill": {"CloudConnectorId": "ResourceId"}, "when": {"ResourceType": ["CloudConnector"]}}, {"type": "document", "fill": {"DocumentName": "ResourceId"}, "when": {"ResourceType": ["Document"]}}, {"type": "maintenancewindow", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["MaintenanceWindow"]}}, {"type": "managed-instance", "fill": {"InstanceId": "ResourceId"}, "when": {"ResourceType": ["ManagedInstance"]}}, {"type": "opsitem", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsItem"]}}, {"type": "opsmetadata", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsMetadata"]}}, {"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "ResourceId"}, "when": {"ResourceType": ["Parameter"]}}, {"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "ResourceId"}, "when": {"ResourceType": ["PatchBaseline"]}}]},
|
||||
"sso:AddRegion": {"action": "sso:AddRegion", "types": ["Instance"], "resources": [{"types": ["Instance"], "arn": "InstanceArn"}]},
|
||||
"sso:AttachCustomerManagedPolicyReferenceToPermissionSet": {"action": "sso:AttachCustomerManagedPolicyReferenceToPermissionSet", "types": ["Instance", "PermissionSet"], "resources": [{"types": ["Instance", "PermissionSet"], "arn": "InstanceArn"}, {"types": ["Instance", "PermissionSet"], "arn": "PermissionSetArn"}]},
|
||||
"sso:AttachManagedPolicyToPermissionSet": {"action": "sso:AttachManagedPolicyToPermissionSet", "types": ["Instance", "PermissionSet"], "resources": [{"types": ["Instance", "PermissionSet"], "arn": "InstanceArn"}, {"types": ["Instance", "PermissionSet"], "arn": "ManagedPolicyArn"}, {"types": ["Instance", "PermissionSet"], "arn": "PermissionSetArn"}]},
|
||||
|
||||
@@ -70,7 +70,7 @@ class RequestResourceMembersTest {
|
||||
RequestResourceMembers.Table table = RequestResourceMembers.table();
|
||||
assertTrue(table.namespaces().containsAll(List.of("cognito-idp", "ecr", "elasticloadbalancing", "states")));
|
||||
assertTrue(table.handBuilt().contains("lambda"));
|
||||
assertEquals(Set.of("dynamodb", "logs"), table.namespaces().stream().filter(table.handBuilt()::contains)
|
||||
assertEquals(Set.of("dynamodb", "logs", "ssm"), table.namespaces().stream().filter(table.handBuilt()::contains)
|
||||
.collect(Collectors.toSet()));
|
||||
Set<String> logsDelivery = Stream.of("PutDeliverySource", "GetDeliverySource", "DeleteDeliverySource",
|
||||
"DescribeDeliverySources", "PutDeliveryDestination", "GetDeliveryDestination",
|
||||
@@ -80,6 +80,8 @@ class RequestResourceMembersTest {
|
||||
Set<String> expected = new HashSet<>(logsDelivery);
|
||||
expected.add("dynamodb:ListTables");
|
||||
expected.add("logs:PutDestination");
|
||||
Stream.of("AddTagsToResource", "ListTagsForResource", "RemoveTagsFromResource", "CreateDocument",
|
||||
"CreateAssociation").forEach(operation -> expected.add("ssm:" + operation));
|
||||
assertEquals(expected, table.operations().keySet().stream()
|
||||
.filter(operation -> table.handBuilt().contains(operation.substring(0, operation.indexOf(':'))))
|
||||
.collect(Collectors.toSet()),
|
||||
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
package io.floci.aws.services.ssm;
|
||||
|
||||
import io.floci.aws.testing.AwsTestClients;
|
||||
import io.floci.aws.testing.EnforcementFixtures;
|
||||
import io.floci.aws.testing.IamEnforcementProfile;
|
||||
import io.floci.aws.testing.PartitionCleanup;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import io.restassured.RestAssured;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.ssm.SsmClient;
|
||||
import software.amazon.awssdk.services.ssm.model.DocumentType;
|
||||
import software.amazon.awssdk.services.ssm.model.InvalidDocumentException;
|
||||
import software.amazon.awssdk.services.ssm.model.ResourceTypeForTagging;
|
||||
import software.amazon.awssdk.services.ssm.model.SsmException;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static io.floci.aws.testing.EnforcementFixtures.auth;
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
/** Tagging a document or an association is checked against that document's or association's ARN. */
|
||||
@QuarkusTest
|
||||
@TestProfile(IamEnforcementProfile.class)
|
||||
class SsmDocumentAssociationTagsIamEnforcementIntegrationTest {
|
||||
|
||||
private static final String ACCOUNT = "000000000000";
|
||||
private static final String CONTENT = "{\"schemaVersion\":\"2.2\",\"description\":\"d\",\"mainSteps\":[{"
|
||||
+ "\"action\":\"aws:runShellScript\",\"name\":\"s\",\"inputs\":{\"runCommand\":[\"echo hi\"]}}]}";
|
||||
private static final String TAG_ACTIONS =
|
||||
"[\"ssm:AddTagsToResource\",\"ssm:ListTagsForResource\",\"ssm:RemoveTagsFromResource\"]";
|
||||
|
||||
@RegisterExtension
|
||||
final PartitionCleanup cleanup = new PartitionCleanup();
|
||||
|
||||
@Test
|
||||
void aGrantOnParametersDoesNotCoverDocumentsOrAssociations() {
|
||||
String suffix = UUID.randomUUID().toString().substring(0, 8);
|
||||
String allowedDocument = "iam-tags-allowed-" + suffix;
|
||||
String deniedDocument = "iam-tags-denied-" + suffix;
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
createDocument(root, allowedDocument);
|
||||
createDocument(root, deniedDocument);
|
||||
String allowedAssociation = createAssociation(root, allowedDocument);
|
||||
String deniedAssociation = createAssociation(root, deniedDocument);
|
||||
String userName = "ssm-tags-" + suffix;
|
||||
EnforcementFixtures.UserCredentials credentials = EnforcementFixtures.createUser(
|
||||
cleanup, RestAssured.port, auth(ACCOUNT, "iam"), userName);
|
||||
EnforcementFixtures.putUserPolicy(RestAssured.port, auth(ACCOUNT, "iam"), userName, "p", """
|
||||
{"Version":"2012-10-17","Statement":[
|
||||
{"Effect":"Allow","Action":%s,"Resource":[
|
||||
"arn:aws:ssm:*:*:parameter/*",
|
||||
"arn:aws:ssm:*:*:document/%s",
|
||||
"arn:aws:ssm:*:*:association/%s"]}]}"""
|
||||
.formatted(TAG_ACTIONS, allowedDocument, allowedAssociation));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
assertDoesNotThrow(() -> tag(user, ResourceTypeForTagging.DOCUMENT, allowedDocument));
|
||||
assertDoesNotThrow(() -> tag(user, ResourceTypeForTagging.ASSOCIATION, allowedAssociation));
|
||||
assertDoesNotThrow(() -> user.removeTagsFromResource(r -> r
|
||||
.resourceType(ResourceTypeForTagging.DOCUMENT).resourceId(allowedDocument).tagKeys("team")));
|
||||
|
||||
assertDenied(() -> tag(user, ResourceTypeForTagging.DOCUMENT, deniedDocument));
|
||||
assertDenied(() -> tag(user, ResourceTypeForTagging.ASSOCIATION, deniedAssociation));
|
||||
assertDenied(() -> user.listTagsForResource(r -> r
|
||||
.resourceType(ResourceTypeForTagging.DOCUMENT).resourceId(deniedDocument)));
|
||||
}
|
||||
} finally {
|
||||
root.deleteDocument(r -> r.name(allowedDocument).force(true));
|
||||
root.deleteDocument(r -> r.name(deniedDocument).force(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aParameterIsTaggedOnItsOwnArn() {
|
||||
String suffix = UUID.randomUUID().toString().substring(0, 8);
|
||||
String allowedParameter = "/iam-tags-" + suffix + "/allowed";
|
||||
String deniedParameter = "/iam-tags-" + suffix + "-other/denied";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(allowedParameter).value("v").type("String"));
|
||||
root.putParameter(r -> r.name(deniedParameter).value("v").type("String"));
|
||||
String userName = "ssm-param-tags-" + suffix;
|
||||
EnforcementFixtures.UserCredentials credentials = EnforcementFixtures.createUser(
|
||||
cleanup, RestAssured.port, auth(ACCOUNT, "iam"), userName);
|
||||
EnforcementFixtures.putUserPolicy(RestAssured.port, auth(ACCOUNT, "iam"), userName, "p", """
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":%s,
|
||||
"Resource":"arn:aws:ssm:*:*:parameter/iam-tags-%s/*"}]}"""
|
||||
.formatted(TAG_ACTIONS, suffix));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
assertDoesNotThrow(() -> tag(user, ResourceTypeForTagging.PARAMETER, allowedParameter));
|
||||
assertDenied(() -> tag(user, ResourceTypeForTagging.PARAMETER, deniedParameter));
|
||||
}
|
||||
} finally {
|
||||
root.deleteParameters(r -> r.names(allowedParameter, deniedParameter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDocumentIsCreatedWithTagsOnItsOwnArn() {
|
||||
String suffix = UUID.randomUUID().toString().substring(0, 8);
|
||||
String allowedDocument = "iam-create-allowed-" + suffix;
|
||||
String deniedDocument = "iam-create-denied-" + suffix;
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
String userName = "ssm-create-" + suffix;
|
||||
EnforcementFixtures.UserCredentials credentials = EnforcementFixtures.createUser(
|
||||
cleanup, RestAssured.port, auth(ACCOUNT, "iam"), userName);
|
||||
EnforcementFixtures.putUserPolicy(RestAssured.port, auth(ACCOUNT, "iam"), userName, "p", """
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow",
|
||||
"Action":["ssm:CreateDocument","ssm:AddTagsToResource"],
|
||||
"Resource":"arn:aws:ssm:*:*:document/%s"}]}"""
|
||||
.formatted(allowedDocument));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
assertDoesNotThrow(() -> user.createDocument(r -> r.name(allowedDocument)
|
||||
.documentType(DocumentType.COMMAND).content(CONTENT)
|
||||
.tags(t -> t.key("team").value("red"))));
|
||||
assertDenied(() -> user.createDocument(r -> r.name(deniedDocument)
|
||||
.documentType(DocumentType.COMMAND).content(CONTENT)
|
||||
.tags(t -> t.key("team").value("red"))));
|
||||
}
|
||||
} finally {
|
||||
deleteIfPresent(root, allowedDocument);
|
||||
deleteIfPresent(root, deniedDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void deleteIfPresent(SsmClient root, String document) {
|
||||
try {
|
||||
root.deleteDocument(r -> r.name(document).force(true));
|
||||
} catch (InvalidDocumentException expected) {
|
||||
// The document was never created, which is what a denied create leaves.
|
||||
}
|
||||
}
|
||||
|
||||
private static void tag(SsmClient ssm, ResourceTypeForTagging type, String id) {
|
||||
ssm.addTagsToResource(r -> r.resourceType(type).resourceId(id).tags(t -> t.key("team").value("red")));
|
||||
}
|
||||
|
||||
private static void assertDenied(Runnable call) {
|
||||
SsmException error = assertThrows(SsmException.class, call::run);
|
||||
assertEquals("AccessDeniedException", error.awsErrorDetails().errorCode());
|
||||
}
|
||||
|
||||
private static void createDocument(SsmClient root, String name) {
|
||||
root.createDocument(r -> r.name(name).documentType(DocumentType.COMMAND).content(CONTENT));
|
||||
}
|
||||
|
||||
private static String createAssociation(SsmClient root, String document) {
|
||||
return root.createAssociation(r -> r.name(document)
|
||||
.targets(t -> t.key("InstanceIds").values("i-0123456789abcdef0")))
|
||||
.associationDescription().associationId();
|
||||
}
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
package io.floci.aws.services.ssm;
|
||||
|
||||
import io.floci.aws.testing.AwsTestClients;
|
||||
import io.floci.aws.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.ssm.SsmClient;
|
||||
import software.amazon.awssdk.services.ssm.model.DocumentIdentifier;
|
||||
import software.amazon.awssdk.services.ssm.model.DocumentType;
|
||||
import software.amazon.awssdk.services.ssm.model.InvalidResourceIdException;
|
||||
import software.amazon.awssdk.services.ssm.model.ResourceTypeForTagging;
|
||||
import software.amazon.awssdk.services.ssm.model.Tag;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
@QuarkusTest
|
||||
class SsmDocumentAssociationTagsIntegrationTest {
|
||||
|
||||
private static final String ACCOUNT = "100000007959";
|
||||
private static final String CONTENT = "{\"schemaVersion\":\"2.2\",\"description\":\"d\",\"mainSteps\":[{"
|
||||
+ "\"action\":\"aws:runShellScript\",\"name\":\"s\",\"inputs\":{\"runCommand\":[\"echo hi\"]}}]}";
|
||||
|
||||
private SsmClient ssm;
|
||||
private String documentName;
|
||||
|
||||
@BeforeAll
|
||||
static void configureRestAssured() {
|
||||
RestAssuredJsonUtils.configureAwsContentTypes();
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void createClient() {
|
||||
ssm = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1);
|
||||
documentName = "tag-doc-" + UUID.randomUUID().toString().substring(0, 8);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void closeClient() {
|
||||
ssm.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void tagsGivenToCreateDocumentAreListedAndReturnedWithTheDocument() {
|
||||
List<Tag> created = ssm.createDocument(r -> r.name(documentName).documentType(DocumentType.COMMAND)
|
||||
.content(CONTENT).tags(tag("team", "red"))).documentDescription().tags();
|
||||
|
||||
assertEquals(List.of(tag("team", "red")), created);
|
||||
assertEquals(List.of(tag("team", "red")), listTags(ResourceTypeForTagging.DOCUMENT, documentName));
|
||||
given()
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.header("X-Amz-Target", "AmazonSSM.DescribeDocument")
|
||||
.header("Authorization",
|
||||
"AWS4-HMAC-SHA256 Credential=" + ACCOUNT + "/20260101/us-east-1/ssm/aws4_request")
|
||||
.body("{\"Name\":\"" + documentName + "\"}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("Document.Tags[0].Key", equalTo("team"))
|
||||
.body("Document.Tags[0].Value", equalTo("red"));
|
||||
DocumentIdentifier listed = ssm.listDocuments(r -> r.filters(f -> f.key("Name").values(documentName)))
|
||||
.documentIdentifiers().get(0);
|
||||
assertEquals(List.of(tag("team", "red")), listed.tags());
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDocumentIsTaggedAndUntaggedByName() {
|
||||
createDocument();
|
||||
|
||||
ssm.addTagsToResource(r -> r.resourceType(ResourceTypeForTagging.DOCUMENT).resourceId(documentName)
|
||||
.tags(tag("env", "dev"), tag("team", "blue")));
|
||||
ssm.removeTagsFromResource(r -> r.resourceType(ResourceTypeForTagging.DOCUMENT).resourceId(documentName)
|
||||
.tagKeys("env"));
|
||||
|
||||
assertEquals(List.of(tag("team", "blue")), listTags(ResourceTypeForTagging.DOCUMENT, documentName));
|
||||
}
|
||||
|
||||
@Test
|
||||
void tagsGivenToCreateAssociationAreListedAndTheAssociationCanBeRetagged() {
|
||||
createDocument();
|
||||
String associationId = ssm.createAssociation(r -> r.name(documentName)
|
||||
.targets(t -> t.key("InstanceIds").values("i-0123456789abcdef0"))
|
||||
.tags(tag("team", "red")))
|
||||
.associationDescription().associationId();
|
||||
|
||||
assertEquals(List.of(tag("team", "red")), listTags(ResourceTypeForTagging.ASSOCIATION, associationId));
|
||||
|
||||
ssm.addTagsToResource(r -> r.resourceType(ResourceTypeForTagging.ASSOCIATION).resourceId(associationId)
|
||||
.tags(tag("team", "blue"), tag("env", "dev")));
|
||||
ssm.removeTagsFromResource(r -> r.resourceType(ResourceTypeForTagging.ASSOCIATION)
|
||||
.resourceId(associationId).tagKeys("env"));
|
||||
|
||||
assertEquals(List.of(tag("team", "blue")), listTags(ResourceTypeForTagging.ASSOCIATION, associationId));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aMissingDocumentOrAssociationAnswersInvalidResourceId() {
|
||||
assertThrows(InvalidResourceIdException.class,
|
||||
() -> listTags(ResourceTypeForTagging.DOCUMENT, documentName + "-missing"));
|
||||
assertThrows(InvalidResourceIdException.class,
|
||||
() -> listTags(ResourceTypeForTagging.ASSOCIATION, UUID.randomUUID().toString()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aParameterIsStillTaggedByName() {
|
||||
String parameter = "/tags/" + documentName;
|
||||
ssm.putParameter(r -> r.name(parameter).value("v").type("String").tags(tag("team", "red")));
|
||||
|
||||
assertEquals(List.of(tag("team", "red")), listTags(ResourceTypeForTagging.PARAMETER, parameter));
|
||||
}
|
||||
|
||||
private void createDocument() {
|
||||
ssm.createDocument(r -> r.name(documentName).documentType(DocumentType.COMMAND).content(CONTENT));
|
||||
}
|
||||
|
||||
private List<Tag> listTags(ResourceTypeForTagging type, String id) {
|
||||
return ssm.listTagsForResource(r -> r.resourceType(type).resourceId(id)).tagList();
|
||||
}
|
||||
|
||||
private static Tag tag(String key, String value) {
|
||||
return Tag.builder().key(key).value(value).build();
|
||||
}
|
||||
}
|
||||
@@ -220,6 +220,12 @@ READ_IN_HAND_BUILT["logs:PutDestination"] = (
|
||||
"CloudWatch Logs destination creation names the destination by destinationName, which ResourceArnBuilder "
|
||||
"reads from the generated request-resource table")
|
||||
|
||||
_SSM_TAGS = ("SSM tagging: a request names its resource by ResourceType and ResourceId, or tags the document or "
|
||||
"association it creates, which the rule reads, while ResourceArnBuilder keeps building the parameter ARNs")
|
||||
READ_IN_HAND_BUILT.update({f"ssm:{operation}": _SSM_TAGS
|
||||
for operation in ("AddTagsToResource", "ListTagsForResource", "RemoveTagsFromResource",
|
||||
"CreateDocument", "CreateAssociation")})
|
||||
|
||||
_LATER = "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint"
|
||||
_REST = ("REST: its requests name their resources in the path, which RequestResources reads from the route a request "
|
||||
"matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet")
|
||||
@@ -898,28 +904,35 @@ def enum_members(models: dict[str, dict], operation: str) -> dict[str, set[str]]
|
||||
def picked_by_enum(types: list[str], formats: dict[str, str], members: dict[str, str],
|
||||
enums: dict[str, set[str]]) -> list[dict] | None:
|
||||
"""The resources of a request a member of which picks the type: one whose enum lists two or more of the action's
|
||||
types (Route 53's tag calls name a `ResourceType` of `healthcheck` or `hostedzone`). Each type it lists is filled
|
||||
from the member naming whatever the action acts on (`ResourceId`) when the request holds that type; None when no
|
||||
member picks a type, or no member names the resource."""
|
||||
types, a value naming a type when it matches it ignoring case and hyphens (Route 53's tag calls name a
|
||||
`ResourceType` of `healthcheck` or `hostedzone`, SSM's a `Document` or a `ManagedInstance`). Each type it lists is
|
||||
filled from the member naming whatever the action acts on (`ResourceId`), whatever kind of value the type's
|
||||
variable is, when the request holds that value; None when no member picks a type, or no member names the
|
||||
resource."""
|
||||
for picker, values in sorted(enums.items()):
|
||||
kinds = [kind for kind in types if kind in values and kind in formats]
|
||||
kinds = {kind: value for kind in types if kind in formats for value in values
|
||||
if _enum_key(value) == _enum_key(kind)}
|
||||
if len(kinds) < 2:
|
||||
continue
|
||||
picked = []
|
||||
for kind in kinds:
|
||||
for kind, value in kinds.items():
|
||||
variables = [v for v in VARIABLE_RE.findall(formats[kind]) if v not in KNOWN_VARIABLES]
|
||||
if len(variables) != 1:
|
||||
return None
|
||||
named = [member for member in members if member != picker and stem(member) == "resource"
|
||||
and compatible(member, variables[0])]
|
||||
named = [member for member in members if member != picker and stem(member) == "resource"]
|
||||
if not named:
|
||||
return None
|
||||
member = min(named, key=lambda m: (members[m].endswith("[]"), len(m), m))
|
||||
picked.append({"type": kind, "fill": {variables[0]: members[member]}, "when": {picker: [kind]}})
|
||||
picked.append({"type": kind, "fill": {variables[0]: members[member]}, "when": {picker: [value]}})
|
||||
return picked
|
||||
return None
|
||||
|
||||
|
||||
def _enum_key(value: str) -> str:
|
||||
"""An enum value or a resource type as the two are compared: lowercased, without hyphens."""
|
||||
return value.lower().replace("-", "")
|
||||
|
||||
|
||||
def string_patterns(models: dict[str, dict], operation: str) -> dict[str, set[str | None]]:
|
||||
"""Patterns of each top-level string member, including list elements, across the request's clients."""
|
||||
found: dict[str, set[str | None]] = {}
|
||||
|
||||
@@ -1262,3 +1262,17 @@ def test_a_member_whose_enum_lists_two_of_the_actions_types_picks_the_type():
|
||||
assert r.picked_by_enum(["healthcheck", "hostedzone"], formats, members, {"ResourceType": {"other"}}) is None
|
||||
# Without a member naming the resource, the request names none of them.
|
||||
assert r.picked_by_enum(["healthcheck", "hostedzone"], formats, {"ResourceType": "ResourceType"}, enums) is None
|
||||
|
||||
|
||||
def test_an_enum_value_picks_a_type_ignoring_case_and_hyphens_and_the_resource_id_fills_it():
|
||||
formats = {"document": "arn:${Partition}:ssm:${Region}:${Account}:document/${DocumentName}",
|
||||
"managed-instance": "arn:${Partition}:ssm:${Region}:${Account}:managed-instance/${InstanceId}",
|
||||
"parameter": "arn:${Partition}:ssm:${Region}:${Account}:parameter/${ParameterNameWithoutLeadingSlash}"}
|
||||
members = {"ResourceType": "ResourceType", "ResourceId": "ResourceId"}
|
||||
enums = {"ResourceType": {"Document", "ManagedInstance", "Parameter", "Automation"}}
|
||||
assert r.picked_by_enum(["document", "managed-instance", "parameter"], formats, members, enums) == [
|
||||
{"type": "document", "fill": {"DocumentName": "ResourceId"}, "when": {"ResourceType": ["Document"]}},
|
||||
{"type": "managed-instance", "fill": {"InstanceId": "ResourceId"},
|
||||
"when": {"ResourceType": ["ManagedInstance"]}},
|
||||
{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "ResourceId"},
|
||||
"when": {"ResourceType": ["Parameter"]}}]
|
||||
Reference in new issue
Block a user