nautobot-app-chatops icon indicating copy to clipboard operation
nautobot-app-chatops copied to clipboard

Allow changing endpoint per user in the live chat

Open chadell opened this issue 2 years ago • 7 comments

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

chadell avatar Feb 01 '22 13:02 chadell