Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow users to provide device's managed object id instead of the external identity #186

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

reubenmiller
Copy link
Contributor

Allowing user's to provide the managed object id allows better integration with other tooling (e.g. go-c8y-cli). This allows other tooling to perform custom lookups to retrieve the managed object id and just pass that to c8ylp when it it started.

The new managed object id/external identity logic is as follows:

If the given input is numeric (only digits), then try looking up if it corresponds to a managed object id. If successful, then use the managed object result, otherwise try treat the input as an external identity. If the input is not numeric, then assume the input is an external identity (same behaviour as before).

Below shows an example that should now work:

c8ylp connect ssh 12345 --ssh-user linuxuser

…ternal identity

Allowing user's to provide the managed object id allows better integration with other tooling (e.g. go-c8y-cli).
This allows other tooling to perform custom lookups to retrieve the managed object id and just pass that to c8ylp when it it started.
@reubenmiller reubenmiller marked this pull request as ready for review May 7, 2024 08:50
@switschel
Copy link
Collaborator

switschel commented May 15, 2024

Just a small clarification question: I saw in the code that it will first try to retrieve the MO and if non existing try to retrieve it via external ID. So even when the external ID is numeric only e.g. 12345 this case should work, correct?

@reubenmiller
Copy link
Contributor Author

Just a small clarification question: I saw in the code that it will first try to retrieve the MO and if non existing try to retrieve it via external ID. So even when the external ID is numeric only e.g. 12345 this case should work, correct?

Yes that will also work, though the client do one extra request (as it will think the given value is a managed object id get a 404 back which is ignored)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants