arnmatch 2026.1.1__tar.gz → 2026.1.2__tar.gz
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-2026.1.1 → arnmatch-2026.1.2}/CLAUDE.md +6 -4
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/PKG-INFO +11 -8
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/README.md +10 -7
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/src/arnmatch/__init__.py +2 -1
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/.github/workflows/workflow.yml +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/.gitignore +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/.python-version +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/Makefile +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/codegen/.gitignore +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/codegen/codegen.py +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/codegen/index_sdk.py +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/codegen/scraper.py +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/pyproject.toml +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/src/arnmatch/arn_patterns.py +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/tests/test_arnmatch.py +0 -0
- {arnmatch-2026.1.1 → arnmatch-2026.1.2}/uv.lock +0 -0
|
@@ -32,23 +32,25 @@ uv run arnmatch <arn>
|
|
|
32
32
|
### Core Library (`src/arnmatch/`)
|
|
33
33
|
|
|
34
34
|
- `__init__.py` - Main module with `arnmatch(arn)` function and `ARN` dataclass
|
|
35
|
-
- `arn_patterns.py` - Generated file containing compiled regex patterns indexed by service
|
|
35
|
+
- `arn_patterns.py` - Generated file containing compiled regex patterns indexed by service and AWS SDK services mapping
|
|
36
36
|
|
|
37
|
-
The `arnmatch()` function splits the ARN, looks up patterns by service, and returns an `ARN` with partition, service, region, account, resource_type, and captured groups. The `resource_id` and `resource_name` properties use heuristics (prefer groups ending in "Id" or "Name").
|
|
37
|
+
The `arnmatch()` function splits the ARN, looks up patterns by service, and returns an `ARN` with partition, service, region, account, resource_type, and captured groups. The `resource_id` and `resource_name` properties use heuristics (prefer groups ending in "Id" or "Name"). The `aws_sdk_services` property returns boto3 client names for the service.
|
|
38
38
|
|
|
39
39
|
### Code Generation (`codegen/`)
|
|
40
40
|
|
|
41
41
|
- `scraper.py` - Scrapes AWS service authorization reference pages, caches results with joblib
|
|
42
42
|
- `codegen.py` - Processes resources and generates `arn_patterns.py`
|
|
43
|
+
- `index_sdk.py` - Maps ARN service names to AWS SDK (boto3) client names
|
|
43
44
|
|
|
44
|
-
Data flow: AWS docs → `scraper.py` → raw resources → `codegen.py` → `codegen/build/arn_patterns.py` → (copied by `make build`) → `src/arnmatch/arn_patterns.py`
|
|
45
|
+
Data flow: AWS docs → `scraper.py` → raw resources → `codegen.py` + `index_sdk.py` → `codegen/build/arn_patterns.py` → (copied by `make build`) → `src/arnmatch/arn_patterns.py`
|
|
45
46
|
|
|
46
47
|
### Key Design Decisions
|
|
47
48
|
|
|
48
49
|
1. **Pattern ordering**: Patterns sorted by specificity (more literal segments first) for correct matching
|
|
49
50
|
2. **Service index**: O(1) lookup by service before pattern matching
|
|
50
51
|
3. **Overrides in codegen.py**: `PATTERN_OVERRIDES` fixes AWS docs that use wildcards instead of capture groups; `PATTERN_INCLUDES` adds patterns not in docs (EKS k8s resources, Inspector legacy)
|
|
51
|
-
4. **
|
|
52
|
+
4. **SDK service mapping**: `index_sdk.py` maps ARN service names to boto3 client names using botocore metadata (signingName/endpointPrefix), with manual overrides for edge cases and excludes for discontinued/console-only services
|
|
53
|
+
5. **Zero runtime dependencies**: Only codegen has external deps (requests, beautifulsoup4, joblib, boto3)
|
|
52
54
|
|
|
53
55
|
## Build Notes
|
|
54
56
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arnmatch
|
|
3
|
-
Version: 2026.1.
|
|
3
|
+
Version: 2026.1.2
|
|
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
|
|
|
@@ -29,6 +29,7 @@ pip install arnmatch
|
|
|
29
29
|
```bash
|
|
30
30
|
$ uvx arnmatch "arn:aws:lambda:us-east-1:123456789012:function:my-function"
|
|
31
31
|
aws_service: lambda
|
|
32
|
+
aws_sdk_services: lambda
|
|
32
33
|
aws_region: us-east-1
|
|
33
34
|
aws_account: 123456789012
|
|
34
35
|
resource_type: function
|
|
@@ -44,13 +45,14 @@ from arnmatch import arnmatch
|
|
|
44
45
|
arn = "arn:aws:lambda:us-east-1:123456789012:function:my-function"
|
|
45
46
|
result = arnmatch(arn)
|
|
46
47
|
|
|
47
|
-
print(result.aws_service)
|
|
48
|
-
print(result.
|
|
49
|
-
print(result.
|
|
50
|
-
print(result.
|
|
51
|
-
print(result.
|
|
52
|
-
print(result.
|
|
53
|
-
print(result.
|
|
48
|
+
print(result.aws_service) # lambda
|
|
49
|
+
print(result.aws_sdk_services) # ['lambda']
|
|
50
|
+
print(result.aws_region) # us-east-1
|
|
51
|
+
print(result.aws_account) # 123456789012
|
|
52
|
+
print(result.resource_type) # function
|
|
53
|
+
print(result.resource_id) # my-function
|
|
54
|
+
print(result.resource_name) # my-function
|
|
55
|
+
print(result.attributes) # {'Partition': 'aws', 'Region': 'us-east-1', ...}
|
|
54
56
|
```
|
|
55
57
|
|
|
56
58
|
## API Reference
|
|
@@ -81,6 +83,7 @@ Properties:
|
|
|
81
83
|
|----------|-------------|
|
|
82
84
|
| `resource_id` | Resource identifier (prefers groups ending in `Id`, falls back to `Name`, then last group) |
|
|
83
85
|
| `resource_name` | Resource name (prefers groups ending in `Name`, falls back to `resource_id`) |
|
|
86
|
+
| `aws_sdk_services` | List of boto3 client names for this service (e.g., `['elb', 'elbv2']` for elasticloadbalancing) |
|
|
84
87
|
|
|
85
88
|
### `ARNError`
|
|
86
89
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""ARN pattern matching using regex patterns."""
|
|
2
2
|
|
|
3
|
-
__version__ = "2026.01.
|
|
3
|
+
__version__ = "2026.01.2"
|
|
4
4
|
|
|
5
5
|
import sys
|
|
6
6
|
from dataclasses import dataclass
|
|
@@ -132,6 +132,7 @@ def main() -> None:
|
|
|
132
132
|
try:
|
|
133
133
|
result = arnmatch(arn)
|
|
134
134
|
print(f"aws_service: {result.aws_service}")
|
|
135
|
+
print(f"aws_sdk_services: {','.join(result.aws_sdk_services)}")
|
|
135
136
|
print(f"aws_region: {result.aws_region}")
|
|
136
137
|
print(f"aws_account: {result.aws_account}")
|
|
137
138
|
print(f"resource_type: {result.resource_type}")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|