The api/catalog.go Register function does not support acl tokens.
The CatalogRegistration struct should likely have a WriteRequest field.
Hi @DDuTCH take a look at the WriteOptions parameter to Register() - you can use that to pass a token:
https://github.com/hashicorp/consul/blob/master/api/api.go#L63-L65
I did. But that doesn't work for the catalog. The rest Api documentation only mentions passing a write request object in there body, no parameter.
The write options object in Go gets translated to a URL parameter instead of Body.
Link to the API doc. https://www.consul.io/docs/agent/http/catalog.html#catalog_register
There is either a bug in the Go api, or in the rest api endpoint.
Ah sorry about that. I'm thinking it is probably cleaner to teach the REST endpoint about the ?token= parameter to make it more inline with others than to add support for the WriteRequest on the API side.
This has been fixed in the register endpoint - https://github.com/hashicorp/consul/issues/1738.