diff --git a/src/main/resources/aws/iam-request-resources.json b/src/main/resources/aws/iam-request-resources.json index 7a47ddcd76..e3fb045336 100644 --- a/src/main/resources/aws/iam-request-resources.json +++ b/src/main/resources/aws/iam-request-resources.json @@ -1,7 +1,6 @@ { - "_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"], "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"}, + "_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-14", "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": ["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"]}, "handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "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::autoScalingGroupName/`, while Floci mints `autoScalingGroup:`, 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 rules do not fill a name from, so nearly every operation's resource would be left open", "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/_, 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//`, while most of its requests name it by EnvironmentName or EnvironmentId alone, so reading it needs the stored environment those find", "elasticfilesystem": "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", "execute-api": "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", "glue": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "identitystore": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "iot": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "kafka": "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", "lightsail": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "memorydb": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "mq": "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", "network-firewall": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "organizations": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rds": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rds-data": "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", "route53resolver": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rum": "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", "s3tables": "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", "s3vectors": "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", "sagemaker": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "servicecatalog": "not read yet: CreatePortfolioShare, UpdatePortfolioShare and DeletePortfolioShare give in AccountId the account a portfolio is shared with, which the rule reads as the portfolio's; a portfolio or product imported from another account keeps its owner's account in its ARN while requests name it by its id alone; and AppRegistry's applications and attribute groups are named in the path", "ses": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "signin": "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", "sso-oauth": "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", "swf": "not read yet: the Service Reference gives a domain's ARN no Region, `swf:::/domain/`, while the SWF Developer Guide gives it as arn:aws:swf:Region:AccountID:/domain/DomainName, as Floci mints it; reading it needs that format corrected", "transcribe": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "transfer": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "verifiedpermissions": "not read yet: a policyStoreId may name its store by an alias, `policy-store-alias/`, which AWS authorizes as the action on the store the alias points to and GetPolicyStoreAlias on the alias, and an aliasName carries the `policy-store-alias/` its format already gives; reading it needs both", "wafv2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint"}, "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"], @@ -135,12 +134,12 @@ "athena:CreateWorkGroup": {"action": "athena:CreateWorkGroup", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "Name"}}]}, "athena:DeleteCapacityReservation": {"action": "athena:DeleteCapacityReservation", "types": ["capacity-reservation"], "resources": [{"type": "capacity-reservation", "fill": {"CapacityReservationName": "Name"}}]}, "athena:DeleteDataCatalog": {"action": "athena:DeleteDataCatalog", "types": ["datacatalog"], "resources": [{"type": "datacatalog", "fill": {"DataCatalogName": "Name"}}]}, - "athena:DeleteNamedQuery": {"action": "athena:DeleteNamedQuery", "types": ["workgroup"], "resources": []}, - "athena:DeleteNotebook": {"action": "athena:DeleteNotebook", "types": ["workgroup"], "resources": []}, + "athena:DeleteNamedQuery": {"action": "athena:DeleteNamedQuery", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "NamedQueryId"}]}, + "athena:DeleteNotebook": {"action": "athena:DeleteNotebook", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "NotebookId"}]}, "athena:DeletePreparedStatement": {"action": "athena:DeletePreparedStatement", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, "athena:DeleteSystemTableConfiguration": {"action": "athena:DeleteSystemTableConfiguration", "types": ["system-table"], "resources": []}, "athena:DeleteWorkGroup": {"action": "athena:DeleteWorkGroup", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, - "athena:ExportNotebook": {"action": "athena:ExportNotebook", "types": ["workgroup"], "resources": []}, + "athena:ExportNotebook": {"action": "athena:ExportNotebook", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "NotebookId"}]}, "athena:GetCalculationExecution": {"action": "athena:GetCalculationExecution", "types": ["workgroup"], "resources": []}, "athena:GetCalculationExecutionCode": {"action": "athena:GetCalculationExecutionCode", "types": ["workgroup"], "resources": []}, "athena:GetCalculationExecutionStatus": {"action": "athena:GetCalculationExecutionStatus", "types": ["workgroup"], "resources": []}, @@ -148,12 +147,12 @@ "athena:GetCapacityReservation": {"action": "athena:GetCapacityReservation", "types": ["capacity-reservation"], "resources": [{"type": "capacity-reservation", "fill": {"CapacityReservationName": "Name"}}]}, "athena:GetDataCatalog": {"action": "athena:GetDataCatalog", "types": ["datacatalog"], "resources": [{"type": "datacatalog", "fill": {"DataCatalogName": "Name"}}]}, "athena:GetDatabase": {"action": "athena:GetDatabase", "types": ["datacatalog"], "resources": [{"type": "datacatalog", "fill": {"DataCatalogName": "CatalogName"}}]}, - "athena:GetNamedQuery": {"action": "athena:GetNamedQuery", "types": ["workgroup"], "resources": []}, - "athena:GetNotebookMetadata": {"action": "athena:GetNotebookMetadata", "types": ["workgroup"], "resources": []}, + "athena:GetNamedQuery": {"action": "athena:GetNamedQuery", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "NamedQueryId"}]}, + "athena:GetNotebookMetadata": {"action": "athena:GetNotebookMetadata", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "NotebookId"}]}, "athena:GetPreparedStatement": {"action": "athena:GetPreparedStatement", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, - "athena:GetQueryExecution": {"action": "athena:GetQueryExecution", "types": ["workgroup"], "resources": []}, - "athena:GetQueryResults": {"action": "athena:GetQueryResults", "types": ["workgroup"], "resources": []}, - "athena:GetQueryRuntimeStatistics": {"action": "athena:GetQueryRuntimeStatistics", "types": ["workgroup"], "resources": []}, + "athena:GetQueryExecution": {"action": "athena:GetQueryExecution", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "QueryExecutionId"}]}, + "athena:GetQueryResults": {"action": "athena:GetQueryResults", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "QueryExecutionId"}]}, + "athena:GetQueryRuntimeStatistics": {"action": "athena:GetQueryRuntimeStatistics", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "QueryExecutionId"}]}, "athena:GetResourceDashboard": {"action": "athena:GetResourceDashboard", "types": ["session", "workgroup"], "resources": [{"types": ["session", "workgroup"], "arn": "ResourceARN"}]}, "athena:GetSession": {"action": "athena:GetSession", "types": ["session", "workgroup"], "resources": [{"type": "session", "fill": {"SessionId": "SessionId"}}]}, "athena:GetSessionEndpoint": {"action": "athena:GetSessionEndpoint", "types": ["session", "workgroup"], "resources": [{"type": "session", "fill": {"SessionId": "SessionId"}}]}, @@ -171,7 +170,7 @@ "athena:ListExecutors": {"action": "athena:ListExecutors", "types": [], "resources": []}, "athena:ListNamedQueries": {"action": "athena:ListNamedQueries", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, "athena:ListNotebookMetadata": {"action": "athena:ListNotebookMetadata", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, - "athena:ListNotebookSessions": {"action": "athena:ListNotebookSessions", "types": ["workgroup"], "resources": []}, + "athena:ListNotebookSessions": {"action": "athena:ListNotebookSessions", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "NotebookId"}]}, "athena:ListPreparedStatements": {"action": "athena:ListPreparedStatements", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, "athena:ListQueryExecutions": {"action": "athena:ListQueryExecutions", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, "athena:ListSessions": {"action": "athena:ListSessions", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, @@ -184,15 +183,15 @@ "athena:StartQueryExecution": {"action": "athena:StartQueryExecution", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, "athena:StartSession": {"action": "athena:StartSession", "types": ["session", "workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, "athena:StopCalculationExecution": {"action": "athena:StopCalculationExecution", "types": ["workgroup"], "resources": []}, - "athena:StopQueryExecution": {"action": "athena:StopQueryExecution", "types": ["workgroup"], "resources": []}, + "athena:StopQueryExecution": {"action": "athena:StopQueryExecution", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "QueryExecutionId"}]}, "athena:TagResource": {"action": "athena:TagResource", "types": ["capacity-reservation", "datacatalog", "session", "system-table", "workgroup"], "resources": [{"types": ["capacity-reservation", "datacatalog", "session", "system-table", "workgroup"], "arn": "ResourceARN"}]}, "athena:TerminateSession": {"action": "athena:TerminateSession", "types": ["session", "workgroup"], "resources": [{"type": "session", "fill": {"SessionId": "SessionId"}}]}, "athena:UntagResource": {"action": "athena:UntagResource", "types": ["capacity-reservation", "datacatalog", "session", "system-table", "workgroup"], "resources": [{"types": ["capacity-reservation", "datacatalog", "session", "system-table", "workgroup"], "arn": "ResourceARN"}]}, "athena:UpdateCapacityReservation": {"action": "athena:UpdateCapacityReservation", "types": ["capacity-reservation"], "resources": [{"type": "capacity-reservation", "fill": {"CapacityReservationName": "Name"}}]}, "athena:UpdateDataCatalog": {"action": "athena:UpdateDataCatalog", "types": ["datacatalog"], "resources": [{"type": "datacatalog", "fill": {"DataCatalogName": "Name"}}]}, - "athena:UpdateNamedQuery": {"action": "athena:UpdateNamedQuery", "types": ["workgroup"], "resources": []}, - "athena:UpdateNotebook": {"action": "athena:UpdateNotebook", "types": ["workgroup"], "resources": []}, - "athena:UpdateNotebookMetadata": {"action": "athena:UpdateNotebookMetadata", "types": ["workgroup"], "resources": []}, + "athena:UpdateNamedQuery": {"action": "athena:UpdateNamedQuery", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "NamedQueryId"}]}, + "athena:UpdateNotebook": {"action": "athena:UpdateNotebook", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "NotebookId"}]}, + "athena:UpdateNotebookMetadata": {"action": "athena:UpdateNotebookMetadata", "types": ["workgroup"], "resources": [{"types": ["workgroup"], "through": "NotebookId"}]}, "athena:UpdatePreparedStatement": {"action": "athena:UpdatePreparedStatement", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, "athena:UpdateSystemTableConfiguration": {"action": "athena:UpdateSystemTableConfiguration", "types": ["system-table"], "resources": []}, "athena:UpdateWorkGroup": {"action": "athena:UpdateWorkGroup", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]}, @@ -623,7 +622,7 @@ "codepipeline:GetActionType": {"action": "codepipeline:GetActionType", "types": [], "resources": []}, "codepipeline:GetJobDetails": {"action": "codepipeline:GetJobDetails", "types": [], "resources": []}, "codepipeline:GetPipeline": {"action": "codepipeline:GetPipeline", "types": ["pipeline"], "resources": [{"type": "pipeline", "fill": {"PipelineName": "name"}}]}, - "codepipeline:GetPipelineExecution": {"action": "codepipeline:GetPipelineExecution", "types": ["pipeline"], "resources": [{"type": "pipeline", "fill": {"PipelineName": "pipelineName"}}]}, + "codepipeline:GetPipelineExecution": {"action": "codepipeline:GetPipelineExecution", "types": ["pipeline"], "resources": [{"type": "pipeline", "fill": {"PipelineName": "pipelineName"}}, {"types": ["pipeline"], "through": "pipelineExecutionId"}]}, "codepipeline:GetPipelineState": {"action": "codepipeline:GetPipelineState", "types": ["pipeline"], "resources": [{"type": "pipeline", "fill": {"PipelineName": "name"}}]}, "codepipeline:GetThirdPartyJobDetails": {"action": "codepipeline:GetThirdPartyJobDetails", "types": [], "resources": []}, "codepipeline:ListActionExecutions": {"action": "codepipeline:ListActionExecutions", "types": ["pipeline"], "resources": [{"type": "pipeline", "fill": {"PipelineName": "pipelineName"}}]}, @@ -649,7 +648,7 @@ "codepipeline:RetryStageExecution": {"action": "codepipeline:RetryStageExecution", "types": ["stage"], "resources": [{"type": "stage", "fill": {"PipelineName": "pipelineName", "StageName": "stageName"}}]}, "codepipeline:RollbackStage": {"action": "codepipeline:RollbackStage", "types": ["stage"], "resources": [{"type": "stage", "fill": {"PipelineName": "pipelineName", "StageName": "stageName"}}]}, "codepipeline:StartPipelineExecution": {"action": "codepipeline:StartPipelineExecution", "types": ["pipeline"], "resources": [{"type": "pipeline", "fill": {"PipelineName": "name"}}]}, - "codepipeline:StopPipelineExecution": {"action": "codepipeline:StopPipelineExecution", "types": ["pipeline"], "resources": [{"type": "pipeline", "fill": {"PipelineName": "pipelineName"}}]}, + "codepipeline:StopPipelineExecution": {"action": "codepipeline:StopPipelineExecution", "types": ["pipeline"], "resources": [{"type": "pipeline", "fill": {"PipelineName": "pipelineName"}}, {"types": ["pipeline"], "through": "pipelineExecutionId"}]}, "codepipeline:TagResource": {"action": "codepipeline:TagResource", "types": ["actiontype", "pipeline", "webhook"], "resources": [{"types": ["actiontype", "pipeline", "webhook"], "arn": "resourceArn"}]}, "codepipeline:UntagResource": {"action": "codepipeline:UntagResource", "types": ["actiontype", "pipeline", "webhook"], "resources": [{"types": ["actiontype", "pipeline", "webhook"], "arn": "resourceArn"}]}, "codepipeline:UpdateActionType": {"action": "codepipeline:UpdateActionType", "types": ["actiontype"], "resources": []}, @@ -727,9 +726,9 @@ "cognito-idp:CreateUserPoolReplica": {"action": "cognito-idp:CreateUserPoolReplica", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:DeleteGroup": {"action": "cognito-idp:DeleteGroup", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:DeleteIdentityProvider": {"action": "cognito-idp:DeleteIdentityProvider", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, - "cognito-idp:DeleteManagedLoginBranding": {"action": "cognito-idp:DeleteManagedLoginBranding", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, + "cognito-idp:DeleteManagedLoginBranding": {"action": "cognito-idp:DeleteManagedLoginBranding", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}, {"types": ["userpool"], "through": "ManagedLoginBrandingId"}]}, "cognito-idp:DeleteResourceServer": {"action": "cognito-idp:DeleteResourceServer", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, - "cognito-idp:DeleteTerms": {"action": "cognito-idp:DeleteTerms", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, + "cognito-idp:DeleteTerms": {"action": "cognito-idp:DeleteTerms", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}, {"types": ["userpool"], "through": "TermsId"}]}, "cognito-idp:DeleteUser": {"action": "cognito-idp:DeleteUser", "types": [], "resources": []}, "cognito-idp:DeleteUserAttributes": {"action": "cognito-idp:DeleteUserAttributes", "types": [], "resources": []}, "cognito-idp:DeleteUserPool": {"action": "cognito-idp:DeleteUserPool", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, @@ -739,11 +738,11 @@ "cognito-idp:DeleteUserPoolReplica": {"action": "cognito-idp:DeleteUserPoolReplica", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:DeleteWebAuthnCredential": {"action": "cognito-idp:DeleteWebAuthnCredential", "types": [], "resources": []}, "cognito-idp:DescribeIdentityProvider": {"action": "cognito-idp:DescribeIdentityProvider", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, - "cognito-idp:DescribeManagedLoginBranding": {"action": "cognito-idp:DescribeManagedLoginBranding", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, + "cognito-idp:DescribeManagedLoginBranding": {"action": "cognito-idp:DescribeManagedLoginBranding", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}, {"types": ["userpool"], "through": "ManagedLoginBrandingId"}]}, "cognito-idp:DescribeManagedLoginBrandingByClient": {"action": "cognito-idp:DescribeManagedLoginBrandingByClient", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:DescribeResourceServer": {"action": "cognito-idp:DescribeResourceServer", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:DescribeRiskConfiguration": {"action": "cognito-idp:DescribeRiskConfiguration", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, - "cognito-idp:DescribeTerms": {"action": "cognito-idp:DescribeTerms", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, + "cognito-idp:DescribeTerms": {"action": "cognito-idp:DescribeTerms", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}, {"types": ["userpool"], "through": "TermsId"}]}, "cognito-idp:DescribeTermsByClient": {"action": "cognito-idp:DescribeTermsByClient", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:DescribeUserImportJob": {"action": "cognito-idp:DescribeUserImportJob", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:DescribeUserPool": {"action": "cognito-idp:DescribeUserPool", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, @@ -806,10 +805,10 @@ "cognito-idp:UpdateDeviceStatus": {"action": "cognito-idp:UpdateDeviceStatus", "types": [], "resources": []}, "cognito-idp:UpdateGroup": {"action": "cognito-idp:UpdateGroup", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "RoleArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:UpdateIdentityProvider": {"action": "cognito-idp:UpdateIdentityProvider", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, - "cognito-idp:UpdateManagedLoginBranding": {"action": "cognito-idp:UpdateManagedLoginBranding", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, + "cognito-idp:UpdateManagedLoginBranding": {"action": "cognito-idp:UpdateManagedLoginBranding", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}, {"types": ["userpool"], "through": "ManagedLoginBrandingId"}]}, "cognito-idp:UpdateProvisionedLimit": {"action": "cognito-idp:UpdateProvisionedLimit", "types": [], "resources": []}, "cognito-idp:UpdateResourceServer": {"action": "cognito-idp:UpdateResourceServer", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, - "cognito-idp:UpdateTerms": {"action": "cognito-idp:UpdateTerms", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, + "cognito-idp:UpdateTerms": {"action": "cognito-idp:UpdateTerms", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}, {"types": ["userpool"], "through": "TermsId"}]}, "cognito-idp:UpdateUserAttributes": {"action": "cognito-idp:UpdateUserAttributes", "types": [], "resources": []}, "cognito-idp:UpdateUserPool": {"action": "cognito-idp:UpdateUserPool", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "EmailConfiguration.SourceArn"}, {"types": ["userpool"], "arn": "KeyConfiguration.KmsKeyArn"}, {"types": ["userpool"], "arn": "SmsConfiguration.SnsCallerArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, "cognito-idp:UpdateUserPoolClient": {"action": "cognito-idp:UpdateUserPoolClient", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "AnalyticsConfiguration.ApplicationArn"}, {"types": ["userpool"], "arn": "AnalyticsConfiguration.RoleArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]}, @@ -940,6 +939,7 @@ "ec2:AssociateIpamByoasn": {"action": "ec2:AssociateIpamByoasn", "types": [], "resources": []}, "ec2:AssociateIpamResourceDiscovery": {"action": "ec2:AssociateIpamResourceDiscovery", "types": ["ipam", "ipam-resource-discovery", "ipam-resource-discovery-association"], "resources": []}, "ec2:AssociateNatGatewayAddress": {"action": "ec2:AssociateNatGatewayAddress", "types": ["elastic-ip", "natgateway"], "resources": []}, + "ec2:AssociateNetworkingFlexCostAllocationPolicy": {"action": "ec2:AssociateNetworkingFlexCostAllocationPolicy", "types": [], "resources": []}, "ec2:AssociateRouteServer": {"action": "ec2:AssociateRouteServer", "types": ["route-server", "vpc"], "resources": []}, "ec2:AssociateRouteTable": {"action": "ec2:AssociateRouteTable", "types": ["internet-gateway", "ipv4pool-ec2", "route-table", "subnet", "vpn-gateway"], "resources": []}, "ec2:AssociateSecurityGroupVpc": {"action": "ec2:AssociateSecurityGroupVpc", "types": ["security-group", "vpc"], "resources": []}, @@ -1034,6 +1034,7 @@ "ec2:CreateNetworkInsightsPath": {"action": "ec2:CreateNetworkInsightsPath", "types": ["instance", "internet-gateway", "network-insights-path", "network-interface", "transit-gateway", "vpc-endpoint", "vpc-endpoint-service", "vpc-peering-connection", "vpn-gateway"], "resources": []}, "ec2:CreateNetworkInterface": {"action": "ec2:CreateNetworkInterface", "types": ["network-interface", "security-group", "subnet"], "resources": []}, "ec2:CreateNetworkInterfacePermission": {"action": "ec2:CreateNetworkInterfacePermission", "types": ["network-interface"], "resources": []}, + "ec2:CreateNetworkingFlexCostAllocationPolicy": {"action": "ec2:CreateNetworkingFlexCostAllocationPolicy", "types": [], "resources": []}, "ec2:CreatePlacementGroup": {"action": "ec2:CreatePlacementGroup", "types": ["placement-group"], "resources": []}, "ec2:CreatePublicIpv4Pool": {"action": "ec2:CreatePublicIpv4Pool", "types": ["ipv4pool-ec2"], "resources": []}, "ec2:CreateReplaceRootVolumeTask": {"action": "ec2:CreateReplaceRootVolumeTask", "types": ["image", "instance", "replace-root-volume-task", "snapshot", "volume"], "resources": []}, @@ -1136,6 +1137,7 @@ "ec2:DeleteNetworkInsightsPath": {"action": "ec2:DeleteNetworkInsightsPath", "types": ["network-insights-path"], "resources": []}, "ec2:DeleteNetworkInterface": {"action": "ec2:DeleteNetworkInterface", "types": ["network-interface"], "resources": []}, "ec2:DeleteNetworkInterfacePermission": {"action": "ec2:DeleteNetworkInterfacePermission", "types": ["network-interface"], "resources": []}, + "ec2:DeleteNetworkingFlexCostAllocationPolicies": {"action": "ec2:DeleteNetworkingFlexCostAllocationPolicies", "types": [], "resources": []}, "ec2:DeletePlacementGroup": {"action": "ec2:DeletePlacementGroup", "types": ["placement-group"], "resources": []}, "ec2:DeletePublicIpv4Pool": {"action": "ec2:DeletePublicIpv4Pool", "types": ["ipv4pool-ec2"], "resources": []}, "ec2:DeleteQueuedReservedInstances": {"action": "ec2:DeleteQueuedReservedInstances", "types": ["reserved-instances"], "resources": []}, @@ -1308,6 +1310,8 @@ "ec2:DescribeNetworkInterfaceAttribute": {"action": "ec2:DescribeNetworkInterfaceAttribute", "types": [], "resources": []}, "ec2:DescribeNetworkInterfacePermissions": {"action": "ec2:DescribeNetworkInterfacePermissions", "types": [], "resources": []}, "ec2:DescribeNetworkInterfaces": {"action": "ec2:DescribeNetworkInterfaces", "types": [], "resources": []}, + "ec2:DescribeNetworkingFlexCostAllocationPolicies": {"action": "ec2:DescribeNetworkingFlexCostAllocationPolicies", "types": [], "resources": []}, + "ec2:DescribeNetworkingFlexCostAllocationPolicyAssociations": {"action": "ec2:DescribeNetworkingFlexCostAllocationPolicyAssociations", "types": [], "resources": []}, "ec2:DescribeOutpostLags": {"action": "ec2:DescribeOutpostLags", "types": [], "resources": []}, "ec2:DescribePlacementGroups": {"action": "ec2:DescribePlacementGroups", "types": [], "resources": []}, "ec2:DescribePrefixLists": {"action": "ec2:DescribePrefixLists", "types": [], "resources": []}, @@ -1428,6 +1432,7 @@ "ec2:DisassociateIpamByoasn": {"action": "ec2:DisassociateIpamByoasn", "types": [], "resources": []}, "ec2:DisassociateIpamResourceDiscovery": {"action": "ec2:DisassociateIpamResourceDiscovery", "types": ["ipam-resource-discovery-association"], "resources": []}, "ec2:DisassociateNatGatewayAddress": {"action": "ec2:DisassociateNatGatewayAddress", "types": ["elastic-ip", "natgateway", "network-interface"], "resources": []}, + "ec2:DisassociateNetworkingFlexCostAllocationPolicy": {"action": "ec2:DisassociateNetworkingFlexCostAllocationPolicy", "types": [], "resources": []}, "ec2:DisassociateRouteServer": {"action": "ec2:DisassociateRouteServer", "types": ["route-server", "vpc"], "resources": []}, "ec2:DisassociateRouteTable": {"action": "ec2:DisassociateRouteTable", "types": ["internet-gateway", "ipv4pool-ec2", "ipv6pool-ec2", "route-table", "subnet", "vpn-gateway"], "resources": []}, "ec2:DisassociateSecurityGroupVpc": {"action": "ec2:DisassociateSecurityGroupVpc", "types": ["security-group", "vpc"], "resources": []}, @@ -1522,6 +1527,7 @@ "ec2:GetManagedResourceVisibility": {"action": "ec2:GetManagedResourceVisibility", "types": [], "resources": []}, "ec2:GetNetworkInsightsAccessScopeAnalysisFindings": {"action": "ec2:GetNetworkInsightsAccessScopeAnalysisFindings", "types": ["network-insights-access-scope-analysis"], "resources": []}, "ec2:GetNetworkInsightsAccessScopeContent": {"action": "ec2:GetNetworkInsightsAccessScopeContent", "types": ["network-insights-access-scope"], "resources": []}, + "ec2:GetNetworkingFlexCostAllocationPolicyVersions": {"action": "ec2:GetNetworkingFlexCostAllocationPolicyVersions", "types": [], "resources": []}, "ec2:GetPasswordData": {"action": "ec2:GetPasswordData", "types": ["instance"], "resources": []}, "ec2:GetReservedInstancesExchangeQuote": {"action": "ec2:GetReservedInstancesExchangeQuote", "types": ["reserved-instances"], "resources": []}, "ec2:GetRouteServerAssociations": {"action": "ec2:GetRouteServerAssociations", "types": ["route-server"], "resources": []}, @@ -1602,6 +1608,7 @@ "ec2:ModifyManagedResourceVisibility": {"action": "ec2:ModifyManagedResourceVisibility", "types": [], "resources": []}, "ec2:ModifyMetricCategory": {"action": "ec2:ModifyMetricCategory", "types": [], "resources": []}, "ec2:ModifyNetworkInterfaceAttribute": {"action": "ec2:ModifyNetworkInterfaceAttribute", "types": ["instance", "network-interface", "security-group", "subnet"], "resources": []}, + "ec2:ModifyNetworkingFlexCostAllocationPolicy": {"action": "ec2:ModifyNetworkingFlexCostAllocationPolicy", "types": [], "resources": []}, "ec2:ModifyPrivateDnsNameOptions": {"action": "ec2:ModifyPrivateDnsNameOptions", "types": ["instance"], "resources": []}, "ec2:ModifyPublicIpDnsNameOptions": {"action": "ec2:ModifyPublicIpDnsNameOptions", "types": ["network-interface"], "resources": []}, "ec2:ModifyReservedInstances": {"action": "ec2:ModifyReservedInstances", "types": ["reserved-instances"], "resources": []}, @@ -1731,7 +1738,7 @@ "ecr:BatchDeleteImage": {"action": "ecr:BatchDeleteImage", "types": ["repository"], "resources": [{"type": "repository", "fill": {"RepositoryName": "repositoryName"}, "account": "registryId"}]}, "ecr:BatchGetImage": {"action": "ecr:BatchGetImage", "types": ["repository"], "resources": [{"type": "repository", "fill": {"RepositoryName": "repositoryName"}, "account": "registryId"}]}, "ecr:BatchGetRepositoryScanningConfiguration": {"action": "ecr:BatchGetRepositoryScanningConfiguration", "types": ["repository"], "resources": [{"type": "repository", "fill": {"RepositoryName": "repositoryNames[]"}}]}, - "ecr:CompleteLayerUpload": {"action": "ecr:CompleteLayerUpload", "types": ["repository"], "resources": [{"type": "repository", "fill": {"RepositoryName": "repositoryName"}, "account": "registryId"}]}, + "ecr:CompleteLayerUpload": {"action": "ecr:CompleteLayerUpload", "types": ["repository"], "resources": [{"type": "repository", "fill": {"RepositoryName": "repositoryName"}, "account": "registryId"}, {"types": ["repository"], "through": "uploadId"}]}, "ecr:CreatePullThroughCacheRule": {"action": "ecr:CreatePullThroughCacheRule", "types": [], "resources": []}, "ecr:CreateRepository": {"action": "ecr:CreateRepository", "types": ["repository"], "resources": [{"type": "repository", "fill": {"RepositoryName": "repositoryName"}, "account": "registryId"}]}, "ecr:CreateRepositoryCreationTemplate": {"action": "ecr:CreateRepositoryCreationTemplate", "types": [], "resources": []}, @@ -1787,7 +1794,7 @@ "ecr:UpdateImageStorageClass": {"action": "ecr:UpdateImageStorageClass", "types": ["repository"], "resources": [{"type": "repository", "fill": {"RepositoryName": "repositoryName"}, "account": "registryId"}]}, "ecr:UpdatePullThroughCacheRule": {"action": "ecr:UpdatePullThroughCacheRule", "types": [], "resources": []}, "ecr:UpdateRepositoryCreationTemplate": {"action": "ecr:UpdateRepositoryCreationTemplate", "types": [], "resources": []}, - "ecr:UploadLayerPart": {"action": "ecr:UploadLayerPart", "types": ["repository"], "resources": [{"type": "repository", "fill": {"RepositoryName": "repositoryName"}, "account": "registryId"}]}, + "ecr:UploadLayerPart": {"action": "ecr:UploadLayerPart", "types": ["repository"], "resources": [{"type": "repository", "fill": {"RepositoryName": "repositoryName"}, "account": "registryId"}, {"types": ["repository"], "through": "uploadId"}]}, "ecr:ValidatePullThroughCacheRule": {"action": "ecr:ValidatePullThroughCacheRule", "types": [], "resources": []}, "elasticloadbalancing:AddListenerCertificates": {"action": "elasticloadbalancing:AddListenerCertificates", "types": ["listener/app", "listener/net"], "resources": [{"types": ["listener/app", "listener/net"], "arn": "Certificates[].CertificateArn"}, {"types": ["listener/app", "listener/net"], "arn": "ListenerArn"}]}, "elasticloadbalancing:AddTags": {"action": "elasticloadbalancing:AddTags", "types": ["listener-rule/app", "listener-rule/net", "listener/app", "listener/gwy", "listener/net", "loadbalancer", "loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/", "targetgroup", "truststore"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerNames[]"}}, {"types": ["listener-rule/app", "listener-rule/net", "listener/app", "listener/gwy", "listener/net", "loadbalancer", "loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/", "targetgroup", "truststore"], "arn": "ResourceArns[]"}]}, @@ -2018,7 +2025,7 @@ "es:GetDirectQueryDataSource": {"action": "es:GetDirectQueryDataSource", "types": ["datasource"], "resources": [{"type": "datasource", "fill": {"DataSourceName": "DataSourceName"}}], "located": {"DataSourceName": "{DataSourceName}"}}, "es:GetDomainMaintenanceStatus": {"action": "es:GetDomainMaintenanceStatus", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}}, "es:GetIndex": {"action": "es:GetIndex", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}}, - "es:GetMigration": {"action": "es:GetMigration", "types": ["application"], "resources": []}, + "es:GetMigration": {"action": "es:GetMigration", "types": ["application"], "resources": [{"types": ["application"], "through": "migrationId"}], "located": {"migrationId": "{migrationId}"}}, "es:GetPackageVersionHistory": {"action": "es:GetPackageVersionHistory", "types": [], "resources": []}, "es:GetUpgradeHistory": {"action": "es:GetUpgradeHistory", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}}, "es:GetUpgradeStatus": {"action": "es:GetUpgradeStatus", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}}, @@ -2720,7 +2727,7 @@ "quicksight:DescribeBrand": {"action": "quicksight:DescribeBrand", "types": ["brand"], "resources": [{"type": "brand", "fill": {"ResourceId": "BrandId"}}], "located": {"BrandId": "{BrandId}"}}, "quicksight:DescribeBrandAssignment": {"action": "quicksight:DescribeBrandAssignment", "types": [], "resources": []}, "quicksight:DescribeBrandPublishedVersion": {"action": "quicksight:DescribeBrandPublishedVersion", "types": ["brand"], "resources": [{"type": "brand", "fill": {"ResourceId": "BrandId"}}], "located": {"BrandId": "{BrandId}"}}, - "quicksight:DescribeCustomPermissions": {"action": "quicksight:DescribeCustomPermissions", "types": ["custompermissions"], "resources": []}, + "quicksight:DescribeCustomPermissions": {"action": "quicksight:DescribeCustomPermissions", "types": ["custompermissions"], "resources": [{"type": "custompermissions", "fill": {}, "find": ["AwsAccountId", "CustomPermissionsName"]}], "located": {"AwsAccountId": "{AwsAccountId}", "CustomPermissionsName": "{CustomPermissionsName}"}}, "quicksight:DescribeDashboard": {"action": "quicksight:DescribeDashboard", "types": ["dashboard"], "resources": [{"type": "dashboard", "fill": {"ResourceId": "DashboardId"}}], "located": {"DashboardId": "{DashboardId}"}}, "quicksight:DescribeDashboardDefinition": {"action": "quicksight:DescribeDashboard", "types": ["dashboard"], "resources": [{"type": "dashboard", "fill": {"ResourceId": "DashboardId"}}], "located": {"DashboardId": "{DashboardId}"}}, "quicksight:DescribeDashboardPermissions": {"action": "quicksight:DescribeDashboardPermissions", "types": ["dashboard"], "resources": [{"type": "dashboard", "fill": {"ResourceId": "DashboardId"}}], "located": {"DashboardId": "{DashboardId}"}}, @@ -2740,7 +2747,7 @@ "quicksight:DescribeFolderResolvedPermissions": {"action": "quicksight:DescribeFolderResolvedPermissions", "types": ["folder"], "resources": [{"type": "folder", "fill": {"ResourceId": "FolderId"}}], "located": {"FolderId": "{FolderId}"}}, "quicksight:DescribeGroup": {"action": "quicksight:DescribeGroup", "types": ["group"], "resources": [{"type": "group", "fill": {}, "find": ["AwsAccountId", "Namespace", "GroupName"]}], "located": {"AwsAccountId": "{AwsAccountId}", "GroupName": "{GroupName}", "Namespace": "{Namespace}"}}, "quicksight:DescribeGroupMembership": {"action": "quicksight:DescribeGroupMembership", "types": ["group"], "resources": [{"type": "group", "fill": {}, "find": ["AwsAccountId", "Namespace", "GroupName"]}], "located": {"AwsAccountId": "{AwsAccountId}", "GroupName": "{GroupName}", "Namespace": "{Namespace}"}}, - "quicksight:DescribeIAMPolicyAssignment": {"action": "quicksight:DescribeIAMPolicyAssignment", "types": ["assignment"], "resources": []}, + "quicksight:DescribeIAMPolicyAssignment": {"action": "quicksight:DescribeIAMPolicyAssignment", "types": ["assignment"], "resources": [{"type": "assignment", "fill": {}, "find": ["AwsAccountId", "Namespace", "AssignmentName"]}], "located": {"AssignmentName": "{AssignmentName}", "AwsAccountId": "{AwsAccountId}", "Namespace": "{Namespace}"}}, "quicksight:DescribeIngestion": {"action": "quicksight:DescribeIngestion", "types": ["ingestion"], "resources": [{"type": "ingestion", "fill": {"DatasetId": "DataSetId", "ResourceId": "IngestionId"}}], "located": {"DataSetId": "{DataSetId}", "IngestionId": "{IngestionId}"}}, "quicksight:DescribeIpRestriction": {"action": "quicksight:DescribeIpRestriction", "types": [], "resources": []}, "quicksight:DescribeKeyRegistration": {"action": "quicksight:DescribeKeyRegistration", "types": [], "resources": []}, @@ -2868,7 +2875,7 @@ "quicksight:UpdateBrand": {"action": "quicksight:UpdateBrand", "types": ["brand"], "resources": [{"type": "brand", "fill": {"ResourceId": "BrandId"}}], "located": {"BrandId": "{BrandId}"}}, "quicksight:UpdateBrandAssignment": {"action": "quicksight:UpdateBrandAssignment", "types": [], "resources": []}, "quicksight:UpdateBrandPublishedVersion": {"action": "quicksight:UpdateBrandPublishedVersion", "types": ["brand"], "resources": [{"type": "brand", "fill": {"ResourceId": "BrandId"}}], "located": {"BrandId": "{BrandId}"}}, - "quicksight:UpdateCustomPermissions": {"action": "quicksight:UpdateCustomPermissions", "types": ["custompermissions"], "resources": []}, + "quicksight:UpdateCustomPermissions": {"action": "quicksight:UpdateCustomPermissions", "types": ["custompermissions"], "resources": [{"type": "custompermissions", "fill": {}, "find": ["AwsAccountId", "CustomPermissionsName"]}], "located": {"AwsAccountId": "{AwsAccountId}", "CustomPermissionsName": "{CustomPermissionsName}"}}, "quicksight:UpdateDashboard": {"action": "quicksight:UpdateDashboard", "types": ["dashboard"], "resources": [{"type": "dashboard", "fill": {"ResourceId": "DashboardId"}}], "located": {"DashboardId": "{DashboardId}"}}, "quicksight:UpdateDashboardLinks": {"action": "quicksight:UpdateDashboardLinks", "types": ["dashboard"], "resources": [{"type": "dashboard", "fill": {"ResourceId": "DashboardId"}}], "located": {"DashboardId": "{DashboardId}"}}, "quicksight:UpdateDashboardPermissions": {"action": "quicksight:UpdateDashboardPermissions", "types": ["dashboard"], "resources": [{"type": "dashboard", "fill": {"ResourceId": "DashboardId"}}], "located": {"DashboardId": "{DashboardId}"}}, @@ -2885,7 +2892,7 @@ "quicksight:UpdateFolder": {"action": "quicksight:UpdateFolder", "types": ["folder"], "resources": [{"type": "folder", "fill": {"ResourceId": "FolderId"}}], "located": {"FolderId": "{FolderId}"}}, "quicksight:UpdateFolderPermissions": {"action": "quicksight:UpdateFolderPermissions", "types": ["folder"], "resources": [{"type": "folder", "fill": {"ResourceId": "FolderId"}}], "located": {"FolderId": "{FolderId}"}}, "quicksight:UpdateGroup": {"action": "quicksight:UpdateGroup", "types": ["group"], "resources": [{"type": "group", "fill": {}, "find": ["AwsAccountId", "Namespace", "GroupName"]}], "located": {"AwsAccountId": "{AwsAccountId}", "GroupName": "{GroupName}", "Namespace": "{Namespace}"}}, - "quicksight:UpdateIAMPolicyAssignment": {"action": "quicksight:UpdateIAMPolicyAssignment", "types": ["assignment"], "resources": [{"types": ["assignment"], "arn": "PolicyArn"}]}, + "quicksight:UpdateIAMPolicyAssignment": {"action": "quicksight:UpdateIAMPolicyAssignment", "types": ["assignment"], "resources": [{"types": ["assignment"], "arn": "PolicyArn"}, {"type": "assignment", "fill": {}, "find": ["AwsAccountId", "Namespace", "AssignmentName"]}], "located": {"AssignmentName": "{AssignmentName}", "AwsAccountId": "{AwsAccountId}", "Namespace": "{Namespace}"}}, "quicksight:UpdateIdentityPropagationConfig": {"action": "quicksight:UpdateIdentityPropagationConfig", "types": [], "resources": []}, "quicksight:UpdateIpRestriction": {"action": "quicksight:UpdateIpRestriction", "types": [], "resources": []}, "quicksight:UpdateKeyRegistration": {"action": "quicksight:UpdateKeyRegistration", "types": [], "resources": []}, @@ -2967,30 +2974,30 @@ "redshift-data:ListSessions": {"action": "redshift-data:ListSessions", "types": [], "resources": []}, "redshift-data:ListStatements": {"action": "redshift-data:ListStatements", "types": [], "resources": []}, "redshift-data:ListTables": {"action": "redshift-data:ListTables", "types": ["cluster", "workgroup"], "resources": [{"types": ["cluster", "workgroup"], "arn": "SecretArn"}, {"type": "cluster", "fill": {"ClusterName": "ClusterIdentifier"}}, {"type": "workgroup", "fill": {}, "find": ["WorkgroupName"]}]}, - "redshift-serverless:ConvertRecoveryPointToSnapshot": {"action": "redshift-serverless:ConvertRecoveryPointToSnapshot", "types": ["recoveryPoint", "snapshot"], "resources": [{"type": "recoveryPoint", "fill": {"RecoveryPointId": "recoveryPointId"}}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"]}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"]}]}, + "redshift-serverless:ConvertRecoveryPointToSnapshot": {"action": "redshift-serverless:ConvertRecoveryPointToSnapshot", "types": ["recoveryPoint", "snapshot"], "resources": [{"type": "recoveryPoint", "fill": {"RecoveryPointId": "recoveryPointId"}}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"]}]}, "redshift-serverless:CreateCustomDomainAssociation": {"action": "redshift-serverless:CreateCustomDomainAssociation", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, "redshift-serverless:CreateEndpointAccess": {"action": "redshift-serverless:CreateEndpointAccess", "types": ["endpointAccess"], "resources": [{"type": "endpointAccess", "fill": {}, "find": ["endpointName"]}]}, - "redshift-serverless:CreateNamespace": {"action": "redshift-serverless:CreateNamespace", "types": ["namespace"], "resources": [{"types": ["namespace"], "arn": "defaultIamRoleArn"}, {"types": ["namespace"], "arn": "redshiftIdcApplicationArn"}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, + "redshift-serverless:CreateNamespace": {"action": "redshift-serverless:CreateNamespace", "types": ["namespace"], "resources": [{"types": ["namespace"], "arn": "defaultIamRoleArn"}, {"types": ["namespace"], "arn": "redshiftIdcApplicationArn"}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, "redshift-serverless:CreateReservation": {"action": "redshift-serverless:CreateReservation", "types": [], "resources": []}, - "redshift-serverless:CreateScheduledAction": {"action": "redshift-serverless:CreateScheduledAction", "types": ["namespace"], "resources": [{"types": ["namespace"], "arn": "roleArn"}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, - "redshift-serverless:CreateSnapshot": {"action": "redshift-serverless:CreateSnapshot", "types": ["namespace", "snapshot"], "resources": [{"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"], "made": true}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"], "made": true}]}, - "redshift-serverless:CreateSnapshotCopyConfiguration": {"action": "redshift-serverless:CreateSnapshotCopyConfiguration", "types": ["namespace"], "resources": [{"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, + "redshift-serverless:CreateScheduledAction": {"action": "redshift-serverless:CreateScheduledAction", "types": ["namespace"], "resources": [{"types": ["namespace"], "arn": "roleArn"}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, + "redshift-serverless:CreateSnapshot": {"action": "redshift-serverless:CreateSnapshot", "types": ["namespace", "snapshot"], "resources": [{"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"], "made": true}]}, + "redshift-serverless:CreateSnapshotCopyConfiguration": {"action": "redshift-serverless:CreateSnapshotCopyConfiguration", "types": ["namespace"], "resources": [{"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, "redshift-serverless:CreateUsageLimit": {"action": "redshift-serverless:CreateUsageLimit", "types": [], "resources": []}, "redshift-serverless:CreateWorkgroup": {"action": "redshift-serverless:CreateWorkgroup", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, "redshift-serverless:DeleteCustomDomainAssociation": {"action": "redshift-serverless:DeleteCustomDomainAssociation", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, "redshift-serverless:DeleteEndpointAccess": {"action": "redshift-serverless:DeleteEndpointAccess", "types": ["endpointAccess"], "resources": [{"type": "endpointAccess", "fill": {}, "find": ["endpointName"]}]}, - "redshift-serverless:DeleteNamespace": {"action": "redshift-serverless:DeleteNamespace", "types": ["namespace"], "resources": [{"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, + "redshift-serverless:DeleteNamespace": {"action": "redshift-serverless:DeleteNamespace", "types": ["namespace"], "resources": [{"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, "redshift-serverless:DeleteResourcePolicy": {"action": "redshift-serverless:DeleteResourcePolicy", "types": [], "resources": []}, "redshift-serverless:DeleteScheduledAction": {"action": "redshift-serverless:DeleteScheduledAction", "types": [], "resources": []}, - "redshift-serverless:DeleteSnapshot": {"action": "redshift-serverless:DeleteSnapshot", "types": ["snapshot"], "resources": [{"type": "snapshot", "fill": {}, "find": ["snapshotName"]}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"]}]}, + "redshift-serverless:DeleteSnapshot": {"action": "redshift-serverless:DeleteSnapshot", "types": ["snapshot"], "resources": [{"type": "snapshot", "fill": {}, "find": ["snapshotName"]}]}, "redshift-serverless:DeleteSnapshotCopyConfiguration": {"action": "redshift-serverless:DeleteSnapshotCopyConfiguration", "types": [], "resources": []}, "redshift-serverless:DeleteUsageLimit": {"action": "redshift-serverless:DeleteUsageLimit", "types": [], "resources": []}, - "redshift-serverless:DeleteWorkgroup": {"action": "redshift-serverless:DeleteWorkgroup", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}, {"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, + "redshift-serverless:DeleteWorkgroup": {"action": "redshift-serverless:DeleteWorkgroup", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, "redshift-serverless:GetCredentials": {"action": "redshift-serverless:GetCredentials", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, "redshift-serverless:GetCustomDomainAssociation": {"action": "redshift-serverless:GetCustomDomainAssociation", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, "redshift-serverless:GetEndpointAccess": {"action": "redshift-serverless:GetEndpointAccess", "types": ["endpointAccess"], "resources": [{"type": "endpointAccess", "fill": {}, "find": ["endpointName"]}]}, "redshift-serverless:GetIdentityCenterAuthToken": {"action": "redshift-serverless:GetIdentityCenterAuthToken", "types": ["workgroup"], "resources": []}, - "redshift-serverless:GetNamespace": {"action": "redshift-serverless:GetNamespace", "types": ["namespace"], "resources": [{"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, + "redshift-serverless:GetNamespace": {"action": "redshift-serverless:GetNamespace", "types": ["namespace"], "resources": [{"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, "redshift-serverless:GetRecoveryPoint": {"action": "redshift-serverless:GetRecoveryPoint", "types": ["recoveryPoint"], "resources": [{"type": "recoveryPoint", "fill": {"RecoveryPointId": "recoveryPointId"}}]}, "redshift-serverless:GetReservation": {"action": "redshift-serverless:GetReservation", "types": [], "resources": []}, "redshift-serverless:GetReservationOffering": {"action": "redshift-serverless:GetReservationOffering", "types": [], "resources": []}, @@ -3000,7 +3007,7 @@ "redshift-serverless:GetTableRestoreStatus": {"action": "redshift-serverless:GetTableRestoreStatus", "types": [], "resources": []}, "redshift-serverless:GetTrack": {"action": "redshift-serverless:GetTrack", "types": [], "resources": []}, "redshift-serverless:GetUsageLimit": {"action": "redshift-serverless:GetUsageLimit", "types": [], "resources": []}, - "redshift-serverless:GetWorkgroup": {"action": "redshift-serverless:GetWorkgroup", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}, {"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, + "redshift-serverless:GetWorkgroup": {"action": "redshift-serverless:GetWorkgroup", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, "redshift-serverless:ListCustomDomainAssociations": {"action": "redshift-serverless:ListCustomDomainAssociations", "types": [], "resources": []}, "redshift-serverless:ListEndpointAccess": {"action": "redshift-serverless:ListEndpointAccess", "types": ["endpointAccess"], "resources": []}, "redshift-serverless:ListManagedWorkgroups": {"action": "redshift-serverless:ListManagedWorkgroups", "types": [], "resources": []}, @@ -3020,18 +3027,18 @@ "redshift-serverless:RestoreFromRecoveryPoint": {"action": "redshift-serverless:RestoreFromRecoveryPoint", "types": ["recoveryPoint"], "resources": [{"type": "recoveryPoint", "fill": {"RecoveryPointId": "recoveryPointId"}}]}, "redshift-serverless:RestoreFromSnapshot": {"action": "redshift-serverless:RestoreFromSnapshot", "types": ["snapshot"], "resources": [{"types": ["snapshot"], "arn": "snapshotArn"}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"], "account": "ownerAccount"}]}, "redshift-serverless:RestoreTableFromRecoveryPoint": {"action": "redshift-serverless:RestoreTableFromRecoveryPoint", "types": ["namespace", "recoveryPoint"], "resources": [{"type": "recoveryPoint", "fill": {"RecoveryPointId": "recoveryPointId"}}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, - "redshift-serverless:RestoreTableFromSnapshot": {"action": "redshift-serverless:RestoreTableFromSnapshot", "types": ["namespace", "snapshot"], "resources": [{"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"]}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"]}]}, + "redshift-serverless:RestoreTableFromSnapshot": {"action": "redshift-serverless:RestoreTableFromSnapshot", "types": ["namespace", "snapshot"], "resources": [{"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"]}]}, "redshift-serverless:TagResource": {"action": "redshift-serverless:TagResource", "types": ["namespace", "recoveryPoint", "snapshot", "workgroup"], "resources": [{"types": ["namespace", "recoveryPoint", "snapshot", "workgroup"], "arn": "resourceArn"}]}, "redshift-serverless:UntagResource": {"action": "redshift-serverless:UntagResource", "types": ["namespace", "recoveryPoint", "snapshot", "workgroup"], "resources": [{"types": ["namespace", "recoveryPoint", "snapshot", "workgroup"], "arn": "resourceArn"}]}, "redshift-serverless:UpdateCustomDomainAssociation": {"action": "redshift-serverless:UpdateCustomDomainAssociation", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, "redshift-serverless:UpdateEndpointAccess": {"action": "redshift-serverless:UpdateEndpointAccess", "types": ["endpointAccess"], "resources": [{"type": "endpointAccess", "fill": {}, "find": ["endpointName"]}]}, - "redshift-serverless:UpdateLakehouseConfiguration": {"action": "redshift-serverless:UpdateLakehouseConfiguration", "types": ["namespace"], "resources": [{"types": ["namespace"], "arn": "lakehouseIdcApplicationArn"}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, - "redshift-serverless:UpdateNamespace": {"action": "redshift-serverless:UpdateNamespace", "types": ["namespace"], "resources": [{"types": ["namespace"], "arn": "defaultIamRoleArn"}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, + "redshift-serverless:UpdateLakehouseConfiguration": {"action": "redshift-serverless:UpdateLakehouseConfiguration", "types": ["namespace"], "resources": [{"types": ["namespace"], "arn": "lakehouseIdcApplicationArn"}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, + "redshift-serverless:UpdateNamespace": {"action": "redshift-serverless:UpdateNamespace", "types": ["namespace"], "resources": [{"types": ["namespace"], "arn": "defaultIamRoleArn"}, {"type": "namespace", "fill": {}, "find": ["namespaceName"]}]}, "redshift-serverless:UpdateScheduledAction": {"action": "redshift-serverless:UpdateScheduledAction", "types": [], "resources": []}, - "redshift-serverless:UpdateSnapshot": {"action": "redshift-serverless:UpdateSnapshot", "types": ["snapshot"], "resources": [{"type": "snapshot", "fill": {}, "find": ["snapshotName"]}, {"type": "snapshot", "fill": {}, "find": ["snapshotName"]}]}, + "redshift-serverless:UpdateSnapshot": {"action": "redshift-serverless:UpdateSnapshot", "types": ["snapshot"], "resources": [{"type": "snapshot", "fill": {}, "find": ["snapshotName"]}]}, "redshift-serverless:UpdateSnapshotCopyConfiguration": {"action": "redshift-serverless:UpdateSnapshotCopyConfiguration", "types": [], "resources": []}, "redshift-serverless:UpdateUsageLimit": {"action": "redshift-serverless:UpdateUsageLimit", "types": [], "resources": []}, - "redshift-serverless:UpdateWorkgroup": {"action": "redshift-serverless:UpdateWorkgroup", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}, {"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, + "redshift-serverless:UpdateWorkgroup": {"action": "redshift-serverless:UpdateWorkgroup", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {}, "find": ["workgroupName"]}]}, "redshift:AcceptReservedNodeExchange": {"action": "redshift:AcceptReservedNodeExchange", "types": [], "resources": []}, "redshift:AddPartner": {"action": "redshift:AddPartner", "types": [], "resources": []}, "redshift:AssociateDataShareConsumer": {"action": "redshift:AssociateDataShareConsumer", "types": ["datashare"], "resources": [{"types": ["datashare"], "arn": "ConsumerArn"}, {"types": ["datashare"], "arn": "DataShareArn"}]}, diff --git a/tools/aws/regen_iam_request_resources.py b/tools/aws/regen_iam_request_resources.py index 4bca3d81b9..6beda8bb85 100644 --- a/tools/aws/regen_iam_request_resources.py +++ b/tools/aws/regen_iam_request_resources.py @@ -94,10 +94,11 @@ follow the rule unchanged: a family of a hand-built namespace whose requests nam way the rule reads them. `HAND_BUILT` are the namespaces `ResourceArnBuilder` builds resources for itself, and `NOT_COVERED` the ones Floci serves that are not read yet, each with its reason; `RequestResourceNamespacesIntegrationTest` fails for a served namespace in none of the three. -`ID_TARGETS` stages id-list namespaces separately: a resource ARN's variable names its list member, -with the configured heterogeneous resource list as a fallback. Botocore supplies its serialized -EC2 Query name (including queryName and capitalization), and documented id prefixes distinguish -the supported resource types. `resourceTagKeys` comes from those types' Service Reference condition keys. Each generated `targets` entry preserves the +`ID_TARGETS` is Floci's coverage of id-list namespaces, the types of each it reads by id (EC2's instances): a +resource ARN's variable names its list member, with the request's list of whatever resources it acts on +(`Resources`) as a fallback. Botocore supplies its serialized EC2 Query name (including queryName and +capitalization), and the id prefix botocore documents each type with ("the instance ID (for example, +i-0123456789abcdef0)") distinguishes them. `resourceTagKeys` comes from those types' Service Reference condition keys. Each generated `targets` entry preserves the request's order and duplicates, including a wildcard for each unsupported id; only resolved ARNs use the corresponding target's condition context. Other requests in those namespaces stay on `*`. Beyond the members' names, botocore's shapes and documentation say what a member names, and the rule reads them: @@ -147,27 +148,25 @@ already give, and linking to its evidence; the generator refuses an entry that b review the first. Documentation, analogy, the request's shape and what a Floci handler does are not evidence: what they give belongs in a rule. DynamoDB's `ListTables` (`table/*`) and Step Functions' `SendTask*` (the token's activity or state machine) are its entries. -`CLIENTS_NOT_READ` are SDK clients the reference lists for a -namespace's operations whose requests Floci does not serve, each with its reason. -`UNQUALIFIED` are the resource types whose ARN a request may give with a qualifier, one more `:` -past its format, and whose service checks it without one: Step Functions checks a version or an alias -on its state machine's ARN, and Parameter Store a version or a label on its parameter's. A value filling a variable -named `...WithoutLeadingSlash` is read as a Parameter Store name, without the whitespace around it and one leading -`/`: a parameter's ARN is `parameter/`, whether or not its name starts with a slash. `MINTED_IDS` are the -resource types whose service follows the name their format ends in with an id it mints, `/`, which the -format leaves out and a request naming one by its name does not give: EventBridge's connections and API destinations, whose stored ARN the reader -asks the service for, or else checks with that id open. `FOUND_BY` are the resource types whose ARN is -all an id their service mints, which a request names by members the ARN does not hold, with those -members: each operation whose request has them all names the type by them (`find`), and the reader -asks the service for the ARN they find, or else checks the ARN with its id open, as for a create; an -Application Auto Scaling scalable target, `scalable-target/`, is named by its service namespace, -resource id and scalable dimension, and the Redshift Serverless workgroup a Data API request runs on, -`workgroup/`, by its name or ARN. `THROUGH` are the members naming a resource the reference gives no -type, through which a request names a resource of one it does, with those types: each operation whose -request has the member, and whose action acts on one of them, names its resource through it (`through`), -and the reader asks the service for the ARN of the caller's resource at the other end, or else names -none; a Data API session, by its `SessionId`, runs on the cluster or the serverless workgroup it was -opened on. A type named by its variables takes one no member fills from the ARN of another type the action acts +A type's ARN given with a qualifier, one more `:` past its format, is checked without one where the +metadata says the qualifier names nothing of its own (`unqualified`): the reference gives Step Functions' +`statemachinealias` and `statemachineversion` formats as the state machine's and one more `:${...}`, and no action +acts on them, and botocore documents Parameter Store's `Name` as `"name:version"` or `"name:label"`, a selector the +reference gives no type. A value filling a variable named `...WithoutLeadingSlash` is read as a Parameter Store +name, without the whitespace around it and one leading `/`: a parameter's ARN is `parameter/`, whether or not +its name starts with a slash. A type whose botocore ARN shape (`Arn`) takes one more path segment past its +format, which ends in a name, has an id its service mints after the name (`mintedIds`): EventBridge's connections +and API destinations, whose stored ARN the reader asks the service for, or else checks with that id open. A type +whose ARN is all an id its service mints is named by the members its service finds it by (`find`): those botocore +documents as its key ("Scalable targets are uniquely identified by the combination of resource ID, scalable +dimension, and namespace"), or else a name of it where no request of the namespace gives the id (a Redshift +Serverless namespace by its `namespaceName`), and the reader asks the service for the ARN they find, or else checks +the ARN with its id open, as for a create. A member naming a resource the reference gives no type, whose botocore +record holds it beside members named after types the action acts on, names those through it (`through`): a Data +API session's `SessionData` holds its `SessionId` beside the `ClusterIdentifier` or `WorkgroupName` it runs on, and +the reader asks the service for the ARN of the caller's resource at the other end, or else names none. A member +whose botocore shape takes an alias as well as the type's ARN, named for the type with a word before it +(`IncomingKeyIdentifier`), names a resource of the type, which its service resolves. A type named by its variables takes one no member fills from the ARN of another type the action acts on whose format is that variable alone, given by the one top-level ARN member named after that type: a permission set an IAM Identity Center create makes has the id of the instance its `InstanceArn` names. @@ -222,21 +221,6 @@ NAMESPACES = ("access-analyzer", "account", "acm", "application-autoscaling", "a "rekognition", "resource-explorer-2", "route53", "servicediscovery", "servicequotas", "ssm", "sso", "states", "textract", "timestream-influxdb", "translate", "signer", "xray", "securityhub", "guardduty") -# SDK clients the reference lists for a namespace's operations whose requests Floci does not serve, and why: their -# members are not read. -CLIENTS_NOT_READ: dict[str, str] = { - "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", -} - -# The namespaces whose members may name a resource of a type with a word before the type's, as -# `IncomingKeyIdentifier` names a key: the word says which of them it is. Such a member's value may -# be an alias, and the namespace's service resolves it to the resource the alias points at, so the -# resource is the one the alias names. A namespace whose service cannot resolve an alias is not -# among these: an alias would be read as the name of a resource of the type, which names nothing. -QUALIFIED_MEMBERS = ("payment-cryptography",) - # The namespaces whose resources ResourceArnBuilder builds itself. HAND_BUILT = ("apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "sts") @@ -381,80 +365,32 @@ NOT_COVERED: dict[str, str] = { } -# Resource types whose ARN a request may give with a qualifier, one more `:` past its format, which their -# service drops to check it, and why. -UNQUALIFIED: dict[str, str] = { - "states:statemachine": "Step Functions authorizes a version or an alias on its state machine's ARN, not on the " - "version's or the alias's ('To authorize a version or an alias to invoke an API action, " - "Step Functions uses the state machine's ARN instead of using the version ARN or alias ARN')", - "ssm:parameter": "Parameter Store reads a version or a label after a parameter's name ('To query by parameter " - "label, use \"Name\": \"name:label\". To query by parameter version, use \"Name\": " - "\"name:version\"', GetParameter's Name) and checks the read on the parameter, whose name " - "holds no colon", -} - -# Resource types whose service follows the one variable their format ends in with an id it mints, `/`, -# which the format leaves out and a request naming one by its name does not give, and why. -MINTED_IDS: dict[str, str] = { - "events:connection": "EventBridge mints a connection's ARN as connection// (botocore's ConnectionArn " - "pattern ends in connection//) and checks a connection on it: the user " - "guide grants events:RetrieveConnectionCredentials on connection//*", - "events:api-destination": "EventBridge mints an API destination's ARN as api-destination// " - "(botocore's ApiDestinationArn pattern ends in api-destination//), " - "as it does a connection's", -} - -# Resource types whose ARN is all an id their service mints, which a request names by members the ARN does not -# hold, the members in the order the service reads them, and why: an operation whose request has them all names the -# type by them, and the reader asks the service for the ARN they find. -FOUND_BY: dict[str, tuple[list[str], str]] = { - "application-autoscaling:ScalableTarget": ( - ["ServiceNamespace", "ResourceId", "ScalableDimension"], - "a scalable target's ARN ends in its unique id, scalable-target/ ('The unique ID " - "(1234abcd56ab78cd901ef1234567890ab123) is a value assigned by Application Auto Scaling to the scalable " - "target', Application Auto Scaling User Guide), which the reference names ${ResourceId}, while its requests " - "name the target by ServiceNamespace, ResourceId and ScalableDimension; ResourceId is the target's " - "resource (service//), not that id"), - **{f"redshift-serverless:{kind}": ([member], f"a Redshift Serverless {kind}'s ARN ends in the id the service gives " - f"it, {path}/ ('The unique identifier' of its {kind}), while its " - f"requests name it by {member}") - for kind, member, path in (("namespace", "namespaceName", "namespace"), - ("workgroup", "workgroupName", "workgroup"), - ("snapshot", "snapshotName", "snapshot"), - ("endpointAccess", "endpointName", "managedvpcendpoint"))}, - "redshift-data:workgroup": ( - ["WorkgroupName"], - "a serverless workgroup's ARN ends in the id Redshift Serverless gives it, workgroup/ (its Workgroup's " - "workgroupId, 'The unique identifier of the workgroup'; botocore's WorkgroupNameString takes an ARN ending " - "in workgroup/), while a Data API request names the workgroup by WorkgroupName, 'The serverless " - "workgroup name or Amazon Resource Name (ARN)'"), -} - -# Members naming a resource of their service's own the reference gives no type, through which a request names a -# resource of one it does, the types that resource may be of, and why: an operation whose request has the member, -# and whose action acts on one of those types, names it through the member, and the reader asks the service for the -# ARN of the caller's resource at the other end. -THROUGH: dict[str, tuple[list[str], str]] = { - "redshift-data:SessionId": ( - ["cluster", "workgroup"], - "a Data API session runs on the cluster or the serverless workgroup it was opened on (ListSessions filters " - "sessions 'by session status, compute target (cluster or serverless workgroup), or database'), and its " - "SessionId 'can then be used in subsequent ExecuteStatement and BatchExecuteStatement operations' " - "(Amazon Redshift Management Guide), which then run there"), -} - # The variables of an ARN format the account, partition and Region fill. KNOWN_VARIABLES = {"Partition", "Region", "Account"} -# A staged read of heterogeneous resource-id lists. The model supplies the member and its wire name; -# the Service Reference supplies the action's types and their ARN formats. EC2 documents instance ids -# with the i- prefix (EC2 User Guide, resource-ids). Only instances are covered here: other ids retain -# a wildcard entry. Lists named by their resource ARN variable and heterogeneous Resources lists -# share this reader and its generated condition contexts; requests without those lists stay unchanged. -ID_TARGETS = {"ec2": {"member": "Resources", "prefixes": {"instance": "i-"}}} +# Floci's coverage of id-list namespaces: the types of each it reads by id, which ResourceArnBuilder and the condition +# resolver resolve with their stored tags. It states no AWS fact: the model supplies each list member and its wire +# name, the Service Reference the action's types and ARN formats, and botocore's documentation the id prefix of each +# type (`id_prefixes`). Other ids keep a wildcard entry until their coverage grows; requests without those lists stay +# unchanged. +ID_TARGETS = {"ec2": ("instance",)} # An ARN format's account given as `${AccountId}`, the account `${Account}` gives in every other format. ACCOUNT_ID_SLOT_RE = re.compile(r"^(arn:[^:]*:[^:]*:[^:]*:)\$\{AccountId}:") VARIABLE_RE = re.compile(r"\$\{(\w+)}") +# A type's id with the example botocore documents it by: "the instance ID (for example, i-0123456789abcdef0)". +ID_EXAMPLE_RE = re.compile(r"\b([a-z][a-z ]*?) ID \(for example, ([a-z0-9]+-)[0-9a-f]{8,}\)") +# A sentence of botocore's documentation stating the members that key a type: " are uniquely identified by the +# combination of ". +UNIQUE_KEY_RE = re.compile(r"(?P[A-Za-z][A-Za-z ]*?) (?:are|is) uniquely identified by (?:the )?combination of " + r"(?P[A-Za-z ,]+?)(?:,? which\b|\.|$)") +# One more `:${...}` past a format: what a type of the reference qualifies another's ARN by. +QUALIFIER_RE = re.compile(r":\$\{\w+}") +# A string pattern that takes an alias, `alias/...`, as one of its alternatives. +ALIAS_PATTERN_RE = re.compile(r"(?:^|[|(])\^?alias/") +# A format's resource that is a word and one variable (`connection/${ConnectionName}`), and the two path segments of +# its own an ARN pattern takes past that word when its service mints an id after the name (`\\/[...]+\\/[...]+$`). +MINTED_WORD_RE = re.compile(r"^([A-Za-z][A-Za-z0-9-]*)/\$\{\w+}$") +MINTED_TAIL = r"\\/(?:\[[^\]]*\][+*]|\([^()]*\)[+*]?)\\/(?:\[[^\]]*\][+*]|\([^()]*\)[+*]?)\$?$" STEM_SUFFIX_RE = re.compile(r"(arns|arn|names|name|identifiers|identifier|ids|id|config|s)$") # A bare member that names the resource of the type its operation acts on. BARE = {"name", "names", "id", "ids", "identifier", "identifiers"} @@ -519,7 +455,7 @@ def resource_tag_keys(documents: list[dict]) -> dict[str, dict[str, list[str]]]: result = {} for document in documents: namespace = document["Name"] - supported = ID_TARGETS.get(namespace, {}).get("prefixes", {}) + supported = ID_TARGETS.get(namespace, ()) types = {resource["Name"]: sorted(key.removesuffix("${TagKey}") for key in resource.get("ConditionKeys", []) if key.endswith(":ResourceTag/${TagKey}")) for resource in document.get("Resources", []) if resource["Name"] in supported} @@ -997,6 +933,23 @@ def request_members(models: dict[str, dict], operation: str) -> dict[str, str]: return found +def alias_members(models: dict[str, dict], operation: str) -> set[str]: + """The top-level members of the operation's request whose botocore shape takes an alias of a resource as well as + its ARN (Payment Cryptography's `KeyArnOrKeyAliasType`, `...:(key/...|alias/...)$|^alias/...`): its service + resolves such a value to the resource the alias points at, so a member named for a type with a word before it + (`IncomingKeyIdentifier`) names a resource of that type.""" + found: set[str] = set() + for model in models.values(): + spec = model["operations"].get(operation) + if spec is None or "input" not in spec: + continue + for name, member in model["shapes"][spec["input"]["shape"]].get("members", {}).items(): + shape = model["shapes"][member["shape"]] + if shape.get("type") == "string" and ALIAS_PATTERN_RE.search(shape.get("pattern") or ""): + found.add(name) + return found + + def member_shapes(models: dict[str, dict], operation: str) -> dict[str, str]: """The botocore shape each top-level member of the operation's request holds, by member name, across the request's clients.""" @@ -1388,7 +1341,7 @@ def compatible(member: str, variable: str) -> bool: def resources_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, - shapes: dict[str, str] | None = None) -> list[dict]: + shapes: dict[str, str] | None = None, aliased: set[str] | None = None) -> list[dict]: """The resources the rule finds the operation's request naming, as vendored entries. `labels` gives the path segment before each bare member a REST request carries as a path label, stemmed (`path_labels`), and `shapes` the botocore shape each member holds (`member_shapes`).""" @@ -1436,7 +1389,7 @@ def resources_for(operation: str, types: list[str], formats: dict[str, str], mem fill: dict[str, str] = {} for variable in sorted(variables, key=lambda v: (v == in_slot, kind_of(v) == "", v)): choice = _filling(variable, kind_stem, len(variables), {m: p for m, p in names.items() if m not in fill.values()}, - bare=bare, qualified=namespace_of(operation) in QUALIFIED_MEMBERS, word_stem=word_stem, + bare=bare, aliased=aliased, word_stem=word_stem, shapes=shapes if not held else None) if choice is not None: fill[variable] = choice @@ -1458,9 +1411,8 @@ def resources_for(operation: str, types: list[str], formats: dict[str, str], mem full = [kind for kind in kinds if complete[kind]] kept += kinds if len(kinds) == 1 else (full if len(full) == 1 else []) specs = [{"types": kinds, "arn": arns[member]} for member, kinds in sorted(by_arn.items())] - qualified = namespace_of(operation) in QUALIFIED_MEMBERS return specs + [{"type": kind, "fill": dict(sorted(filled[kind].items()))} for kind in types if kind in kept] + \ - also_filled(types, members, filled, kept, used, qualified) + also_filled(types, members, filled, kept, used, aliased or set()) RESOURCE_PART_RE = re.compile(r"^arn:\$\{Partition}:[^:]*:[^:]*:[^:]*:([A-Za-z][A-Za-z0-9-]*)(.*)$") @@ -1527,7 +1479,8 @@ def creates_for(operation: str, types: list[str], formats: dict[str, str], membe 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]: + arn_members: set[str] | None = None, labels: dict[str, str] | None = None, + aliased: set[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 @@ -1541,7 +1494,8 @@ def makes_for(operation: str, types: list[str], formats: dict[str, str], members 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) + return [resource for resource in resources_for(operation, kinds, formats, members, arn_members, labels, + aliased=aliased) if resource.get("type") == kinds[0]][:1] @@ -1551,7 +1505,7 @@ def by_members_key_is_empty(kinds: list[str], filled: dict[str, dict[str, str]]) def _filling(variable: str, kind_stem: str, variables: int, names: dict[str, str], bare: set[str], - qualified: bool = False, word_stem: str | None = None, + aliased: set[str] | None = None, word_stem: str | None = None, shapes: dict[str, str] | None = None) -> str | None: """The member that fills the variable: one of a compatible kind whose stem relates to the variable's, or, for the variable named after the type or a type's only one, a member named after the type, or a @@ -1571,7 +1525,8 @@ def _filling(variable: str, kind_stem: str, variables: int, names: dict[str, str candidates = [member for member in names if compatible(member, variable) and ((member in bare and member.lower() in BARE) or (stem(member) and (related(stem(member), kind_stem) - or (qualified and names_type(member, kind_stem)))))] + or (member in (aliased or set()) + and names_type(member, kind_stem)))))] elif not candidates and word_stem and related(variable_stem, word_stem): # A variable named after the format's leading word (`rule/${EventBusName}/${RuleName}`'s `RuleName`) takes a # bare `Name` or `Id` of the operation that is about the type, and no member named after another type. @@ -1593,13 +1548,14 @@ def _filling(variable: str, kind_stem: str, variables: int, names: dict[str, str def also_filled(types: list[str], members: dict[str, str], filled: dict[str, dict[str, str]], - kept: list[str], used: dict[str, str], qualified: bool) -> list[dict]: + kept: list[str], used: dict[str, str], aliased: set[str]) -> list[dict]: """The resources a request names besides the one it fills a type with, when it names several of that type and acts on each of them.

A re-encryption decrypts under the key its path names and encrypts under the key its body names, so both are acted on and both are checked. A member that names a resource of the type, with a word before it saying which of - them it is, fills the type's variable as well.""" + them it is, fills the type's variable as well, when botocore's shape for it takes an alias as well as the type's + ARN, which the service resolves (Payment Cryptography's `KeyArnOrKeyAliasType`).""" found = [] for kind in types: if kind not in kept or kind not in filled or not filled[kind]: @@ -1609,7 +1565,7 @@ def also_filled(types: list[str], members: dict[str, str], filled: dict[str, dic for member in sorted(members): if used.get(kind) == member: continue - if not qualified or not names_type(member, kind_stem): + if member not in aliased or not names_type(member, kind_stem): continue if not compatible(member, variable): continue @@ -1629,30 +1585,59 @@ def names_type(member: str, kind_stem: str) -> bool: # --------------------------------------------------------------------------- # # The vendored document # --------------------------------------------------------------------------- # -def id_targets(operation: str, types: list[str], formats: dict[str, str], models: dict[str, dict]) -> dict | None: - """An id list, in model and EC2 Query spelling, with each supported type's discriminator.""" +def id_prefixes(models: dict[str, dict], kinds: tuple[str, ...]) -> dict[str, str]: + """The prefix botocore documents each type's ids with, "the instance ID (for example, i-0123456789abcdef0)", for the + types given; a type it gives no example of has none.""" + counts: dict[str, dict[str, int]] = {} + for model in models.values(): + for shape in model["shapes"].values(): + for member in shape.get("members", {}).values(): + documentation = member.get("documentation") or "" + if "for example, " not in documentation: + continue + text = re.sub(r"\s+", " ", re.sub(r"<[^>]+>", "", documentation)) + for named, prefix in ID_EXAMPLE_RE.findall(text): + kind = next((kind for kind in kinds if stem(kind) == stem(named.split()[-1])), None) + if kind: + counts.setdefault(kind, {}).setdefault(prefix, 0) + counts[kind][prefix] += 1 + return {kind: max(found, key=found.get) for kind, found in sorted(counts.items())} + + +def namespace_id_prefixes(namespace: str, models: dict[str, dict]) -> dict[str, str] | None: + """`id_prefixes` of the types `ID_TARGETS` reads by id in the namespace; None for a namespace it reads none of.""" + return id_prefixes(models, ID_TARGETS[namespace]) if namespace in ID_TARGETS else None + + +def id_targets(operation: str, types: list[str], formats: dict[str, str], models: dict[str, dict], + known: dict[str, str] | None = None) -> dict | None: + """An id list, in model and EC2 Query spelling, with each type `ID_TARGETS` reads by id's discriminator, the prefix + botocore documents its ids with (`id_prefixes`): the list a type's ARN variable names, or else the request's list + of whatever resources it acts on (`Resources`, of the tagging calls).""" configured = ID_TARGETS.get(namespace_of(operation)) if configured is None: return None + known = known if known is not None else id_prefixes(models, configured) found = None for model in models.values(): spec = model["operations"].get(operation.split(":", 1)[1], {}) if "input" not in spec or "ec2" not in _protocols(model): continue members = model["shapes"][spec["input"]["shape"]].get("members", {}) - variables = {variable for kind in configured["prefixes"] if kind in types and kind in formats + variables = {variable for kind in known if kind in types and kind in formats for variable in set(VARIABLE_RE.findall(formats[kind])) - KNOWN_VARIABLES} candidates = [name for name, member in members.items() if _strings(model, model["shapes"][member["shape"]]) == "[]" and name.lower().removesuffix("s") in {variable.lower() for variable in variables}] if len(candidates) > 1: raise ValueError(f"{operation}: several id lists name the target: {candidates}") - member_name = candidates[0] if candidates else configured["member"] - member = members.get(member_name) + listed = [name for name, member in members.items() if stem(name) == "resource" + and _strings(model, model["shapes"][member["shape"]]) == "[]"] + member_name = candidates[0] if candidates else listed[0] if len(listed) == 1 else None + member = members.get(member_name) if member_name else None if member is None or _strings(model, model["shapes"][member["shape"]]) != "[]": continue - prefixes = {kind: prefix for kind, prefix in configured["prefixes"].items() - if kind in types and kind in formats} + prefixes = {kind: prefix for kind, prefix in known.items() if kind in types and kind in formats} if not prefixes: continue for kind in prefixes: @@ -1668,7 +1653,8 @@ def id_targets(operation: str, types: list[str], formats: dict[str, str], models return found -def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: dict[str, dict]) -> dict: +def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: dict[str, dict], + known: dict[str, str] | None = None) -> dict: """What the file says for one operation.""" types = upstream["types"] or [] members = request_members(models, operation.split(":", 1)[1]) @@ -1680,7 +1666,7 @@ def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: d and values and all(only_arn(value) for value in values)} if namespace_of(operation) in ID_TARGETS: entry = {"action": upstream["action"], "types": types, "resources": []} - targets = id_targets(operation, types, formats, models) + targets = id_targets(operation, types, formats, models, known) if targets is not None: entry["targets"] = targets return entry @@ -1693,7 +1679,7 @@ def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: d if creates: entry["creates"] = creates makes = makes_for(operation, types, formats, members, arn_members, - path_labels(models, operation.split(":", 1)[1])) + path_labels(models, operation.split(":", 1)[1]), alias_members(models, operation.split(":", 1)[1])) if makes: entry["makes"] = makes named = _named(resources) | _named(creates) | _named(makes) @@ -1737,10 +1723,12 @@ def read_resources(operation: str, types: list[str], formats: dict[str, str], mo if resources is None: resources = with_through(with_found(with_parent_ids(resources_for(operation, types, formats, members, arn_members, labels, - member_shapes(models, name)), + member_shapes(models, name), + alias_members(models, name)), formats, types, members), - namespace_of(operation), types, members), - namespace_of(operation), types, members) + types, formats, members, found_keys(models, formats), + requested_members(models)), + types, members, through_members(models, formats)) resources = with_documented(operation, types, formats, models, resources) optional = optional_members(models, name) resources = with_absent_arn(resources, formats, optional) @@ -1752,7 +1740,9 @@ def read_resources(operation: str, types: list[str], formats: dict[str, str], mo resources = with_default_pairs(resources, formats, optional) resources = with_enum_named(operation, resources, formats, models) resources = with_subject_through(operation, resources, members, map_fields(models, name), optional, models) - return with_optional_qualifier(resources, optional) + resources = with_optional_qualifier(resources, optional) + # Two rules naming the same resource the same way name it once. + return [resource for index, resource in enumerate(resources) if resource not in resources[:index]] def with_enum_named(operation: str, resources: list[dict], formats: dict[str, str], @@ -1982,29 +1972,103 @@ def _named(value: object) -> set[str]: return {re.split(r"[\[{.]", value, maxsplit=1)[0]} if isinstance(value, str) else set() -def with_found(resources: list[dict], namespace: str, types: list[str], members: dict[str, str]) -> list[dict]: - """The resources, a `FOUND_BY` type the action acts on named by the members its service finds it by, when the - request has them all, rather than by any it fills: its variables are an id the request does not give.""" - found = [resource for resource in resources if f"{namespace}:{resource.get('type')}" not in FOUND_BY] +def with_found(resources: list[dict], types: list[str], formats: dict[str, str], members: dict[str, str], + keys: dict[str, list[str]], requested: set[str]) -> list[dict]: + """The resources, a type whose ARN is all an id its service mints named instead by the members its service finds + it by, when the request has them all, rather than by any it fills: + - the members botocore documents as its key (`found_keys`: a scalable target by its `ServiceNamespace`, + `ResourceId` and `ScalableDimension`, its own id being one Application Auto Scaling assigns); + - or else a name of it, a member named after the type or its format's resource word and ending as a name, where + the format's one variable is an id no request of the namespace gives (`requested`, every member of its requests), + which the service mints: a Redshift Serverless namespace, `namespace/${NamespaceId}`, by its `namespaceName`; a + VPC endpoint, `managedvpcendpoint/${EndpointAccessId}`, by its `endpointName`. Where some request gives the id, + as Cognito's `IdentityPoolId`, a name beside it is a new name, not the resource's.""" + by_kind = {} for kind in types: - by = FOUND_BY.get(f"{namespace}:{kind}", ([], ""))[0] - if by and all(members.get(member) == member for member in by): - found.append({"type": kind, "fill": {}, "find": list(by)}) + variables = [v for v in VARIABLE_RE.findall(formats.get(kind, "")) if v not in KNOWN_VARIABLES] + key = keys.get(kind) + if key and all(members.get(member) == member for member in key): + by_kind[kind] = key + elif len(variables) == 1 and kind_of(variables[0]) == "id" and kind not in keys: + word = RESOURCE_PART_RE.match(formats[kind]) + stems = {stem(kind)} | ({stem(word.group(1))} if word else set()) + if any(kind_of(given) in ("id", "identifier") and (given.lower() == variables[0].lower() + or (stem(variables[0]) == "resource" and stem(given) + and any(related(stem(given), known) for known in stems))) for given in requested): + continue + named = sorted(member for member, path in members.items() if path == member and kind_of(member) == "name" + and any(related(stem(member), known) for known in stems)) + if len(named) == 1: + by_kind[kind] = named + # A type botocore documents a key of is named by that key alone, never by a member filling its id, which is not one + # a request gives: a request lacking a member of its key names none. + found = [resource for resource in resources if resource.get("type") not in by_kind and resource.get("type") not in keys] + return found + [{"type": kind, "fill": {}, "find": list(by)} for kind, by in by_kind.items()] + + +def requested_members(models: dict[str, dict]) -> set[str]: + """Every top-level member of every request of the clients given.""" + return {member for model in models.values() for spec in model["operations"].values() if "input" in spec + for member in model["shapes"][spec["input"]["shape"]].get("members", {})} + + +def found_keys(models: dict[str, dict], formats: dict[str, str]) -> dict[str, list[str]]: + """The members botocore documents as a type's key, by type: "Scalable targets are uniquely identified by the + combination of resource ID, scalable dimension, and namespace" (Application Auto Scaling's + `RegisterScalableTarget`) keys a `ScalableTarget` by `ServiceNamespace`, `ResourceId` and `ScalableDimension`, the + members of the documenting request each part names, in the request's order.""" + found: dict[str, list[str]] = {} + for model in models.values(): + for operation, spec in model["operations"].items(): + text = re.sub(r"\s+", " ", re.sub(r"<[^>]+>", "", spec.get("documentation") or "")) + match = UNIQUE_KEY_RE.search(text) + if not match or "input" not in spec: + continue + kinds = [kind for kind in formats if stem(kind) == stem(match.group("things"))] + request = list(model["shapes"][spec["input"]["shape"]].get("members", {})) + parts = [re.sub(r"[^a-z0-9]", "", part.lower()) + for part in re.split(r",\s*(?:and\s+)?|\s+and\s+", match.group("parts")) if part.strip()] + key = [member for member in request if any(member.lower().endswith(part) for part in parts)] + if len(kinds) == 1 and len(key) == len(parts): + found[kinds[0]] = key return found -def with_through(resources: list[dict], namespace: str, types: list[str], members: dict[str, str]) -> list[dict]: - """The resources, and the one of the `THROUGH` types the action acts on that each member of the request naming - a resource of its service's own runs on.""" +def with_through(resources: list[dict], types: list[str], members: dict[str, str], + reached: dict[str, list[str]]) -> list[dict]: + """The resources, and the types the action acts on that each member of the request naming a resource of its + service's own reaches (`through_members`), named through that member: the reader asks the service for the ARN of + the caller's resource at the other end.""" through = [] - for key, (kinds, _) in sorted(THROUGH.items()): - member = key.split(":", 1)[1] + for member, kinds in sorted(reached.items()): on = [kind for kind in types if kind in kinds] - if key.startswith(f"{namespace}:") and on and members.get(member) == member: + if on and members.get(member) == member: through.append({"types": on, "through": member}) return resources + through +def through_members(models: dict[str, dict], formats: dict[str, str]) -> dict[str, list[str]]: + """The members naming a resource of their service's own that the reference gives no type, each with the types the + resource runs on or is in: botocore's record of it, a structure named after it that holds the member, holds members + named after those types. A Data API session's `SessionData` holds its `SessionId` beside the `ClusterIdentifier` + or `WorkgroupName` of the cluster or the serverless workgroup it runs on, so a request naming a session alone + reaches that one.""" + stems = {stem(kind): kind for kind in formats} + found: dict[str, set[str]] = {} + for model in models.values(): + for shape_name, shape in model["shapes"].items(): + fields = shape.get("members", {}) if shape.get("type") == "structure" else {} + for member in fields: + thing = stem(member) + if not member.endswith("Id") or not thing or not shape_name.lower().startswith(thing) \ + or any(related(thing, known) for known in stems): + continue + kinds = {stems[stem(field)] for field in fields if field != member and stem(field) in stems} + if kinds: + found.setdefault(member, set()).update(kinds) + return {member: sorted(kinds) for member, kinds in sorted(found.items())} + + def rest_operations(data: Path) -> dict[str, set[str]]: """The operation names of each botocore model whose REST routes Floci reads under a namespace the file reads.""" return {client: set(model["operations"]) @@ -2051,29 +2115,18 @@ def build(documents: list[dict], provenance: str, data: Path, botocore: str) -> _check_overrides(covered) read_namespaces = set(NAMESPACES) | {namespace_of(operation) for operation in covered} namespaces = {namespace: sorted({client for operation, value in covered.items() - if namespace_of(operation) == namespace for client in value["clients"] - if client not in CLIENTS_NOT_READ}) + if namespace_of(operation) == namespace for client in value["clients"]}) for namespace in sorted(read_namespaces)} formats = arn_formats(documents, read_namespaces) - unqualified = unqualified_types() - minted = minted_types() - missing = [f"{name} names {namespace}:{kind}, no resource type with an ARN format of a namespace the file reads" - for name, listed in (("UNQUALIFIED", unqualified), ("MINTED_IDS", minted)) - for namespace, kinds in listed.items() for kind in kinds if kind not in formats.get(namespace, {})] - missing += [f"MINTED_IDS names {namespace}:{kind}, whose ARN format does not end in its one variable" - for namespace, kinds in minted.items() for kind in kinds - if kind in formats.get(namespace, {}) and not ONE_VARIABLE_RE.match(_resource(formats[namespace][kind]))] - missing += [f"FOUND_BY names {key}, no resource type with an ARN format of a namespace the file reads" - for key in sorted(FOUND_BY) if key.split(":", 1)[1] not in formats.get(key.split(":", 1)[0], {})] - missing += [f"THROUGH names {key.split(':', 1)[0]}:{kind}, no resource type with an ARN format of a namespace the " - f"file reads" for key, (kinds, _) in sorted(THROUGH.items()) for kind in kinds - if kind not in formats.get(key.split(":", 1)[0], {})] - if missing: - raise ValueError("; ".join(missing)) + minted = minted_types(formats, namespaces, data) operations = {} + prefixes = {namespace: namespace_id_prefixes(namespace, load_models(data, set(namespaces[namespace]))) + for namespace in ID_TARGETS if namespace in namespaces} for operation, value in sorted(covered.items()): models = load_models(data, set(namespaces[namespace_of(operation)])) - operations[operation] = entry_for(operation, value, formats.get(namespace_of(operation), {}), models) + operations[operation] = entry_for(operation, value, formats.get(namespace_of(operation), {}), models, + prefixes.get(namespace_of(operation))) + unqualified = unqualified_types(formats, operations, namespaces, data) return { "_source": { "generator": "tools/aws/regen_iam_request_resources.py", @@ -2084,7 +2137,6 @@ def build(documents: list[dict], provenance: str, data: Path, botocore: str) -> "make iam-request-resources-verify checks every action, type and format against AWS.", }, "namespaces": namespaces, - "clientsNotRead": dict(sorted(CLIENTS_NOT_READ.items())), "handBuilt": list(HAND_BUILT), "notCovered": dict(sorted(NOT_COVERED.items())), "otherNamespaces": sorted(namespace for namespace in _with_resource_types(documents) @@ -2098,22 +2150,59 @@ def build(documents: list[dict], provenance: str, data: Path, botocore: str) -> } -def unqualified_types() -> dict[str, list[str]]: - """`UNQUALIFIED` as the types of each namespace.""" - return _types_of(UNQUALIFIED) +def unqualified_types(formats: dict[str, dict[str, str]], operations: dict[str, dict], + namespaces: dict[str, list[str]], data: Path) -> dict[str, list[str]]: + """The types of each namespace whose ARN a request may give with a qualifier, one more `:` past its format, + and whose service checks it without one: + - the reference gives types whose formats are the type's and one more `:${...}`, and no action acts on any of them: + Step Functions' `statemachinealias` and `statemachineversion`, `stateMachine:${StateMachineName}:${...}`, which + no action acts on, while `DescribeStateMachineAlias` and `StartExecution` act on the `statemachine`; + - botocore documents a member that fills the type as taking `"": "name:"`, a selector the + reference gives no type: Parameter Store's `GetParameter` `Name` ("To query by parameter version, use \"Name\": + \"name:version\""), the parameter being what is checked.""" + acted: dict[str, set[str]] = {} + for operation, entry in operations.items(): + acted.setdefault(namespace_of(operation), set()).update(entry["types"]) + found: dict[str, set[str]] = {} + for namespace, kinds in formats.items(): + for kind, arn in kinds.items(): + longer = [other for other, extended in kinds.items() + if other != kind and extended.startswith(arn) and QUALIFIER_RE.fullmatch(extended[len(arn):])] + if longer and not set(longer) & acted.get(namespace, set()): + found.setdefault(namespace, set()).add(kind) + loaded: dict[str, dict[str, dict]] = {} + for operation, entry in operations.items(): + namespace, name = namespace_of(operation), operation.split(":", 1)[1] + filled = [(resource["type"], path) for resource in entry["resources"] if "type" in resource + for path in resource.get("fill", {}).values() if "." not in path and "[" not in path] + if not filled: + continue + if namespace not in loaded: + loaded[namespace] = load_models(data, set(namespaces.get(namespace, []))) + models = loaded[namespace] + for kind, path in filled: + text = re.sub(r"<[^>]+>", "", _member_documentation(models, name, path) or "") + if re.search(r'"' + re.escape(path) + r'":\s*"name:\w+"', text): + found.setdefault(namespace, set()).add(kind) + return {namespace: sorted(kinds) for namespace, kinds in sorted(found.items())} -def minted_types() -> dict[str, list[str]]: - """`MINTED_IDS` as the types of each namespace.""" - return _types_of(MINTED_IDS) - - -def _types_of(listed: dict[str, str]) -> dict[str, list[str]]: - """`:` keys as the types of each namespace.""" +def minted_types(formats: dict[str, dict[str, str]], namespaces: dict[str, list[str]], + data: Path) -> dict[str, list[str]]: + """The types of each namespace whose service follows the one variable their format ends in with an id it mints, + which the format leaves out and a request naming one by its name does not give: botocore's ARN shape for the type + (`Arn`) takes one more path segment past the format's, two each of its own (EventBridge's `ConnectionArn` + ends in `connection\\/[...]+\\/[...]+`, the format in `connection/${ConnectionName}`).""" found: dict[str, list[str]] = {} - for key in sorted(listed): - namespace, kind = key.split(":", 1) - found.setdefault(namespace, []).append(kind) + for namespace in sorted(formats): + shapes = {name.lower(): shape["pattern"] + for model in load_models(data, set(namespaces.get(namespace, []))).values() + for name, shape in model["shapes"].items() if shape.get("type") == "string" and shape.get("pattern")} + for kind, arn in sorted(formats[namespace].items()): + word = MINTED_WORD_RE.match(_resource(arn)) + pattern = shapes.get(re.sub(r"[^a-z0-9]", "", kind.lower()) + "arn") + if word and pattern and re.search(re.escape(word.group(1)) + MINTED_TAIL, pattern): + found.setdefault(namespace, []).append(kind) return found @@ -2157,7 +2246,7 @@ def _check_overrides(covered: dict[str, dict]) -> None: def render(document: dict) -> str: """The document with one operation to a line.""" lines = ["{"] - for key in ("_source", "namespaces", "clientsNotRead", "handBuilt", "notCovered", "otherNamespaces", "arnFormats", "resourceTagKeys", + for key in ("_source", "namespaces", "handBuilt", "notCovered", "otherNamespaces", "arnFormats", "resourceTagKeys", "unqualified", "mintedIds"): lines.append(f' "{key}": {json.dumps(document[key])},') lines.append(' "operations": {') @@ -2225,10 +2314,9 @@ def validate(document: dict) -> list[str]: if not isinstance(document.get(key), list) or not all(isinstance(n, str) and NAMESPACE_RE.match(n) for n in document[key]): problems.append(f"{key} is not a list of namespaces") - for key in ("notCovered", "clientsNotRead"): - if not isinstance(document.get(key), dict) or not all( - isinstance(reason, str) and reason for reason in document[key].values()): - problems.append(f"{key} does not give each a reason") + if not isinstance(document.get("notCovered"), dict) or not all( + isinstance(reason, str) and reason for reason in document["notCovered"].values()): + problems.append("notCovered does not give each a reason") for operation, entry in operations.items(): namespace = namespace_of(operation) if not OPERATION_RE.match(operation) or namespace not in namespaces: @@ -2385,20 +2473,21 @@ def _created_problems(operation: str, created: object, types: set[str], formats: def derive(document: dict, data: Path) -> list[str]: """Where the resources the file gives differ from what botocore gives for its types and formats.""" problems: list[str] = [] - if document["clientsNotRead"] != dict(sorted(CLIENTS_NOT_READ.items())): - problems.append(f"the file leaves out the clients {json.dumps(document['clientsNotRead'])}, CLIENTS_NOT_READ " - f"gives {json.dumps(dict(sorted(CLIENTS_NOT_READ.items())))}") - if document["unqualified"] != unqualified_types(): - problems.append(f"the file checks {json.dumps(document['unqualified'])} without a qualifier, " - f"UNQUALIFIED gives {json.dumps(unqualified_types())}") - if document["mintedIds"] != minted_types(): - problems.append(f"the file gives {json.dumps(document['mintedIds'])} a minted id, " - f"MINTED_IDS gives {json.dumps(minted_types())}") + unqualified = unqualified_types(document["arnFormats"], document["operations"], document["namespaces"], data) + if document["unqualified"] != unqualified: + problems.append(f"the file checks {json.dumps(document['unqualified'])} without a qualifier, the reference " + f"and botocore give {json.dumps(unqualified)}") + minted = minted_types(document["arnFormats"], document["namespaces"], data) + if document["mintedIds"] != minted: + problems.append(f"the file gives {json.dumps(document['mintedIds'])} a minted id, botocore's ARN patterns " + f"give {json.dumps(minted)}") + prefixes = {namespace: namespace_id_prefixes(namespace, load_models(data, set(document["namespaces"][namespace]))) + for namespace in ID_TARGETS if namespace in document["namespaces"]} for operation, entry in document["operations"].items(): namespace = namespace_of(operation) models = load_models(data, set(document["namespaces"][namespace])) expected = entry_for(operation, {"action": entry["action"], "types": entry["types"]}, - document["arnFormats"].get(namespace, {}), models) + document["arnFormats"].get(namespace, {}), models, prefixes.get(namespace)) if expected != entry: problems.append(f"{operation}: the file has {json.dumps(entry)}, botocore gives {json.dumps(expected)}") return problems @@ -2415,7 +2504,7 @@ def verify_against(vendored: dict, upstream: dict[str, dict], formats: dict[str, untrue.append(f"AWS checks {operation} as {actual['action']}, not {entry['action']}") elif (actual["types"] or []) != entry["types"]: untrue.append(f"AWS gives {entry['action']} the resource types {actual['types']}, not {entry['types']}") - elif not set(actual["clients"]) - set(vendored["clientsNotRead"]) <= set(vendored["namespaces"][namespace_of(operation)]): + elif not set(actual["clients"]) <= set(vendored["namespaces"][namespace_of(operation)]): untrue.append(f"AWS lists {operation} for {actual['clients']}, which the file does not read") for namespace, types in vendored["arnFormats"].items(): changed = sorted(kind for kind, arn in types.items() if formats.get(namespace, {}).get(kind) != arn) diff --git a/tools/aws/test_regen_iam_request_resources.py b/tools/aws/test_regen_iam_request_resources.py index dc2e7a136d..1ecd48385a 100644 --- a/tools/aws/test_regen_iam_request_resources.py +++ b/tools/aws/test_regen_iam_request_resources.py @@ -372,11 +372,6 @@ def isolated(monkeypatch): monkeypatch.setattr(r, "NOT_COVERED", {"later": "a later batch"}) monkeypatch.setattr(r, "READ_IN_HAND_BUILT", {}) monkeypatch.setattr(r, "MEASURED", {}) - monkeypatch.setattr(r, "UNQUALIFIED", {}) - monkeypatch.setattr(r, "MINTED_IDS", {}) - monkeypatch.setattr(r, "FOUND_BY", {}) - monkeypatch.setattr(r, "THROUGH", {}) - monkeypatch.setattr(r, "CLIENTS_NOT_READ", {}) return monkeypatch @@ -556,104 +551,125 @@ def test_a_hand_edited_entry_does_not_match_botocore(isolated, tmp_path): assert len(r.derive(document, tmp_path)) == 1 -def test_a_type_checked_without_a_qualifier_is_recorded_and_must_be_one_the_file_reads(isolated, tmp_path): +THINGS = {"thing": "arn:${Partition}:svc:${Region}:${Account}:thing/${ThingName}", + "thingversion": "arn:${Partition}:svc:${Region}:${Account}:thing/${ThingName}:${ThingVersion}"} + + +def test_a_type_another_qualifies_and_no_action_acts_on_is_checked_without_the_qualifier(isolated, tmp_path): write_models(tmp_path, {"svc": model({"GetThing": {"ThingName": "String"}, "ListThings": {}})}) - isolated.setattr(r, "UNQUALIFIED", {"svc:thing": "its service checks a qualified ARN without the qualifier"}) - document = r.build(DOCUMENTS, "test", tmp_path, "botocore test") + documents = [reference("svc", {"GetThing": ["thing"], "ListThings": []}, THINGS)] + document = r.build(documents, "test", tmp_path, "botocore test") + # `thingversion` is a thing's format and one more `:${...}`, and no action acts on it. assert document["unqualified"] == {"svc": ["thing"]} assert r.validate(document) == [] and r.derive(document, tmp_path) == [] - # A hand edit no longer matches, and a type the file has no format for fails the build. + # A hand edit no longer matches. document["unqualified"] = {} assert r.validate(document) == [] and len(r.derive(document, tmp_path)) == 1 - isolated.setattr(r, "UNQUALIFIED", {"svc:gone": "no longer there"}) - with pytest.raises(ValueError, match="svc:gone"): - r.build(DOCUMENTS, "test", tmp_path, "botocore test") + # An action acting on the qualified type checks it on its own ARN. + documents = [reference("svc", {"GetThing": ["thing"], "ListThings": ["thingversion"]}, THINGS)] + assert r.build(documents, "test", tmp_path, "botocore test")["unqualified"] == {} -def test_a_type_whose_service_mints_an_id_after_its_name_is_recorded_and_must_be_one_the_file_reads(isolated, tmp_path): - write_models(tmp_path, {"svc": model({"GetThing": {"ThingName": "String"}, "ListThings": {}})}) - isolated.setattr(r, "MINTED_IDS", {"svc:thing": "its service follows the name with an id it mints"}) +def test_a_member_documented_to_take_a_selector_after_the_name_checks_its_type_without_it(isolated, tmp_path): + documented_ = model({"GetThing": {"ThingName": "String"}, "ListThings": {}}) + documented_["shapes"]["GetThingIn"]["members"]["ThingName"]["documentation"] = ( + '

The thing. To read a version, use "ThingName": "name:version".

') + write_models(tmp_path, {"svc": documented_}) + document = r.build([reference("svc", {"GetThing": ["thing"], "ListThings": []}, {"thing": THINGS["thing"]})], + "test", tmp_path, "botocore test") + assert document["unqualified"] == {"svc": ["thing"]} + assert r.derive(document, tmp_path) == [] + # Without that form documented, the thing is checked as given. + write_models(tmp_path / "plain", {"svc": model({"GetThing": {"ThingName": "String"}, "ListThings": {}})}) + assert r.build([reference("svc", {"GetThing": ["thing"], "ListThings": []}, {"thing": THINGS["thing"]})], + "test", tmp_path / "plain", "botocore test")["unqualified"] == {} + + +def test_a_type_whose_arn_shape_takes_a_segment_past_its_name_has_an_id_its_service_mints(isolated, tmp_path): + minted = model({"GetThing": {"ThingName": "String"}, "ListThings": {}}) + minted["shapes"]["ThingArn"] = {"type": "string", + "pattern": "^arn:aws:svc:[a-z0-9-]+:[0-9]{12}:thing\\/[\\.\\-_A-Za-z0-9]+\\/[\\-A-Za-z0-9]+$"} + write_models(tmp_path, {"svc": minted}) document = r.build(DOCUMENTS, "test", tmp_path, "botocore test") assert document["mintedIds"] == {"svc": ["thing"]} assert r.validate(document) == [] and r.derive(document, tmp_path) == [] - # A hand edit no longer matches, and a type the file has no format for fails the build. document["mintedIds"] = {} - assert r.validate(document) == [] and len(r.derive(document, tmp_path)) == 1 - isolated.setattr(r, "MINTED_IDS", {"svc:gone": "no longer there"}) - with pytest.raises(ValueError, match="svc:gone"): - r.build(DOCUMENTS, "test", tmp_path, "botocore test") + assert len(r.derive(document, tmp_path)) == 1 + # One segment that may hold slashes is the name alone. + minted["shapes"]["ThingArn"]["pattern"] = "^arn:aws:svc:[a-z0-9-]+:[0-9]{12}:thing\\/([a-zA-Z0-9-_\\.\\/]*)" + write_models(tmp_path / "plain", {"svc": minted}) + assert r.build(DOCUMENTS, "test", tmp_path / "plain", "botocore test")["mintedIds"] == {} -def test_a_type_whose_arn_is_all_an_id_its_service_mints_is_found_by_the_members_naming_it(isolated, tmp_path): +def test_a_type_whose_arn_is_all_an_id_its_service_mints_is_found_by_its_documented_key_or_its_name(isolated, tmp_path): documents = [reference("svc", {"PutTarget": ["target"], "TagTarget": ["target"], "GetByResource": ["target"], - "RunOn": ["target", "group"]}, + "RunOn": ["target", "group"], "RenameGroup": ["group"]}, {"target": "arn:${Partition}:svc:${Region}:${Account}:target/${ResourceId}", "group": "arn:${Partition}:svc:${Region}:${Account}:group/${GroupId}"})] - write_models(tmp_path, {"svc": model({"PutTarget": {"Namespace": "String", "ResourceId": "String", - "Dimension": "String"}, - "TagTarget": {"ResourceArn": "String"}, - "GetByResource": {"ResourceId": "String"}, - "RunOn": {"GroupName": "String"}})}) - isolated.setattr(r, "FOUND_BY", {"svc:target": (["Namespace", "ResourceId", "Dimension"], "its service mints the id"), - "svc:group": (["GroupName"], "its service mints the id")}) + found = model({"PutTarget": {"Namespace": "String", "ResourceId": "String", "Dimension": "String"}, + "TagTarget": {"ResourceArn": "String"}, + "GetByResource": {"ResourceId": "String"}, + "RunOn": {"GroupName": "String"}, "RenameGroup": {"GroupName": "String"}}) + found["operations"]["PutTarget"]["documentation"] = ( + "

Targets are uniquely identified by the combination of namespace, resource ID, and dimension.

") + write_models(tmp_path, {"svc": found}) document = r.build(documents, "test", tmp_path, "botocore test") assert r.validate(document) == [] and r.derive(document, tmp_path) == [] operations = document["operations"] - # Found by the three, in order, rather than filled by ResourceId, which is not the id the ARN ends in. + # Found by its documented key, in the request's order, rather than filled by ResourceId, not the id its ARN ends in. assert operations["svc:PutTarget"]["resources"] == [ {"type": "target", "fill": {}, "find": ["Namespace", "ResourceId", "Dimension"]}] - # Its ARN names it as given, and a request lacking a member names none. + # Its ARN names it as given, and a request lacking a member of its key names none. assert operations["svc:TagTarget"]["resources"] == [{"types": ["target"], "arn": "ResourceArn"}] assert operations["svc:GetByResource"]["resources"] == [] - # Found by its name though no member fills its id, so the rule derives nothing for it. + # Found by its name, its id being one no request gives. assert operations["svc:RunOn"]["resources"] == [{"type": "group", "fill": {}, "find": ["GroupName"]}] - # A hand edit no longer matches, and a type the file has no format for fails the build. + # Where a request gives the id, a name beside it is a new name, not the group's. + found["shapes"]["RenameGroupIn"]["members"]["GroupId"] = {"shape": "String"} + write_models(tmp_path / "given", {"svc": found}) + renamed = r.build(documents, "test", tmp_path / "given", "botocore test")["operations"] + assert renamed["svc:RenameGroup"]["resources"] == [{"type": "group", "fill": {"GroupId": "GroupId"}}] + assert not any("find" in resource for resource in renamed["svc:RunOn"]["resources"]) + # A hand edit no longer matches. operations["svc:PutTarget"]["resources"] = [{"type": "target", "fill": {"ResourceId": "ResourceId"}}] - assert r.validate(document) == [] and len(r.derive(document, tmp_path)) == 1 - isolated.setattr(r, "FOUND_BY", {"svc:gone": (["Namespace"], "no longer there")}) - with pytest.raises(ValueError, match="svc:gone"): - r.build(documents, "test", tmp_path, "botocore test") + assert len(r.derive(document, tmp_path)) == 1 -def test_a_member_naming_a_resource_of_no_type_names_the_one_it_runs_on_through_it(isolated, tmp_path): +def test_a_member_naming_a_resource_of_no_type_names_what_its_record_says_it_runs_on_through_it(isolated, tmp_path): documents = [reference("svc", {"Run": ["cluster", "group"], "RunOnGroup": ["group"], "RunOnCluster": ["cluster"], "ListSessions": []}, {"cluster": "arn:${Partition}:svc:${Region}:${Account}:cluster:${ClusterName}", "group": "arn:${Partition}:svc:${Region}:${Account}:group/${GroupId}"})] - write_models(tmp_path, {"svc": model({"Run": {"SessionId": "String"}, "RunOnGroup": {"SessionId": "String"}, - "RunOnCluster": {"Sql": "String"}, "ListSessions": {"SessionId": "String"}})}) - isolated.setattr(r, "THROUGH", {"svc:SessionId": (["cluster", "group"], "a session runs on one")}) + sessions = model({"Run": {"SessionId": "String"}, "RunOnGroup": {"SessionId": "String"}, + "RunOnCluster": {"Sql": "String"}, "ListSessions": {"SessionId": "String"}}) + # A session's record holds its id beside the cluster or group it runs on. + sessions["shapes"]["SessionData"] = {"type": "structure", "members": { + "SessionId": {"shape": "String"}, "ClusterIdentifier": {"shape": "String"}, "GroupId": {"shape": "String"}, + "Status": {"shape": "String"}}} + write_models(tmp_path, {"svc": sessions}) document = r.build(documents, "test", tmp_path, "botocore test") assert r.validate(document) == [] and r.derive(document, tmp_path) == [] operations = document["operations"] - # Named through the session, as one of the types the action acts on. assert operations["svc:Run"]["resources"] == [{"types": ["cluster", "group"], "through": "SessionId"}] assert operations["svc:RunOnGroup"]["resources"][-1] == {"types": ["group"], "through": "SessionId"} # Not by a request without the member, nor for an action acting on none of the types. assert not any("through" in resource for resource in operations["svc:RunOnCluster"]["resources"]) assert operations["svc:ListSessions"]["resources"] == [] - # A hand edit no longer matches, and a type the file has no format for fails the build. - operations["svc:Run"]["resources"] = [] - assert r.validate(document) == [] and len(r.derive(document, tmp_path)) == 1 - isolated.setattr(r, "THROUGH", {"svc:SessionId": (["gone"], "no longer there")}) - with pytest.raises(ValueError, match="svc:gone"): - r.build(documents, "test", tmp_path, "botocore test") + # Without the record, the session reaches nothing. + del sessions["shapes"]["SessionData"] + write_models(tmp_path / "plain", {"svc": sessions}) + assert r.build(documents, "test", tmp_path / "plain", "botocore test")["operations"]["svc:Run"]["resources"] == [] -def test_a_client_not_read_gives_no_members_and_aws_listing_it_is_no_untrue_claim(isolated, tmp_path): - isolated.setattr(r, "CLIENTS_NOT_READ", {"svcv2": "a second API Floci does not serve"}) - write_models(tmp_path, {"svc": model({"GetThing": {"ThingName": "String"}, "ListThings": {}}), - "svcv2": model({"GetThing": {"ThingArn": "String"}})}) - documents = [dict(DOCUMENTS[0], Operations=[dict(op, SDK=op["SDK"] + [{"Name": "svcv2", "Package": "Boto3"}]) - for op in DOCUMENTS[0]["Operations"]])] + DOCUMENTS[1:] - document = r.build(documents, "test", tmp_path, "botocore test") - assert document["namespaces"] == {"svc": ["svc"]} and document["clientsNotRead"] == {"svcv2": "a second API Floci does not serve"} - assert document["operations"]["svc:GetThing"]["resources"] == [{"type": "thing", "fill": {"ThingName": "ThingName"}}] - assert r.validate(document) == [] and r.derive(document, tmp_path) == [] - upstream = r.checked_actions(documents) - assert r.verify_against(document, upstream, {"svc": {"thing": FORMATS["thing"]}}) == ([], []) - document["clientsNotRead"] = {} - assert len(r.derive(document, tmp_path)) == 1 +def test_a_member_whose_shape_takes_an_alias_names_its_type_with_a_word_before_it(): + formats = {"key": "arn:${Partition}:svc:${Region}:${Account}:key/${KeyArn}"} + keys = model({"ReEncrypt": {"IncomingKeyIdentifier": "KeyArnOrKeyAliasType", + "OutgoingKeyIdentifier": "KeyArnOrKeyAliasType"}}) + keys["shapes"]["KeyArnOrKeyAliasType"] = { + "type": "string", "pattern": "arn:aws:svc:[a-z0-9-]+:[0-9]{12}:(key/[0-9a-zA-Z]{16,64}|alias/[a-zA-Z0-9/_-]+)$|^alias/[a-zA-Z0-9/_-]+"} + assert r.alias_members({"svc": keys}, "ReEncrypt") == {"IncomingKeyIdentifier", "OutgoingKeyIdentifier"} + keys["shapes"]["KeyArnOrKeyAliasType"]["pattern"] = "arn:aws:svc:[a-z0-9-]+:[0-9]{12}:key/[0-9a-zA-Z]{16,64}" + assert r.alias_members({"svc": keys}, "ReEncrypt") == set() def test_a_member_taking_an_arn_before_a_name_is_read_as_the_variable_of_that_types_arn(): @@ -689,7 +705,7 @@ def test_a_field_of_each_of_a_lists_structures_taking_an_arn_before_a_name_is_re def good_document() -> dict: - return {"namespaces": {"svc": ["svc"]}, "clientsNotRead": {"svcv2": "not served"}, "handBuilt": ["hand"], + return {"namespaces": {"svc": ["svc"]}, "handBuilt": ["hand"], "notCovered": {"later": "a later batch"}, "otherNamespaces": ["other"], "arnFormats": {"svc": {"thing": FORMATS["thing"], "group": FORMATS["group"]}}, "unqualified": {"svc": ["thing"]}, "mintedIds": {"svc": ["thing"]}, @@ -792,7 +808,6 @@ def with_a_create() -> dict: (lambda d: d["arnFormats"]["svc"].update(group="arn:${Partition}:svc:${Region}:${Account}:group/${GroupName}/${Id}") or d["operations"]["svc:B"]["resources"][0].update(arnOf={"Bus": "group"}), "types of one variable"), (lambda d: d["operations"]["svc:A"]["resources"][0].update(unless={"Type": ["a"]}), "neither an ARN member"), - (lambda d: d["clientsNotRead"].update(svcv2=""), "clientsNotRead"), (lambda d: d.update(unqualified={"svc": ["pool"]}), "unqualified"), (lambda d: d.update(unqualified={"other": ["thing"]}), "unqualified"), (lambda d: d.update(unqualified={"svc": []}), "unqualified"), @@ -882,7 +897,6 @@ def test_the_vendored_file_is_well_formed(): # EventBridge V2 is read beside EventBridge, and where both name an operation's resources, which one applies is # the endpoint serving the request, never a member a caller could add. assert document["namespaces"]["events"] == ["eventbridgev2", "events"] - assert "eventbridgev2" not in document["clientsNotRead"] assert operations["events:DeleteSubscriber"]["resources"] == [{"types": ["subscriber"], "arn": "SubscriberArn"}] assert operations["events:DeleteEventBus"]["resources"] == [ {"types": ["event-busv2"], "arn": "EventBusArn", "endpoint": "eventsv2"}, @@ -1119,8 +1133,16 @@ def test_verify_reports_a_rest_models_operation_whose_action_aws_no_longer_has(i assert r.main(["--verify", "--source-dir", str(sources), "--output", str(output)]) == 1 +def with_instance_example(model_: dict) -> dict: + """An EC2 model whose documentation gives an instance id's example, as botocore's does.""" + model_["shapes"]["Filter"] = {"type": "structure", "members": {"Value": { + "shape": "String", "documentation": "

For associations, this is the instance ID (for example, " + "i-0123456789abcdef0).

"}}} + return model_ + + def test_id_targets_follow_the_model_and_resource_types_not_operation_names(): - ec2 = model({"AnnotateResources": {"Resources": "Strings"}}, "ec2") + ec2 = with_instance_example(model({"AnnotateResources": {"Resources": "Strings"}}, "ec2")) member = ec2["shapes"]["AnnotateResourcesIn"]["members"]["Resources"] member["locationName"] = "resourceId" formats = {"instance": "arn:${Partition}:ec2:${Region}:${Account}:instance/${InstanceId}"} @@ -1133,6 +1155,10 @@ def test_id_targets_follow_the_model_and_resource_types_not_operation_names(): assert "targets" not in r.entry_for("ec2:AnnotateResources", {**upstream, "types": ["volume"]}, formats, {"ec2": ec2}) member["shape"] = "String" assert "targets" not in r.entry_for("ec2:AnnotateResources", upstream, formats, {"ec2": ec2}) + # With no example of an instance id in botocore's documentation, nothing tells an instance id apart. + member["shape"] = "Strings" + del ec2["shapes"]["Filter"] + assert "targets" not in r.entry_for("ec2:AnnotateResources", upstream, formats, {"ec2": ec2}) @pytest.mark.parametrize("operation,target", [(operation, entry["targets"]) @@ -1162,7 +1188,7 @@ def test_generated_targets_match_botocores_actual_serialization(operation, targe def test_instance_target_member_is_derived_from_the_arn_variable_not_the_action_name(): names = ("StartInstances", "StopInstances", "RebootInstances", "TerminateInstances", "InventedAction") - ec2 = model({name: {"InstanceIds": "Strings", "Resources": "Strings"} for name in names}, "ec2") + ec2 = with_instance_example(model({name: {"InstanceIds": "Strings", "Resources": "Strings"} for name in names}, "ec2")) formats = {"instance": "arn:${Partition}:ec2:${Region}:${Account}:instance/${InstanceId}"} for name in names: member = ec2["shapes"][name + "In"]["members"]["InstanceIds"] @@ -1178,7 +1204,7 @@ def test_instance_target_member_is_derived_from_the_arn_variable_not_the_action_ ec2["shapes"]["StartInstancesIn"]["members"]["DecoyInstanceIds"] = {"shape": "Strings"} assert "targets" not in r.entry_for("ec2:StartInstances", {"action": "ec2:StartInstances", "types": ["instance"]}, formats, {"ec2": ec2}) - renamed = model({"InventedAction": {"MachineIds": "Strings"}}, "ec2") + renamed = with_instance_example(model({"InventedAction": {"MachineIds": "Strings"}}, "ec2")) renamed_formats = {"instance": "arn:${Partition}:ec2:${Region}:${Account}:instance/${MachineId}"} assert r.entry_for("ec2:InventedAction", {"action": "ec2:InventedAction", "types": ["instance"]}, renamed_formats, {"ec2": renamed})["targets"]["member"] == "MachineIds[]"