Parse an arn in multiple components.
Project description
coveo-arnparse
Simple dataclass and parser around Amazon Resource Names (ARNs).
Ref: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
Usage
Parse from a string
>>> from coveo_arnparse import arnparse
>>> arn = arnparse("arn:aws:sns:us-east-1:123456789012:my_topic")
>>> repr(arn)
Arn(partition='aws', service='sns', region='us-east-1', account='123456789012', resource='my_topic')
>>> str(arn)
"arn:aws:sns:us-east-1:123456789012:my_topic"
>>> arn.resource_type
''
>>> arn.resource_id
''
When a :
or a /
is in the resource, you can also obtain either parts:
>>> from coveo_arnparse import arnparse
>>> arn = arnparse("arn:aws:ssm:us-east-1:123456789012:parameter/path/key")
>>> arn.resource_type
'parameter'
>>> arn.resource_id
'path/key'
>>> arn.resource
'parameter/path/key'
Create an instance directly
>>> from coveo_arnparse import Arn
>>> Arn(service="s3", resource="my_bucket/path/file.jpg")
Arn(partition='aws', service='s3', region='', account='', resource='my_bucket/path/file.jpg')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
coveo_arnparse-1.0.11.tar.gz
(2.4 kB
view details)
Built Distribution
File details
Details for the file coveo_arnparse-1.0.11.tar.gz
.
File metadata
- Download URL: coveo_arnparse-1.0.11.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.18 Linux/5.15.0-1053-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e2179092f357305ec77ab2c31bde0cc8219c8a4aa1337e2cb15d0507c05b061 |
|
MD5 | deeafe1be8b38ced5bec06e3672efedc |
|
BLAKE2b-256 | 98731206ccedb74a8cbb1b5666abfc5aecfa27d87bb7071ad8e1442d130f5565 |
File details
Details for the file coveo_arnparse-1.0.11-py3-none-any.whl
.
File metadata
- Download URL: coveo_arnparse-1.0.11-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.18 Linux/5.15.0-1053-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12da53ec83102bbf3edf6bb85f18c6fa778f436d1fc56f962afbedd9b965f5f0 |
|
MD5 | 76a5a29ad1fca879cfa3c19fe7799fdb |
|
BLAKE2b-256 | 5f7f49386579f1f99dcb309bb42df454fd37f378736302681b654d8f96aba088 |