# 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
```python
>>> 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:
```python
>>> 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
```python
>>> 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')
```
Raw data
{
"_id": null,
"home_page": "https://github.com/coveooss/coveo-python-oss/tree/main/coveo-arnparse",
"name": "coveo-arnparse",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Jonathan Pich\u00e9",
"author_email": "tools@coveo.com",
"download_url": "https://files.pythonhosted.org/packages/aa/bb/ecaabf823f73082c1a52b205b4c4345bdad0d3eaba1de21a30b148998992/coveo_arnparse-1.0.12.tar.gz",
"platform": null,
"description": "# coveo-arnparse\n\nSimple dataclass and parser around Amazon Resource Names (ARNs).\n\nRef: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html\n\n## Usage\n\n### Parse from a string\n```python\n>>> from coveo_arnparse import arnparse\n>>> arn = arnparse(\"arn:aws:sns:us-east-1:123456789012:my_topic\")\n>>> repr(arn)\nArn(partition='aws', service='sns', region='us-east-1', account='123456789012', resource='my_topic')\n>>> str(arn)\n\"arn:aws:sns:us-east-1:123456789012:my_topic\"\n>>> arn.resource_type\n''\n>>> arn.resource_id\n''\n```\n\nWhen a `:` or a `/` is in the resource, you can also obtain either parts:\n\n```python\n>>> from coveo_arnparse import arnparse\n>>> arn = arnparse(\"arn:aws:ssm:us-east-1:123456789012:parameter/path/key\")\n>>> arn.resource_type\n'parameter'\n>>> arn.resource_id\n'path/key'\n>>> arn.resource\n'parameter/path/key'\n```\n\n\n### Create an instance directly\n\n```python\n>>> from coveo_arnparse import Arn\n>>> Arn(service=\"s3\", resource=\"my_bucket/path/file.jpg\")\nArn(partition='aws', service='s3', region='', account='', resource='my_bucket/path/file.jpg')\n```\n ",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Parse an arn in multiple components.",
"version": "1.0.12",
"project_urls": {
"Homepage": "https://github.com/coveooss/coveo-python-oss/tree/main/coveo-arnparse",
"Repository": "https://github.com/coveooss/coveo-python-oss/tree/main/coveo-arnparse"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0146b9b8d0ea8b8dc7dc67994312074cfd880b10c6ab2a0217d206be8ba06468",
"md5": "74faaad48a3ba6e46b64632d71a07196",
"sha256": "0746f517441db40680b7e8813dd3f62c4c7dd141e9060b5704532942a34d35b8"
},
"downloads": -1,
"filename": "coveo_arnparse-1.0.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "74faaad48a3ba6e46b64632d71a07196",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 2811,
"upload_time": "2024-03-24T12:46:12",
"upload_time_iso_8601": "2024-03-24T12:46:12.298597Z",
"url": "https://files.pythonhosted.org/packages/01/46/b9b8d0ea8b8dc7dc67994312074cfd880b10c6ab2a0217d206be8ba06468/coveo_arnparse-1.0.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aabbecaabf823f73082c1a52b205b4c4345bdad0d3eaba1de21a30b148998992",
"md5": "214307c25c7886c11bf84cd3acc0f1f2",
"sha256": "0358dba9e2e6539762f531da3f0e3b6a04b1fef28d1e8f67ea7a30e2166c5409"
},
"downloads": -1,
"filename": "coveo_arnparse-1.0.12.tar.gz",
"has_sig": false,
"md5_digest": "214307c25c7886c11bf84cd3acc0f1f2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 2356,
"upload_time": "2024-03-24T12:46:14",
"upload_time_iso_8601": "2024-03-24T12:46:14.275820Z",
"url": "https://files.pythonhosted.org/packages/aa/bb/ecaabf823f73082c1a52b205b4c4345bdad0d3eaba1de21a30b148998992/coveo_arnparse-1.0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-24 12:46:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "coveooss",
"github_project": "coveo-python-oss",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "coveo-arnparse"
}