-
Notifications
You must be signed in to change notification settings - Fork 67
feat(compute): add support for acls in compute #1388
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
feat(compute): add support for acls in compute #1388
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks exactly like I expected, great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I built a version of the CLI from your branch, and ran the following commands:
-
$ ./fastly compute acl lookup --acl-id=6nbj10rEjAf63NaxmBJhmW --ip 1.2.3.4 Prefix: 1.2.3.4/32
Here, the formatting doesn't seem right, and it's missing the
Action
. I believe the issue is that the PrefixWriter being used needs to be flushed. Looks like this may be happening in other cases of PrefixWriter as well. -
$ ./fastly compute acl lookup --acl-id=6nbj10rEjAf63NaxmBJhmW --ip 2.2.3.4 --json ERROR: failed to decode json response: EOF. If you believe this error is the result of a bug, please file an issue: https://github.com/fastly/cli/issues/new?labels=bug&template=bug_report.md
I don't think this should be output as an error. It's expected that the API return a
204 No Content
in the case where there's no matches to a lookup.
They have fixed this in fastly/go-fastly#595 |
@awilliams-fastly thanks for reviewing and pointing out the issue with the The plan is to cut a new |
Confirmed, and the unit tests did not catch this because they use the same formatting functions as the code-under-test uses. I've left a comment asking for that to be changed, as the tests should not make use of internal functionality of the code being tested. |
Thanks for catching me up on those discussions, and sorry that I didn't see them earlier. I built a version of the CLI using this branch + the updated $ ./fastly compute acl lookup --acl-id=6nbj10rEjAf63NaxmBJhmW --ip 2.2.3.4 --json
ERROR: 204 - No Content.
If you believe this error is the result of a bug, please file an issue: https://github.com/fastly/cli/issues/new?labels=bug&template=bug_report.md I believe the I think there's a way to address this by having I've described one way to do this in a comment on the |
@awilliams-fastly thanks for the review!
Addressed in 4ab0ab1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor changes, otherwise this looks really good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those changes.
I re-ran my tests from previously:
./fastly compute acl lookup --acl-id=6nbj10rEjAf63NaxmBJhmW --ip 1.2.3.4
Prefix: 1.2.3.4/32
Action: ALLOW
./fastly compute acl lookup --acl-id=6nbj10rEjAf63NaxmBJhmW --ip 2.2.3.4
INFO: Compute ACL (6nbj10rEjAf63NaxmBJhmW) has no entry with IP (2.2.3.4)
I'm not sure if there's meant to be an extra newline before the Prefix line? Otherwise, looks good to me.
74ac0d5
I took it from here: Line 19 in 40aee81
Therefore, I removed it in 74ac0d5. |
The compute ACL docs can be found here.
Commands:
All Submissions:
New Feature Submissions: