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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file coveo-arnparse-1.0.1.tar.gz.

File metadata

  • Download URL: coveo-arnparse-1.0.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.12 Linux/5.13.0-1022-azure

File hashes

Hashes for coveo-arnparse-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5968cfd3c0d19bffde79df51200e5b18978b0648793c125dddc50ac748ebe09c
MD5 c96898c28c6600ff03be90eb40ba70e3
BLAKE2b-256 74c7b2c0882e48c98e07c51d53ae3e565847ea62aa4a74d068f08cd639ccb25c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coveo_arnparse-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.12 Linux/5.13.0-1022-azure

File hashes

Hashes for coveo_arnparse-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 edebea7283cda50c9c5f81cbf985c2a2e281aa71a421717f966f0bef6578854a
MD5 e98b09d3744e13587aa7f10244739452
BLAKE2b-256 64f9663e6ad89862760f452196a3acb974e651681ff2dd800472f8065f5e1a0e

See more details on using hashes here.

Supported by

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