Allow retrieving agent in REST API with agent name instead of agent id
Problem
The numerical agent ID is hard to remember and not what the user usually interacts with - that is, the user creates an agent by name, thus it would be great if they can retrieve it by name later using the REST API.
Status quo
The REST API to retrieve a cluster agent follows the following resource path schema:
METHOD /projects/:id/cluster_agents/:agent_id
The :agent_id
path segment must always be a numerical agent ID and agent names are not allowed.
Solution
Change the REST API resource path schema in a backwards compatible way that allows for numerical ID and agent name filtering:
METHOD /projects/:id/cluster_agents/:agent
Therefore, :agent
may be the numerical ID or the name of the desired agent.
Implementation Details
With my limited Ruby knowledge, I'd say that this is already somewhat supported by the AgentsFinder
- but must be refactored together with how it is used in the API.