I'm querying the result of an AWS call that looks kind of like this:
{
"SecretList": [
{
"ARN": "arn:aws:secretsmanager....",
"Name": "some-name",
"Description": "",
"LastChangedDate": "2021-06-03T20:43:35.059000-05:00",
"LastAccessedDate": "2021-05-31T19:00:00-05:00",
"Tags": [
{
"Key": "company-mnemonic",
"Value": "whatever"
},
{
"Key": "usage",
"Value": "something"
}
]
}
]
}
What I want is the ARN, Name and only the tag with the key "company-mnemonic". So far I've come up with 2 separate filters but I need to understand how I can combine them. Just getting ARN and Name is easy: .SecretList[] | {ARN, Name}. Querying the tags is tricky but I figured out this: .SecretList[].Tags[] | select(.Key == "company-mnemonic") | {"company-mnemonic": .Value}. Is there a way I can combine these 2 ideas into one so that I get something that looks like this:
{
"ARN": "arn:aws:secretsmanager....",
"Name": "some-name",
"company-mnemonic": "whatever"
}