Files
oam/knowledge base/jmespath.md
2025-01-28 23:21:50 +01:00

1.5 KiB

JMESPath

Table of contents

  1. TL;DR
  2. Further readings
    1. Sources

TL;DR

# Filter elements in a list.
az devops user list --org 'https://dev.azure.com/organizationName' \
  --query "
    items[?
      startsWith(user.principalName, 'yourNameHere') &&
      \! contains(accessLevel.licenseDisplayName, 'Test plans')
    ].user.displayName
  "
aws … --query "locations[?name.contains(@, `le`)]"
aws … --query "locations[?name.contains(@, `ue`) || name.contains(@, `ia`)]"

#
aws ecs describe-tasks --cluster 'staging' --tasks 'ef6260ed8aab49cf926667ab0c52c313' --output 'yaml' \
  --query 'tasks[0] | {
      "managedAgents": containers[].managedAgents[?@.name==`ExecuteCommandAgent`][],
      "enableExecuteCommand": enableExecuteCommand
    }'

# Print an object with specific keys and values from the input.
az disk-encryption-set show --ids 'id' \
  --query "{
    \"keyId\": activeKey.keyUrl,
    \"accessPolicyId\": join('/', [activeKey.sourceVault.id, 'objectId', identity.principalId])
  }"

Further readings

Sources