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

Allow changing endpoint per user in the live chat #122

Open
chadell opened this issue Feb 1, 2022 · 7 comments
Open

Allow changing endpoint per user in the live chat #122

chadell opened this issue Feb 1, 2022 · 7 comments
Milestone

Comments

@chadell
Copy link
Contributor

chadell commented Feb 1, 2022

Proposed Functionality

Today, most of the chatops plugins define a custom endpoint in its configuration with some custom authentication configuration.

The idea would be that instead of solving only the multi-instance for one specific chatops, we could extend this nautobot_chatops configuration to support a new (optional) endpoints (or similar) key with a list of multiple endpoints (with a reference name), so the user would be able to switch between them in execution time using his own session.

For example:

PLUGINS_CONFIG = {
    "nautobot_chatops": {
        "endpoints": [
        	{
        		"name": "endpoint 1",
                "url": "...",
        		"token": "...",
        		"verify_ssl": true
        	},
        	{
        		"name": "endpoint 2",
        		"url": "...",
        		"user": "...",
        		"password": "...",
    			"verify_ssl": false
        	},

        ]

This change obviously doesn’t affect the previous chatops (it’s backwards compatible), so from the custom chatops plugins we can choose to use these new endpoints that will exposed via a wrapper on the current sessions methods, not on the specific chatops which will only focus on using the new methods to retrieve the URL and the proper authentication.

This feature will expose two methods: get_endpoint and set_endpoint, that will leverage on the user's session, to save the "active" endpoint.

Use Case

As a user of a Chatops integration, I would like to easily change from one endpoint to another, affecting only this specific user context.

So, having several endpoints defined, a user can jump from one to another, so all the commands executed will refer to the "active" endpoint:

> /ipfabric get-endpoint

> your current endpoint is endpoint_1

> /ipfabric set-endpoint endpoint_2

> /ipfabric get-endpoint

> your current endpoint is endpoint_2
@smk4664
Copy link
Contributor

smk4664 commented Feb 3, 2022

I don't think this would belong in the nautobot-plugin-chatops itself. There are no endpoints in this plugin. If other plugins implement endpoints, they could likely implement this themselves. I believe there are already examples of something similar to this in another plugin, let me see if I can find that.

@chadell
Copy link
Contributor Author

chadell commented Feb 3, 2022

Thanks @smk4664 , it is a totally valid point.
However, from another angle, almost all the Chatops rely on "endpoints", so if we don't implement it here, all the other plugins will need to reinvent the wheel every time.
The point is that these feature would be "optional", so you don't need to define endpoints, it's just a helper if the specific chatops needs this feature (most likely)
Open to review it and adapt as needed

@jvanderaa
Copy link
Contributor

@chadell / @smk4664 what is the latest on this type of effort?

@chadell
Copy link
Contributor Author

chadell commented May 31, 2022

@jvanderaa

We had a sync with @smk4664 , considering the latest enhancements from Nautobot, and we could approach it creating a new model:

chatops_endpoints:
     -  name: "my fancy endpoint"
         slug: "my-fancy-endpoint"
         url: "https:/...."
         plugin: FK(nautobot-plugin)
         secret: FK(secrets)
         verify_ssl: True

With this, you can create you endpoints, for multiple chatops plugins, and the in the chat, define the actual endtpoint with each chatops command. So /ipfabric will look for the chatops_endpoints that has the ipfabric plugin related.

@jvanderaa
Copy link
Contributor

Where would this be placed at?

@chadell
Copy link
Contributor Author

chadell commented Jun 19, 2022

I got in touch with Core to understand if this idea (URL Endpoints) could be an extensibility option for Core.
I am trying to get a more complete understanding of different use-cases across plugins, not only chatops ones.

@smk4664
Copy link
Contributor

smk4664 commented Sep 26, 2022

This is going to be put into a new Nautobot App to provide the Endpoints model, likely External API's.

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

No branches or pull requests

3 participants