Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Add support for Anomaly endpoints #214

Merged
merged 3 commits into from
May 12, 2021
Merged

Conversation

Widcket
Copy link
Contributor

@Widcket Widcket commented May 11, 2021

Proposed Changes

This PR adds support for the two Anomaly endpoints:

The GET endpoint, unlike the other API2 endpoints, takes no data in the request body and returns no data in the response body (except in the case of error). The only input is an IP address passed as part of the path, and the outcome of the operation is signaled by status codes.
A status code of 200 means that the IP is blocked, and a status code of 404 means that it is not blocked.
The current request-making logic does not expose the status code, and returning the error does not make sense as a 404 will end up as an error, when it's a non-error output. So instead of calling m.Request directly, the implementation of CheckIP adapts the code of m.Request to work around these peculiarities.

The DELETE endpoint does not return data in the response body either (except in the case of error), but it does not use an error status code for a non-error output. So UnblockIP just calls m.Request directly.

Acceptance Test Output

This was tested manually by calling a command on a modified Auth0 CLI.

Screen Shot 2021-05-10 at 20 52 32

Screen Shot 2021-05-10 at 21 04 48

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Copy link
Collaborator

@cyx cyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@Widcket
Copy link
Contributor Author

Widcket commented May 12, 2021

@cyx thanks for the review. Can you please merge it? I don't have permissions.

Copy link

@paddycarey paddycarey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cyx cyx merged commit 8ddbd9d into go-auth0:master May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants