arnmatch 2026.2.1__py3-none-any.whl → 2026.2.2__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 +23 -1
- {arnmatch-2026.2.1.dist-info → arnmatch-2026.2.2.dist-info}/METADATA +11 -1
- arnmatch-2026.2.2.dist-info/RECORD +7 -0
- arnmatch-2026.2.1.dist-info/RECORD +0 -7
- {arnmatch-2026.2.1.dist-info → arnmatch-2026.2.2.dist-info}/WHEEL +0 -0
- {arnmatch-2026.2.1.dist-info → arnmatch-2026.2.2.dist-info}/entry_points.txt +0 -0
- {arnmatch-2026.2.1.dist-info → arnmatch-2026.2.2.dist-info}/licenses/LICENSE +0 -0
arnmatch/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""ARN pattern matching using regex patterns."""
|
|
2
2
|
|
|
3
|
-
__version__ = "2026.2.
|
|
3
|
+
__version__ = "2026.2.2"
|
|
4
4
|
|
|
5
5
|
import sys
|
|
6
6
|
from dataclasses import dataclass
|
|
@@ -90,6 +90,28 @@ class ARN:
|
|
|
90
90
|
"""
|
|
91
91
|
return AWS_SDK_SERVICES.get(self.aws_service, [])
|
|
92
92
|
|
|
93
|
+
def client(self, session: "boto3.Session | None" = None): # noqa: F821
|
|
94
|
+
"""Return a boto3 client for this resource's service.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
session: Optional boto3 Session. If None, creates a new session.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
boto3 client for the service.
|
|
101
|
+
|
|
102
|
+
Raises:
|
|
103
|
+
ValueError: If no SDK service mapping exists for this ARN's service.
|
|
104
|
+
"""
|
|
105
|
+
if self.aws_sdk_service is None:
|
|
106
|
+
raise ValueError(f"No SDK service mapping for service '{self.aws_service}'")
|
|
107
|
+
|
|
108
|
+
import boto3
|
|
109
|
+
|
|
110
|
+
if session is None:
|
|
111
|
+
session = boto3.Session()
|
|
112
|
+
|
|
113
|
+
return session.client(self.aws_sdk_service)
|
|
114
|
+
|
|
93
115
|
|
|
94
116
|
def arnmatch(arn: str) -> ARN:
|
|
95
117
|
"""Match ARN against patterns.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arnmatch
|
|
3
|
-
Version: 2026.2.
|
|
3
|
+
Version: 2026.2.2
|
|
4
4
|
Summary: Parse AWS ARNs into structured data (2000+ resource types)
|
|
5
5
|
Author-email: Andrey Gubarev <andrey@andreygubarev.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -78,6 +78,10 @@ result.resource_id # "my-function"
|
|
|
78
78
|
result.resource_name # "my-function"
|
|
79
79
|
result.cloudformation_resource # "AWS::Lambda::Function"
|
|
80
80
|
result.aws_sdk_service # "lambda"
|
|
81
|
+
|
|
82
|
+
# Get a boto3 client for the service
|
|
83
|
+
client = result.client()
|
|
84
|
+
client.get_function(FunctionName=result.resource_name)
|
|
81
85
|
```
|
|
82
86
|
|
|
83
87
|
## API Reference
|
|
@@ -112,6 +116,12 @@ Properties:
|
|
|
112
116
|
| `resource_name` | Resource name (prefers attributes ending in `Name`, falls back to `resource_id`) |
|
|
113
117
|
| `aws_sdk_services` | List of boto3 client names (e.g., `['elb', 'elbv2']` for elasticloadbalancing) |
|
|
114
118
|
|
|
119
|
+
Methods:
|
|
120
|
+
|
|
121
|
+
| Method | Description |
|
|
122
|
+
|--------|-------------|
|
|
123
|
+
| `client(session=None)` | Returns a boto3 client for the resource's service. Pass an optional `boto3.Session` or uses default. Raises `ValueError` if no SDK mapping exists. |
|
|
124
|
+
|
|
115
125
|
### `ARNError`
|
|
116
126
|
|
|
117
127
|
Exception raised when ARN parsing fails. Inherits from `ValueError`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
arnmatch/__init__.py,sha256=70cwrhbh49fzouvIdDyMzXPN4M5JiMm6Y2DRhMWmQ4c,5502
|
|
2
|
+
arnmatch/arn_patterns.py,sha256=cPdXXV2ma3C5OjULLj-n35OkZMotNPBYKmBkSBNh9ZM,515238
|
|
3
|
+
arnmatch-2026.2.2.dist-info/METADATA,sha256=0uZzI1_r2TfqvPqujHfTRsnkcyUa0SAeYaPMQ-Doc_U,4709
|
|
4
|
+
arnmatch-2026.2.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
5
|
+
arnmatch-2026.2.2.dist-info/entry_points.txt,sha256=k4tR_yh3Rodi-BfwVhc_6TktgYhE7BfMy6s0Zzq6EFk,43
|
|
6
|
+
arnmatch-2026.2.2.dist-info/licenses/LICENSE,sha256=yaQvdAwp_8m38IzGH2b78UxfHSd1GkLrxLhbu_YqDcg,9267
|
|
7
|
+
arnmatch-2026.2.2.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
arnmatch/__init__.py,sha256=aE28ZxEr62CrnJpZz9ievkif6yiRxaPl78ZI9F-BMBA,4829
|
|
2
|
-
arnmatch/arn_patterns.py,sha256=cPdXXV2ma3C5OjULLj-n35OkZMotNPBYKmBkSBNh9ZM,515238
|
|
3
|
-
arnmatch-2026.2.1.dist-info/METADATA,sha256=UNoAMKwfHbQDQVqZ2wh70M_ap7I9ORUy9uBoemKiuCA,4354
|
|
4
|
-
arnmatch-2026.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
5
|
-
arnmatch-2026.2.1.dist-info/entry_points.txt,sha256=k4tR_yh3Rodi-BfwVhc_6TktgYhE7BfMy6s0Zzq6EFk,43
|
|
6
|
-
arnmatch-2026.2.1.dist-info/licenses/LICENSE,sha256=yaQvdAwp_8m38IzGH2b78UxfHSd1GkLrxLhbu_YqDcg,9267
|
|
7
|
-
arnmatch-2026.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|