arnmatch 2026.1.1__py3-none-any.whl → 2026.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- arnmatch/__init__.py +30 -3
- arnmatch/arn_patterns.py +56 -0
- {arnmatch-2026.1.1.dist-info → arnmatch-2026.1.3.dist-info}/METADATA +11 -8
- arnmatch-2026.1.3.dist-info/RECORD +6 -0
- arnmatch-2026.1.1.dist-info/RECORD +0 -6
- {arnmatch-2026.1.1.dist-info → arnmatch-2026.1.3.dist-info}/WHEEL +0 -0
- {arnmatch-2026.1.1.dist-info → arnmatch-2026.1.3.dist-info}/entry_points.txt +0 -0
arnmatch/__init__.py
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"""ARN pattern matching using regex patterns."""
|
|
2
2
|
|
|
3
|
-
__version__ = "2026.01.
|
|
3
|
+
__version__ = "2026.01.3"
|
|
4
4
|
|
|
5
5
|
import sys
|
|
6
6
|
from dataclasses import dataclass
|
|
7
7
|
from functools import cached_property
|
|
8
8
|
|
|
9
|
-
from .arn_patterns import
|
|
9
|
+
from .arn_patterns import (
|
|
10
|
+
ARN_PATTERNS,
|
|
11
|
+
AWS_SDK_SERVICES,
|
|
12
|
+
AWS_SDK_SERVICES_DEFAULT,
|
|
13
|
+
AWS_SDK_SERVICES_OVERRIDE,
|
|
14
|
+
)
|
|
10
15
|
|
|
11
16
|
# Standard groups that are not resource-specific
|
|
12
17
|
STANDARD_GROUPS = {"Partition", "Region", "Account"}
|
|
@@ -78,7 +83,7 @@ class ARN:
|
|
|
78
83
|
return self.resource_id
|
|
79
84
|
|
|
80
85
|
@cached_property
|
|
81
|
-
def aws_sdk_services(self):
|
|
86
|
+
def aws_sdk_services(self) -> list[str]:
|
|
82
87
|
"""Get AWS SDK (boto3) client names for this resource's service.
|
|
83
88
|
|
|
84
89
|
Returns list of client names that can interact with this resource type.
|
|
@@ -88,6 +93,26 @@ class ARN:
|
|
|
88
93
|
"""
|
|
89
94
|
return AWS_SDK_SERVICES.get(self.aws_service, [])
|
|
90
95
|
|
|
96
|
+
@cached_property
|
|
97
|
+
def aws_sdk_service(self) -> str | None:
|
|
98
|
+
"""Get the AWS SDK (boto3) client name for this resource.
|
|
99
|
+
|
|
100
|
+
Returns single client name. Checks resource-level overrides first,
|
|
101
|
+
then falls back to service default. Returns None if no SDK exists.
|
|
102
|
+
"""
|
|
103
|
+
# Check resource-level override
|
|
104
|
+
overrides = AWS_SDK_SERVICES_OVERRIDE.get(self.aws_service)
|
|
105
|
+
if overrides and self.resource_type in overrides:
|
|
106
|
+
return overrides[self.resource_type]
|
|
107
|
+
|
|
108
|
+
# Fall back to service-level
|
|
109
|
+
sdks = self.aws_sdk_services
|
|
110
|
+
if len(sdks) == 1:
|
|
111
|
+
return sdks[0]
|
|
112
|
+
if len(sdks) > 1:
|
|
113
|
+
return AWS_SDK_SERVICES_DEFAULT.get(self.aws_service)
|
|
114
|
+
return None
|
|
115
|
+
|
|
91
116
|
|
|
92
117
|
def arnmatch(arn: str) -> ARN:
|
|
93
118
|
"""Match ARN against patterns.
|
|
@@ -132,6 +157,8 @@ def main() -> None:
|
|
|
132
157
|
try:
|
|
133
158
|
result = arnmatch(arn)
|
|
134
159
|
print(f"aws_service: {result.aws_service}")
|
|
160
|
+
print(f"aws_sdk_service: {result.aws_sdk_service}")
|
|
161
|
+
print(f"aws_sdk_services: {','.join(result.aws_sdk_services)}")
|
|
135
162
|
print(f"aws_region: {result.aws_region}")
|
|
136
163
|
print(f"aws_account: {result.aws_account}")
|
|
137
164
|
print(f"resource_type: {result.resource_type}")
|
arnmatch/arn_patterns.py
CHANGED
|
@@ -3155,3 +3155,59 @@ AWS_SDK_SERVICES = {
|
|
|
3155
3155
|
'workspaces-web': ['workspaces-web'],
|
|
3156
3156
|
'xray': ['xray'],
|
|
3157
3157
|
}
|
|
3158
|
+
|
|
3159
|
+
# Default SDK for multi-SDK services
|
|
3160
|
+
AWS_SDK_SERVICES_DEFAULT = {
|
|
3161
|
+
'apigateway': 'apigateway',
|
|
3162
|
+
'appconfig': 'appconfig',
|
|
3163
|
+
'aws-marketplace': 'marketplace-catalog',
|
|
3164
|
+
'bedrock': 'bedrock',
|
|
3165
|
+
'bedrock-agentcore': 'bedrock-agentcore-control',
|
|
3166
|
+
'cassandra': 'keyspaces',
|
|
3167
|
+
'chime': 'chime',
|
|
3168
|
+
'cloudhsm': 'cloudhsmv2',
|
|
3169
|
+
'cloudsearch': 'cloudsearch',
|
|
3170
|
+
'connect': 'connect',
|
|
3171
|
+
'connect-campaigns': 'connectcampaignsv2',
|
|
3172
|
+
'dynamodb': 'dynamodb',
|
|
3173
|
+
'elasticloadbalancing': 'elbv2',
|
|
3174
|
+
'es': 'opensearch',
|
|
3175
|
+
'execute-api': 'apigatewaymanagementapi',
|
|
3176
|
+
'forecast': 'forecast',
|
|
3177
|
+
'greengrass': 'greengrassv2',
|
|
3178
|
+
'ivs': 'ivs',
|
|
3179
|
+
'kinesisanalytics': 'kinesisanalyticsv2',
|
|
3180
|
+
'kinesisvideo': 'kinesisvideo',
|
|
3181
|
+
'lex': 'lexv2-models',
|
|
3182
|
+
'mediastore': 'mediastore',
|
|
3183
|
+
'mgh': 'mgh',
|
|
3184
|
+
'partnercentral': 'partnercentral-selling',
|
|
3185
|
+
'payment-cryptography': 'payment-cryptography',
|
|
3186
|
+
'personalize': 'personalize',
|
|
3187
|
+
'rds': 'rds',
|
|
3188
|
+
'route53-recovery-control': 'route53-recovery-control-config',
|
|
3189
|
+
's3': 's3',
|
|
3190
|
+
'sagemaker': 'sagemaker',
|
|
3191
|
+
'servicecatalog': 'servicecatalog',
|
|
3192
|
+
'ses': 'sesv2',
|
|
3193
|
+
'sms-voice': 'pinpoint-sms-voice-v2',
|
|
3194
|
+
'sso': 'sso-admin',
|
|
3195
|
+
'timestream': 'timestream-write',
|
|
3196
|
+
'wisdom': 'qconnect',
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
# Resource-level SDK overrides: resource_type -> sdk_client
|
|
3200
|
+
AWS_SDK_SERVICES_OVERRIDE = {
|
|
3201
|
+
'apigateway': {'ApiMappings': 'apigatewayv2', 'ApiMapping': 'apigatewayv2', 'Apis': 'apigatewayv2', 'Api': 'apigatewayv2', 'Cors': 'apigatewayv2', 'ExportedAPI': 'apigatewayv2', 'Integrations': 'apigatewayv2', 'RouteRequestParameter': 'apigatewayv2', 'RouteResponses': 'apigatewayv2', 'RouteResponse': 'apigatewayv2', 'RouteSettings': 'apigatewayv2', 'Routes': 'apigatewayv2', 'Route': 'apigatewayv2'},
|
|
3202
|
+
'bedrock': {'agent-alias': 'bedrock-agent', 'agent': 'bedrock-agent', 'default-prompt-router': 'bedrock-agent', 'flow-alias': 'bedrock-agent', 'flow-execution': 'bedrock-agent', 'flow': 'bedrock-agent', 'knowledge-base': 'bedrock-agent', 'prompt-router': 'bedrock-agent', 'prompt-version': 'bedrock-agent', 'prompt': 'bedrock-agent', 'session': 'bedrock-agent-runtime', 'async-invoke': 'bedrock-runtime'},
|
|
3203
|
+
'chime': {'meeting': 'chime-sdk-meetings', 'app-instance': 'chime-sdk-identity', 'app-instance-bot': 'chime-sdk-identity', 'app-instance-user': 'chime-sdk-identity', 'channel': 'chime-sdk-messaging', 'channel-flow': 'chime-sdk-messaging', 'media-insights-pipeline-configuration': 'chime-sdk-media-pipelines', 'media-pipeline': 'chime-sdk-media-pipelines', 'media-pipeline-kinesis-video-stream-pool': 'chime-sdk-media-pipelines', 'sip-media-application': 'chime-sdk-voice', 'voice-connector-group': 'chime-sdk-voice', 'voice-connector': 'chime-sdk-voice', 'voice-profile': 'chime-sdk-voice', 'voice-profile-domain': 'chime-sdk-voice'},
|
|
3204
|
+
'dynamodb': {'stream': 'dynamodbstreams'},
|
|
3205
|
+
'elasticloadbalancing': {'loadbalancer': 'elb'},
|
|
3206
|
+
'greengrass': {'bulkDeployment': 'greengrass', 'certificateAuthority': 'greengrass', 'connectivityInfo': 'greengrass', 'connectorDefinitionVersion': 'greengrass', 'connectorDefinition': 'greengrass', 'coreDefinitionVersion': 'greengrass', 'coreDefinition': 'greengrass', 'deviceDefinitionVersion': 'greengrass', 'deviceDefinition': 'greengrass', 'functionDefinitionVersion': 'greengrass', 'functionDefinition': 'greengrass', 'groupVersion': 'greengrass', 'group': 'greengrass', 'loggerDefinitionVersion': 'greengrass', 'loggerDefinition': 'greengrass', 'resourceDefinitionVersion': 'greengrass', 'resourceDefinition': 'greengrass', 'subscriptionDefinitionVersion': 'greengrass', 'subscriptionDefinition': 'greengrass', 'thingRuntimeConfig': 'greengrass'},
|
|
3207
|
+
'ivs': {'Composition': 'ivs-realtime', 'Encoder-Configuration': 'ivs-realtime', 'Ingest-Configuration': 'ivs-realtime', 'Public-Key': 'ivs-realtime', 'Stage': 'ivs-realtime', 'Storage-Configuration': 'ivs-realtime'},
|
|
3208
|
+
'lex': {'channel': 'lex-models', 'intent version': 'lex-models', 'slottype version': 'lex-models'},
|
|
3209
|
+
'mediastore': {'folder': 'mediastore-data', 'object': 'mediastore-data'},
|
|
3210
|
+
'partnercentral': {'BenefitAllocation': 'partnercentral-benefits', 'BenefitApplication': 'partnercentral-benefits', 'Benefit': 'partnercentral-benefits', 'ChannelHandshake': 'partnercentral-channel', 'ProgramManagementAccount': 'partnercentral-account'},
|
|
3211
|
+
's3': {'accessgrant': 's3control', 'accessgrantslocation': 's3control', 'accessgrantsinstance': 's3control', 'accesspoint': 's3control', 'accesspointobject': 's3control', 'job': 's3control', 'multiregionaccesspoint': 's3control', 'multiregionaccesspointrequestarn': 's3control', 'storagelensconfiguration': 's3control', 'storagelensgroup': 's3control'},
|
|
3212
|
+
'servicecatalog': {'Application': 'servicecatalog-appregistry', 'AttributeGroup': 'servicecatalog-appregistry'},
|
|
3213
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arnmatch
|
|
3
|
-
Version: 2026.1.
|
|
3
|
+
Version: 2026.1.3
|
|
4
4
|
Summary: Parse AWS ARNs into structured data (2000+ resource types)
|
|
5
5
|
Author-email: Andrey Gubarev <andrey@andreygubarev.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -37,6 +37,7 @@ pip install arnmatch
|
|
|
37
37
|
```bash
|
|
38
38
|
$ uvx arnmatch "arn:aws:lambda:us-east-1:123456789012:function:my-function"
|
|
39
39
|
aws_service: lambda
|
|
40
|
+
aws_sdk_services: lambda
|
|
40
41
|
aws_region: us-east-1
|
|
41
42
|
aws_account: 123456789012
|
|
42
43
|
resource_type: function
|
|
@@ -52,13 +53,14 @@ from arnmatch import arnmatch
|
|
|
52
53
|
arn = "arn:aws:lambda:us-east-1:123456789012:function:my-function"
|
|
53
54
|
result = arnmatch(arn)
|
|
54
55
|
|
|
55
|
-
print(result.aws_service)
|
|
56
|
-
print(result.
|
|
57
|
-
print(result.
|
|
58
|
-
print(result.
|
|
59
|
-
print(result.
|
|
60
|
-
print(result.
|
|
61
|
-
print(result.
|
|
56
|
+
print(result.aws_service) # lambda
|
|
57
|
+
print(result.aws_sdk_services) # ['lambda']
|
|
58
|
+
print(result.aws_region) # us-east-1
|
|
59
|
+
print(result.aws_account) # 123456789012
|
|
60
|
+
print(result.resource_type) # function
|
|
61
|
+
print(result.resource_id) # my-function
|
|
62
|
+
print(result.resource_name) # my-function
|
|
63
|
+
print(result.attributes) # {'Partition': 'aws', 'Region': 'us-east-1', ...}
|
|
62
64
|
```
|
|
63
65
|
|
|
64
66
|
## API Reference
|
|
@@ -89,6 +91,7 @@ Properties:
|
|
|
89
91
|
|----------|-------------|
|
|
90
92
|
| `resource_id` | Resource identifier (prefers groups ending in `Id`, falls back to `Name`, then last group) |
|
|
91
93
|
| `resource_name` | Resource name (prefers groups ending in `Name`, falls back to `resource_id`) |
|
|
94
|
+
| `aws_sdk_services` | List of boto3 client names for this service (e.g., `['elb', 'elbv2']` for elasticloadbalancing) |
|
|
92
95
|
|
|
93
96
|
### `ARNError`
|
|
94
97
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
arnmatch/__init__.py,sha256=2Kb8BACVV7b3EGo1echNkDU5E3SKbalm4HdWjECmlro,5377
|
|
2
|
+
arnmatch/arn_patterns.py,sha256=qZyt_cZTM_BGkOUqXuz0gZg6pOr78V_D5a6PyEJ7OVo,370032
|
|
3
|
+
arnmatch-2026.1.3.dist-info/METADATA,sha256=-G-_ARLkNqsu4ldi1NkVfSnTB9vEFGrwiz-l63PAVrw,3353
|
|
4
|
+
arnmatch-2026.1.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
5
|
+
arnmatch-2026.1.3.dist-info/entry_points.txt,sha256=k4tR_yh3Rodi-BfwVhc_6TktgYhE7BfMy6s0Zzq6EFk,43
|
|
6
|
+
arnmatch-2026.1.3.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
arnmatch/__init__.py,sha256=j33qDq8OmmAe8OWjsDUXNF3uYGDcDYbTfdUQ-aIey6I,4406
|
|
2
|
-
arnmatch/arn_patterns.py,sha256=-vBbH31MbM_0XVQSc0Aq4LY3R1rfTSq1-720GfIsahA,365211
|
|
3
|
-
arnmatch-2026.1.1.dist-info/METADATA,sha256=KY9Bw7gbH2k3Y4cczgWzYLrlcH4s0O287HXwUuzRzEo,3149
|
|
4
|
-
arnmatch-2026.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
5
|
-
arnmatch-2026.1.1.dist-info/entry_points.txt,sha256=k4tR_yh3Rodi-BfwVhc_6TktgYhE7BfMy6s0Zzq6EFk,43
|
|
6
|
-
arnmatch-2026.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|