aws / aws/aws-cli

`--query` does not work properly for iot device shadow

Open
#7,679 4 comments 0 reactions 0 assignees View on GitHub
feature-request iot p3
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### Describe the bug

I have a following device shadow for thing `8277faad` :

```
{
"state": {
"desired": {
"welcome": "aws-iot"
},
"reported": {
"welcome": "aws-iot"
}
},
"metadata": {
"desired": {
"welcome": {
"timestamp": 1676682183
}
},
"reported": {
"welcome": {
"timestamp": 1676682183
}
}
},
"version": 1,
"timestamp": 1676684517
}
```

I run ` aws iot-data get-thing-shadow --thing-name 8277faad --query "state" out.json` but the filter does not work.

### Expected Behavior

The expected return is following contents in the out.json file

```
{
"desired": {
"welcome": "aws-iot"
},
"reported": {
"welcome": "aws-iot"
}
}
```

### Current Behavior

The command returns `null`

```
aws iot-data get-thing-shadow --thing-name 8277faad --query "state" out.json
null
```

out.json is not filtered by the query. The out.json is:

```
{
"state": {
"desired": {
"welcome": "aws-iot"
},
"reported": {
"welcome": "aws-iot"
}
},
"metadata": {
"desired": {
"welcome": {
"timestamp": 1676682183
}
},
"reported": {
"welcome": {
"timestamp": 1676682183
}
}
},
"version": 1,
"timestamp": 1676685039
}
```

### Reproduction Steps

1. Create a shadow with the above contents.
2. Run the aws command with query.

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CLI version used

aws-cli/2.10.1 Python/3.9.11 Darwin/21.6.0 exe/x86_64 prompt/off

### Environment details (OS name and version, etc.)

Mac

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.