node-consul icon indicating copy to clipboard operation
node-consul copied to clipboard

Add /acl/policy.. + /acl/token.. endpoints support into ACL library

Open happy-code-com opened this issue 2 years ago • 4 comments

happy-code-com avatar Mar 17 '23 00:03 happy-code-com

I took a first stab at writing some tests for this PR (and fixed various issues they uncovered), you can merge them from consul-acls branch if you want.

You should run npm test locally to ensure tests pass.

silas avatar Mar 18 '23 20:03 silas

In addition to getting npm test to pass, I generally like to manually test each call against a real server and add new methods to README docs. I can do the last two steps if you get the test passing.

silas avatar Mar 18 '23 20:03 silas

Thank you very much! I'll add a description to the Readme and deal with the tests. I will also add the processing of additional keys from the documentation and try to test it on a live server.

I wanted to ask right away, if you are aware, do I understand correctly that in aсl.legacy there is now an older format for communicating with the API for managing tokens and rules? What I suggested in the PR will be relevant, in terms of the description in the Consul documentation?

To be honest, I'm a little confused about the documentation and changes between versions.

happy-code-com avatar Mar 18 '23 21:03 happy-code-com

Yes, there is a legacy ACL policies and tokens API, which you can see here: https://developer.hashicorp.com/consul/api-docs/v1.14.x/acl/legacy.

It looks like it's not documented in v1.15 anymore and it looks like they removed it in 1.11.0. I figure we should keep the legacy methods around until the versions of consul that include it are no longer supported, which I assume could be a while.

In regards to the API we can just refer to the endpoints you implemented as the standard versions and we don't need to add any type of modifier when documenting them (e.g. we don't need to say new Token API or anything like that).

Also, when documenting/implementing the API endpoints I liberally copy/paste from https://developer.hashicorp.com/consul/api-docs (the NOTICE includes appropriate attribution/license for using that text).

silas avatar Mar 19 '23 15:03 silas