Skip to main content

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


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.12.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

coveo_arnparse-1.0.12-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file coveo_arnparse-1.0.12.tar.gz.

File metadata

  • Download URL: coveo_arnparse-1.0.12.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-1058-azure

File hashes

Hashes for coveo_arnparse-1.0.12.tar.gz
Algorithm Hash digest
SHA256 0358dba9e2e6539762f531da3f0e3b6a04b1fef28d1e8f67ea7a30e2166c5409
MD5 214307c25c7886c11bf84cd3acc0f1f2
BLAKE2b-256 aabbecaabf823f73082c1a52b205b4c4345bdad0d3eaba1de21a30b148998992

See more details on using hashes here.

File details

Details for the file coveo_arnparse-1.0.12-py3-none-any.whl.

File metadata

  • Download URL: coveo_arnparse-1.0.12-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-1058-azure

File hashes

Hashes for coveo_arnparse-1.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 0746f517441db40680b7e8813dd3f62c4c7dd141e9060b5704532942a34d35b8
MD5 74faaad48a3ba6e46b64632d71a07196
BLAKE2b-256 0146b9b8d0ea8b8dc7dc67994312074cfd880b10c6ab2a0217d206be8ba06468

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page