openziti / edge

Application-embedded connectivity and zero-trust components
Apache License 2.0
75 stars 19 forks source link

lookup router via id or name #76

Closed dovholuknf closed 4 years ago

dovholuknf commented 4 years ago

right now the router id must be used when creating services. it'd be more friendly to use the provided input as an id first and if not found by id then to look up a router with the same name. if only one router matches use the id of the provided router and log output stating that it was found by name not id

smilindave26 commented 4 years ago

Clint - in my experience, APIs that "guess" at what the user intended often do more harm than good. I think its better to just require the id and leave it at that.

dovholuknf commented 4 years ago

Generally speaking I agree with your point of view but it makes using the ziti cli "manually" a pain. We also already have this pattern in place for other entities - we could remove the functionality from the other locations too but in my opinion it really is easier on the user if it works this way. it's also not guessing about the name as much as falling back to using the name if the id isn't matched.

@plorenz FYI

plorenz commented 4 years ago

Clint - in my experience, APIs that "guess" at what the user intended often do more harm than good. I think its better to just require the id and leave it at that.

@smilindave26 We do this in lots of other places, when referencing services and identities. I don't see the problem doing this for edge routers as well, especially since the router ids are UUIDs. Router names may be UUIDs or may be whatever else, but either way, the only way there would be a collision between a router id and name is if someone did it intentionally.

If you feel strongly about it, we don't have to do it, but then we should probably considered stripping it out everywhere else

smilindave26 commented 4 years ago

No, don't strip it out and go ahead and stay consistent here...