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.10.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for coveo_arnparse-1.0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cfb5138bf636c82402cd04c858bad830fc6e1bebaaec134a762b6a50f84395b |
|
MD5 | a4b1e8021955f9dc3d46e08e75f82858 |
|
BLAKE2b-256 | 008acd046da18612de1e5f86a5d57d545ed6af712b5b4208443b02081e2e7af6 |