Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_thing_shadow appears to discard the shadow name #672

Open
Octogonapus opened this issue Apr 23, 2024 · 4 comments
Open

get_thing_shadow appears to discard the shadow name #672

Octogonapus opened this issue Apr 23, 2024 · 4 comments

Comments

@Octogonapus
Copy link
Contributor

Octogonapus commented Apr 23, 2024

My code:

@service IOT_Data_Plane
IOT_Data_Plane.get_thing_shadow("thingName", Dict("name" => "shadowName"))

Throws this error:

HTTP.Exceptions.StatusError(404, "GET", "/things/thingName/shadow", ...

According to the AWS documentation and the AWS.jl documentation the ?name=shadowName parameter should be included, but is not as we can see in that HTTP error.

AWS.jl v1.90.4

I can work on fixing this but I am not sure where to look in the parameter handling code.

@ericphanson
Copy link
Member

I believe it is here that the request is built:

function (service::RestJSONService)(
. For a json service I think all the args are passed in the body as opposed to as a queryparam.

IIUC AWS.jl autogenerates the definitions from XML files so maybe we need to add support for some JSON services having some arguments as query parameters.

maybe @mattBrzezinski could say more

@mattBrzezinski
Copy link
Member

We generate based off of aws-sdk-js JSON definitions, here's where we look at the GetThingShadowRequest, it looks like this does specify the queryparam so it should be going into the correct position?

To quickly unblock yourself, I think you could do something like...

function getShadowThing(thingName, shadowName; awsConfig=global_aws_config())
  return AWS.iot_data_plane("GET", "things/${thingName}/shadow?name=${shadowName}"; aws_config=aws_config)
end

Basically just write the "low-level" request yourself and send that over

@ericphanson
Copy link
Member

ericphanson commented Apr 23, 2024

That's a helpful pointer. What I'm getting at though is we don't have querystring location in the generation code, AFIACT. E.g. if I search for querystring I don't find anything, location just finds these two:

required_params = filter(p -> (p[2]["location"] != "uri"), required_params)
header_params = filter(p -> (p[2]["location"] == "header"), required_params)

So I think the generation code has be updated to handle the querystring location, as well as the RestJSONService code to actually use it.

Does that seem accurate?

@mattBrzezinski
Copy link
Member

That's a helpful pointer. What I'm getting at though is we don't have querystring location in the generation code, AFIACT. E.g. if I search for querystring I don't find anything, location just finds these two:

required_params = filter(p -> (p[2]["location"] != "uri"), required_params)
header_params = filter(p -> (p[2]["location"] == "header"), required_params)

So I think the generation code has be updated to handle the querystring location, as well as the RestJSONService code to actually use it.

Does that seem accurate?

Aha! I thought we already had this, but I guess not. This is how we would fix it in that case, do a similar filter() call on locations for querystring and do something like,

querystring_params = "?" * join(params, "&")

And append that to the URL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants