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

Add explicit ForbiddenException to IoT HTTP API Response #4870

Closed
1 of 2 tasks
anttang8 opened this issue Jan 31, 2024 · 3 comments
Closed
1 of 2 tasks

Add explicit ForbiddenException to IoT HTTP API Response #4870

anttang8 opened this issue Jan 31, 2024 · 3 comments
Assignees
Labels
feature-request A feature should be added or improved. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@anttang8
Copy link

Describe the feature

Currently, AWS SDK does not throw a Forbidden Exception when a 403 is returned from IoT HTTP calls, but rather, a generic AWSIotDataException is returned with the status code of 403.

The behavior could be better to inform the customer exact exception like there is for the other non-success codes. For instance, in https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iotdata/AWSIotDataClient.java, there are a number of exceptions that can be thrown (for instance, ServiceUnavailableException) -- all of these derive from:

https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/iotdata/model/AWSIotDataException.html

And none of them are ForbiddenException.

Use Case

To have a more accurate and obvious exception thrown for forbidden cases.

Proposed Solution

Throw a forbidden exception (maybe ForbiddenException), not a generic AWSIotDataException when HTTP paths return a 403.

Other Information

The breaking change detailed below is if the ForbiddenException isn't derived from AWSIotDataException -- might break devices which has specific logic around AWSIotDataException. If ForbiddenException is derived from AWSIotDataException, this shouldn't be an issue.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

Latest has this code

JDK version used

N/A

Operating System and version

N/A

@anttang8 anttang8 added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 31, 2024
@debora-ito
Copy link
Member

@anttang8

For the Java SDK to throw a specific exception type, that exception needs to be modeled and associated with the operation.

If the SDK can't map the exception received to any of the modeled exception types, it will fall back to the base generic service exception.

The IotDataPlane service team will need to add the Forbidden Exception to their model, because it's not listed currently -
https://github.com/aws/aws-sdk-java-v2/blob/master/services/iotdataplane/src/main/resources/codegen-resources/service-2.json

I can reach out internally to the IotData team and ask to update their model. Which IotDataPlane APIs are returning ForbiddenException?

@debora-ito debora-ito added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. service-api This issue is due to a problem in a service API, not the SDK implementation. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Feb 2, 2024
@debora-ito debora-ito self-assigned this Feb 2, 2024
@debora-ito
Copy link
Member

Closing this, as @anttang8 will work internally to make the update.

Copy link

github-actions bot commented Feb 7, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants