Skip to main content

aws-jmespath-utils

Installation

pip3 install aws_jmespath_utils

Examples

Check out the example code:

Usage

Find resources with 'Name' tag set

jmespath.search(  # it's important that your expression array must be inside `` backticks
    '[] | filter_tags(`["Name=*"]`, @)', data_list, options=jmespath_options
)

Find tag values starting with 123

jmespath.search(  # it's important that your expression array must be inside `` backticks
    '[].filter_tags(`["=123*"]`, @)', data_list, options=jmespath_options
)

Find Many tag values

jmespath.search(  # it's important that your expression array must be inside `` backticks
    '[].filter_tags(`["=123*", "=jmespath*"]`, @)', data_list, options=jmespath_options
)

Exclude Tags

jmespath.search(  # it's important that your expression array must be inside `` backticks
    '[].exclude_tags(`["map-migrated=*"]`, @)', data_list, options=jmespath_options
)

Setting log levels

# set log level as you wish
export AWS_JMESPATH_UTILS_LOG_LEVEL="DEBUG"   
export AWS_JMESPATH_UTILS_LOG_LEVEL="INFO"  # default   

Complete Usage Example

import jmespath
from aws_jmespath_utils import jmespath_options
import json
data_list = [    
    {"a": "a", "Tags": [{"Key": "Name", "Value": "jmespath-utils"}, ]},
    {"b": "b", "Tags": [{"Key": "Nam", "Value": "jmespath-utils-nam"}]},
    {"c": "c", "Tags": [{"Key": "map-migrated", "Value": "234"}]}
]

print(
    json.dumps(
        jmespath.search('[] | filter_tags(`["Name=*"]`, @)', data_list, options=jmespath_options),
        indent=2
    )
)

print(
    json.dumps(
        jmespath.search('[] | exclude_tags(`["Nam*="]`, @)', data_list, options=jmespath_options),
        indent=2
    )
)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws_jmespath_utils-1.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_jmespath_utils-1.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file aws_jmespath_utils-1.1.0.tar.gz.

File metadata

  • Download URL: aws_jmespath_utils-1.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.12 Darwin/23.5.0

File hashes

Hashes for aws_jmespath_utils-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c00177824763b6fdc40260a1926102da9cb40ced1142f9398ef62a65679a618e
MD5 afa68da90a916bbe60d89e2fa48b3cfe
BLAKE2b-256 037ddfbd180e7e6dac0a73ed5418175cfb60381b0b7f2bf55f6a0bd80fc005e1

See more details on using hashes here.

File details

Details for the file aws_jmespath_utils-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: aws_jmespath_utils-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.12 Darwin/23.5.0

File hashes

Hashes for aws_jmespath_utils-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f7e5f7db352d01518433cee4715c929fff91f5f1c63dac9d0ad434ced52a221
MD5 f5aaf5d3a65d2c53c3bd2761ba054b4e
BLAKE2b-256 d8d3e8a296ae0c141112c5c9d3ad3e9f7861422d50948210dec6de79720abc7a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

1 file

Supported by

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