feat: allow use of server.name as server_id argument #11
feat: allow use of server.name as server_id argument #11nats merged 26 commits intobinarylane:mainfrom
Conversation
|
You currently just have to 'know' this is supported, since the displayed help for @david-pershouse not sure how best to address that, any thoughts? |
|
A simple if not a little hacky way would be to append to the help text based on if self._lookup
self.description = self.description.replace("ID", "ID or {entity['ref']}")in the presence of |
david-pershouse
left a comment
There was a problem hiding this comment.
The _context passed to create_client in the lookup operations doesn't have the correct config. If I pass --context dev on the command line, the lookup runner ignores it and hits api.binarylane.com to resolve the name, then actual requested command executes against the dev context as expected.
This reverts commit d899208.
…tructing mapped object
…er name can be used instead of ID
david-pershouse
left a comment
There was a problem hiding this comment.
Nice clean solution, confirms it fixes it here
This PR modifies parser for operations that accept an integer server_id path parameter to accept a string command-line argument. For example, if account has a server named
foo-bar.bnr.lahere are some example commands that are now valid:During parsing, if the command-line argument provided for
server_idcannot be converted to integer (i.e.int(argument)raises ValueError) then the argument is assumed to be the name of a server. Theserver listoperation is used to fetch all servers, and the result filtered to find the integer ID of the server withname == argument.If there is no such server, the parser displays an error: