ibm-watsonx-orchestrate 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ibm_watsonx_orchestrate/__init__.py +28 -0
- ibm_watsonx_orchestrate/agent_builder/__init__.py +0 -0
- ibm_watsonx_orchestrate/agent_builder/agents/__init__.py +5 -0
- ibm_watsonx_orchestrate/agent_builder/agents/agent.py +27 -0
- ibm_watsonx_orchestrate/agent_builder/agents/assistant_agent.py +28 -0
- ibm_watsonx_orchestrate/agent_builder/agents/external_agent.py +28 -0
- ibm_watsonx_orchestrate/agent_builder/agents/types.py +204 -0
- ibm_watsonx_orchestrate/agent_builder/connections/__init__.py +27 -0
- ibm_watsonx_orchestrate/agent_builder/connections/connections.py +123 -0
- ibm_watsonx_orchestrate/agent_builder/connections/types.py +260 -0
- ibm_watsonx_orchestrate/agent_builder/knowledge_bases/knowledge_base.py +27 -0
- ibm_watsonx_orchestrate/agent_builder/knowledge_bases/knowledge_base_requests.py +59 -0
- ibm_watsonx_orchestrate/agent_builder/knowledge_bases/types.py +243 -0
- ibm_watsonx_orchestrate/agent_builder/tools/__init__.py +4 -0
- ibm_watsonx_orchestrate/agent_builder/tools/base_tool.py +36 -0
- ibm_watsonx_orchestrate/agent_builder/tools/openapi_tool.py +332 -0
- ibm_watsonx_orchestrate/agent_builder/tools/python_tool.py +195 -0
- ibm_watsonx_orchestrate/agent_builder/tools/types.py +162 -0
- ibm_watsonx_orchestrate/agent_builder/utils/__init__.py +0 -0
- ibm_watsonx_orchestrate/agent_builder/utils/pydantic_utils.py +149 -0
- ibm_watsonx_orchestrate/cli/__init__.py +0 -0
- ibm_watsonx_orchestrate/cli/commands/__init__.py +0 -0
- ibm_watsonx_orchestrate/cli/commands/agents/agents_command.py +192 -0
- ibm_watsonx_orchestrate/cli/commands/agents/agents_controller.py +660 -0
- ibm_watsonx_orchestrate/cli/commands/channels/channels_command.py +15 -0
- ibm_watsonx_orchestrate/cli/commands/channels/channels_controller.py +16 -0
- ibm_watsonx_orchestrate/cli/commands/channels/types.py +15 -0
- ibm_watsonx_orchestrate/cli/commands/channels/webchat/channels_webchat_command.py +32 -0
- ibm_watsonx_orchestrate/cli/commands/channels/webchat/channels_webchat_controller.py +141 -0
- ibm_watsonx_orchestrate/cli/commands/chat/chat_command.py +43 -0
- ibm_watsonx_orchestrate/cli/commands/connections/connections_command.py +307 -0
- ibm_watsonx_orchestrate/cli/commands/connections/connections_controller.py +517 -0
- ibm_watsonx_orchestrate/cli/commands/environment/environment_command.py +78 -0
- ibm_watsonx_orchestrate/cli/commands/environment/environment_controller.py +189 -0
- ibm_watsonx_orchestrate/cli/commands/environment/types.py +9 -0
- ibm_watsonx_orchestrate/cli/commands/knowledge_bases/knowledge_bases_command.py +79 -0
- ibm_watsonx_orchestrate/cli/commands/knowledge_bases/knowledge_bases_controller.py +201 -0
- ibm_watsonx_orchestrate/cli/commands/login/login_command.py +17 -0
- ibm_watsonx_orchestrate/cli/commands/models/models_command.py +128 -0
- ibm_watsonx_orchestrate/cli/commands/server/server_command.py +623 -0
- ibm_watsonx_orchestrate/cli/commands/settings/__init__.py +0 -0
- ibm_watsonx_orchestrate/cli/commands/settings/observability/__init__.py +0 -0
- ibm_watsonx_orchestrate/cli/commands/settings/observability/langfuse/__init__.py +0 -0
- ibm_watsonx_orchestrate/cli/commands/settings/observability/langfuse/langfuse_command.py +175 -0
- ibm_watsonx_orchestrate/cli/commands/settings/observability/observability_command.py +11 -0
- ibm_watsonx_orchestrate/cli/commands/settings/settings_command.py +10 -0
- ibm_watsonx_orchestrate/cli/commands/tools/tools_command.py +85 -0
- ibm_watsonx_orchestrate/cli/commands/tools/tools_controller.py +564 -0
- ibm_watsonx_orchestrate/cli/commands/tools/types.py +10 -0
- ibm_watsonx_orchestrate/cli/config.py +226 -0
- ibm_watsonx_orchestrate/cli/main.py +32 -0
- ibm_watsonx_orchestrate/client/__init__.py +0 -0
- ibm_watsonx_orchestrate/client/agents/agent_client.py +46 -0
- ibm_watsonx_orchestrate/client/agents/assistant_agent_client.py +38 -0
- ibm_watsonx_orchestrate/client/agents/external_agent_client.py +38 -0
- ibm_watsonx_orchestrate/client/analytics/__init__.py +0 -0
- ibm_watsonx_orchestrate/client/analytics/llm/__init__.py +0 -0
- ibm_watsonx_orchestrate/client/analytics/llm/analytics_llm_client.py +50 -0
- ibm_watsonx_orchestrate/client/base_api_client.py +113 -0
- ibm_watsonx_orchestrate/client/base_service_instance.py +10 -0
- ibm_watsonx_orchestrate/client/client.py +71 -0
- ibm_watsonx_orchestrate/client/client_errors.py +359 -0
- ibm_watsonx_orchestrate/client/connections/__init__.py +10 -0
- ibm_watsonx_orchestrate/client/connections/connections_client.py +162 -0
- ibm_watsonx_orchestrate/client/connections/utils.py +27 -0
- ibm_watsonx_orchestrate/client/credentials.py +123 -0
- ibm_watsonx_orchestrate/client/knowledge_bases/knowledge_base_client.py +46 -0
- ibm_watsonx_orchestrate/client/local_service_instance.py +91 -0
- ibm_watsonx_orchestrate/client/service_instance.py +73 -0
- ibm_watsonx_orchestrate/client/tools/tool_client.py +41 -0
- ibm_watsonx_orchestrate/client/utils.py +95 -0
- ibm_watsonx_orchestrate/docker/compose-lite.yml +595 -0
- ibm_watsonx_orchestrate/docker/default.env +125 -0
- ibm_watsonx_orchestrate/docker/sdk/ibm_watsonx_orchestrate-0.6.0-py3-none-any.whl +0 -0
- ibm_watsonx_orchestrate/docker/sdk/ibm_watsonx_orchestrate-0.6.0.tar.gz +0 -0
- ibm_watsonx_orchestrate/docker/start-up.sh +61 -0
- ibm_watsonx_orchestrate/docker/tempus/common-config.yaml +1 -0
- ibm_watsonx_orchestrate/run/__init__.py +0 -0
- ibm_watsonx_orchestrate/run/connections.py +40 -0
- ibm_watsonx_orchestrate/utils/__init__.py +0 -0
- ibm_watsonx_orchestrate/utils/logging/__init__.py +0 -0
- ibm_watsonx_orchestrate/utils/logging/logger.py +26 -0
- ibm_watsonx_orchestrate/utils/logging/logging.yaml +18 -0
- ibm_watsonx_orchestrate/utils/utils.py +15 -0
- ibm_watsonx_orchestrate-1.0.0.dist-info/METADATA +34 -0
- ibm_watsonx_orchestrate-1.0.0.dist-info/RECORD +89 -0
- ibm_watsonx_orchestrate-1.0.0.dist-info/WHEEL +4 -0
- ibm_watsonx_orchestrate-1.0.0.dist-info/entry_points.txt +2 -0
- ibm_watsonx_orchestrate-1.0.0.dist-info/licenses/LICENSE +22 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
import typer
|
2
|
+
from typing_extensions import Annotated
|
3
|
+
from ibm_watsonx_orchestrate.cli.commands.channels.types import EnvironmentType
|
4
|
+
from ibm_watsonx_orchestrate.cli.commands.channels.webchat.channels_webchat_controller import ChannelsWebchatController
|
5
|
+
|
6
|
+
|
7
|
+
channel_webchat = typer.Typer(no_args_is_help=True)
|
8
|
+
|
9
|
+
@channel_webchat.command(
|
10
|
+
name="embed",
|
11
|
+
help="Creates an embedded webchat code snippet with the command 'orchestrate channel webchat embed --agent-name=some_agent --env=live"
|
12
|
+
)
|
13
|
+
def create_webchat_embed_code(
|
14
|
+
agent_name: Annotated[
|
15
|
+
str,
|
16
|
+
typer.Option(
|
17
|
+
'--agent-name',
|
18
|
+
'-a',
|
19
|
+
help='The name of the agent you wish to have embedded'
|
20
|
+
)
|
21
|
+
],
|
22
|
+
env: Annotated[
|
23
|
+
EnvironmentType,
|
24
|
+
typer.Option(
|
25
|
+
'--env',
|
26
|
+
'-e',
|
27
|
+
help='The environment in which your agent resides. This will default to live if no environment is provided'
|
28
|
+
)
|
29
|
+
] = EnvironmentType.LIVE,
|
30
|
+
):
|
31
|
+
controller = ChannelsWebchatController(agent_name=agent_name, env=env)
|
32
|
+
controller.create_webchat_embed_code()
|
@@ -0,0 +1,141 @@
|
|
1
|
+
import logging
|
2
|
+
import logging
|
3
|
+
import rich
|
4
|
+
import jwt
|
5
|
+
|
6
|
+
from ibm_watsonx_orchestrate.cli.config import Config, ENV_WXO_URL_OPT, ENVIRONMENTS_SECTION_HEADER, CONTEXT_SECTION_HEADER, CONTEXT_ACTIVE_ENV_OPT, CHAT_UI_PORT
|
7
|
+
from ibm_watsonx_orchestrate.client.utils import is_local_dev, AUTH_CONFIG_FILE_FOLDER, AUTH_SECTION_HEADER, AUTH_MCSP_TOKEN_OPT, AUTH_CONFIG_FILE
|
8
|
+
|
9
|
+
from ibm_watsonx_orchestrate.client.agents.agent_client import AgentClient
|
10
|
+
|
11
|
+
from ibm_watsonx_orchestrate.client.utils import instantiate_client
|
12
|
+
|
13
|
+
logger = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
class ChannelsWebchatController:
|
16
|
+
def __init__(self, agent_name: str, env: str):
|
17
|
+
self.agent_name = agent_name
|
18
|
+
self.env = env
|
19
|
+
|
20
|
+
def get_native_client(self):
|
21
|
+
self.native_client = instantiate_client(AgentClient)
|
22
|
+
return self.native_client
|
23
|
+
|
24
|
+
|
25
|
+
def get_agent_id(self, agent_name: str):
|
26
|
+
native_client = self.get_native_client()
|
27
|
+
existing_native_agents = native_client.get_draft_by_name(agent_name)
|
28
|
+
|
29
|
+
if not existing_native_agents:
|
30
|
+
logger.error(f"No agent found with the name '{agent_name}'")
|
31
|
+
exit(1)
|
32
|
+
agent_id = existing_native_agents[0]['id']
|
33
|
+
return agent_id
|
34
|
+
|
35
|
+
def get_environment_id(self, agent_name: str, env: str):
|
36
|
+
native_client = self.get_native_client()
|
37
|
+
existing_native_agents = native_client.get_draft_by_name(agent_name)
|
38
|
+
|
39
|
+
if not existing_native_agents:
|
40
|
+
raise ValueError(f"No agent found with the name '{agent_name}'")
|
41
|
+
|
42
|
+
agent = existing_native_agents[0]
|
43
|
+
agent_environments = agent.get("environments", [])
|
44
|
+
|
45
|
+
is_local = is_local_dev()
|
46
|
+
target_env = env or 'draft'
|
47
|
+
|
48
|
+
if is_local:
|
49
|
+
if env == 'live':
|
50
|
+
logger.warning('Live environments do not exist for Local env, defaulting to draft.')
|
51
|
+
target_env = 'draft'
|
52
|
+
|
53
|
+
filtered_environments = [e for e in agent_environments if e.get("name") == target_env]
|
54
|
+
|
55
|
+
if not filtered_environments:
|
56
|
+
if env == 'live':
|
57
|
+
logger.error(f'This agent does not exist in the {env} environment. You need to deploy it to {env} before you can embed the agent')
|
58
|
+
exit(1)
|
59
|
+
|
60
|
+
return filtered_environments[0].get("id")
|
61
|
+
|
62
|
+
|
63
|
+
def get_tennent_id(self):
|
64
|
+
auth_cfg = Config(AUTH_CONFIG_FILE_FOLDER, AUTH_CONFIG_FILE)
|
65
|
+
|
66
|
+
cfg = Config()
|
67
|
+
active_env = cfg.read(CONTEXT_SECTION_HEADER, CONTEXT_ACTIVE_ENV_OPT)
|
68
|
+
is_local = is_local_dev()
|
69
|
+
|
70
|
+
existing_auth_config = auth_cfg.get(AUTH_SECTION_HEADER).get(active_env, {})
|
71
|
+
|
72
|
+
existing_token = existing_auth_config.get(AUTH_MCSP_TOKEN_OPT) if existing_auth_config else None
|
73
|
+
|
74
|
+
token = jwt.decode(existing_token, options={"verify_signature": False})
|
75
|
+
tenant_id = ""
|
76
|
+
if is_local:
|
77
|
+
tenant_id = token.get('woTenantId', None)
|
78
|
+
else:
|
79
|
+
tenant_id = token.get('tenantId', None)
|
80
|
+
|
81
|
+
return tenant_id
|
82
|
+
|
83
|
+
def get_host_url(self):
|
84
|
+
cfg = Config()
|
85
|
+
active_env = cfg.read(CONTEXT_SECTION_HEADER, CONTEXT_ACTIVE_ENV_OPT)
|
86
|
+
env_cfg = cfg.get(ENVIRONMENTS_SECTION_HEADER, active_env)
|
87
|
+
url = env_cfg.get(ENV_WXO_URL_OPT)
|
88
|
+
is_local = is_local_dev(url=url)
|
89
|
+
if is_local:
|
90
|
+
url_parts = url.split(":")
|
91
|
+
url_parts[-1] = CHAT_UI_PORT
|
92
|
+
url = ":".join(url_parts)
|
93
|
+
return url
|
94
|
+
else:
|
95
|
+
if url.startswith("https://api."):
|
96
|
+
url = url.replace("https://api.", "https://", 1)
|
97
|
+
cleaned_url = url.split(".com")[0] + ".com"
|
98
|
+
|
99
|
+
return cleaned_url
|
100
|
+
|
101
|
+
|
102
|
+
def create_webchat_embed_code(self):
|
103
|
+
tenant_id = self.get_tennent_id()
|
104
|
+
host_url = self.get_host_url()
|
105
|
+
agent_id = self.get_agent_id(self.agent_name)
|
106
|
+
agent_env_id = self.get_environment_id(self.agent_name, self.env)
|
107
|
+
|
108
|
+
is_local = is_local_dev()
|
109
|
+
script_path = (
|
110
|
+
"/wxoLoader.js?embed=true"
|
111
|
+
if is_local
|
112
|
+
else "/wxochat/wxoLoader.js?embed=true"
|
113
|
+
)
|
114
|
+
|
115
|
+
script = f"""
|
116
|
+
<script>
|
117
|
+
window.wxOConfiguration = {{
|
118
|
+
orchestrationID: "{tenant_id}",
|
119
|
+
hostURL: "{host_url}",
|
120
|
+
rootElementID: "root",
|
121
|
+
showLauncher: true,
|
122
|
+
chatOptions: {{
|
123
|
+
agentId: "{agent_id}",
|
124
|
+
agentEnvironmentId: "{agent_env_id}"
|
125
|
+
}},
|
126
|
+
}};
|
127
|
+
|
128
|
+
setTimeout(function () {{
|
129
|
+
const script = document.createElement('script');
|
130
|
+
script.src = `${{window.wxOConfiguration.hostURL}}{script_path}`;
|
131
|
+
script.addEventListener('load', function () {{
|
132
|
+
wxoLoader.init();
|
133
|
+
}});
|
134
|
+
document.head.appendChild(script);
|
135
|
+
}}, 0);
|
136
|
+
</script>
|
137
|
+
"""
|
138
|
+
|
139
|
+
rich.print(script)
|
140
|
+
return script
|
141
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import logging
|
2
|
+
import typer
|
3
|
+
import webbrowser
|
4
|
+
from pathlib import Path
|
5
|
+
|
6
|
+
chat_app = typer.Typer(no_args_is_help=True)
|
7
|
+
from ibm_watsonx_orchestrate.cli.commands.server.server_command import run_compose_lite_ui, run_compose_lite_down_ui
|
8
|
+
|
9
|
+
logger = logging.getLogger(__name__)
|
10
|
+
|
11
|
+
@chat_app.command(name="start")
|
12
|
+
def chat_start(
|
13
|
+
user_env_file: str = typer.Option(
|
14
|
+
None,
|
15
|
+
"--env-file", "-e",
|
16
|
+
help="Path to a .env file that overrides default.env. Then environment variables override both."
|
17
|
+
)
|
18
|
+
):
|
19
|
+
user_env_file_path = Path(user_env_file) if user_env_file else None
|
20
|
+
|
21
|
+
is_ui_service_started = run_compose_lite_ui(user_env_file=user_env_file_path)
|
22
|
+
|
23
|
+
if is_ui_service_started:
|
24
|
+
url = "http://localhost:3000/chat-lite"
|
25
|
+
webbrowser.open(url)
|
26
|
+
logger.info(f"Opening chat interface at {url}")
|
27
|
+
else:
|
28
|
+
logger.error("Unable to start orchestrate UI chat service. Please check error messages and logs")
|
29
|
+
|
30
|
+
@chat_app.command(name="stop")
|
31
|
+
def chat_stop(
|
32
|
+
user_env_file: str = typer.Option(
|
33
|
+
None,
|
34
|
+
"--env-file", "-e",
|
35
|
+
help="Path to a .env file that overrides default.env. Then environment variables override both."
|
36
|
+
)
|
37
|
+
):
|
38
|
+
user_env_file_path = Path(user_env_file) if user_env_file else None
|
39
|
+
run_compose_lite_down_ui(user_env_file=user_env_file_path)
|
40
|
+
|
41
|
+
|
42
|
+
if __name__ == "__main__":
|
43
|
+
chat_app()
|
@@ -0,0 +1,307 @@
|
|
1
|
+
import typer
|
2
|
+
from typing_extensions import Annotated, List
|
3
|
+
from ibm_watsonx_orchestrate.agent_builder.connections.types import ConnectionEnvironment, ConnectionPreference, ConnectionKind
|
4
|
+
from ibm_watsonx_orchestrate.cli.commands.connections.connections_controller import (
|
5
|
+
add_connection,
|
6
|
+
remove_connection,
|
7
|
+
list_connections,
|
8
|
+
import_connection,
|
9
|
+
configure_connection,
|
10
|
+
set_credentials_connection,
|
11
|
+
set_identity_provider_connection
|
12
|
+
)
|
13
|
+
|
14
|
+
connections_app = typer.Typer(no_args_is_help=True)
|
15
|
+
|
16
|
+
@connections_app.command(name="add")
|
17
|
+
def add_connection_command(
|
18
|
+
app_id: Annotated[
|
19
|
+
str, typer.Option(
|
20
|
+
'--app-id', '-a',
|
21
|
+
help='The app id of the connection you wish to create. This value will be used to uniquely reference this connection when associating the connection with tools or agents'
|
22
|
+
)
|
23
|
+
]
|
24
|
+
):
|
25
|
+
add_connection(app_id=app_id)
|
26
|
+
|
27
|
+
@connections_app.command(name="remove")
|
28
|
+
def remove_connection_command(
|
29
|
+
app_id: Annotated[
|
30
|
+
str, typer.Option(
|
31
|
+
'--app-id', '-a',
|
32
|
+
help='The app id of the connection you wish to remove. This will also remove the configuration and credentials associated with the provided app id.'
|
33
|
+
)
|
34
|
+
]
|
35
|
+
):
|
36
|
+
remove_connection(app_id=app_id)
|
37
|
+
|
38
|
+
@connections_app.command(name="list")
|
39
|
+
def list_connections_command(
|
40
|
+
environment: Annotated[
|
41
|
+
ConnectionEnvironment, typer.Option(
|
42
|
+
'--environment', '--env',
|
43
|
+
help='Optionally limit the connections you want to see to only those of a certain environment'
|
44
|
+
)
|
45
|
+
] = None,
|
46
|
+
verbose: Annotated[
|
47
|
+
bool, typer.Option(
|
48
|
+
'--verbose', '-v',
|
49
|
+
help='List the connections in json format without table styling'
|
50
|
+
)
|
51
|
+
] = None
|
52
|
+
):
|
53
|
+
list_connections(environment=environment, verbose=verbose)
|
54
|
+
|
55
|
+
@connections_app.command(name="import")
|
56
|
+
def import_connection_command(
|
57
|
+
file: Annotated[
|
58
|
+
str, typer.Option(
|
59
|
+
'--file', '-f',
|
60
|
+
help='Path to a spec file containing the connection details'
|
61
|
+
)
|
62
|
+
]
|
63
|
+
):
|
64
|
+
import_connection(file=file)
|
65
|
+
|
66
|
+
@connections_app.command(name="configure")
|
67
|
+
def configure_connection_command(
|
68
|
+
app_id: Annotated[
|
69
|
+
str, typer.Option(
|
70
|
+
'--app-id', '-a',
|
71
|
+
help='The app id you want to configure'
|
72
|
+
)
|
73
|
+
],
|
74
|
+
environment: Annotated[
|
75
|
+
ConnectionEnvironment, typer.Option(
|
76
|
+
'--environment', '--env',
|
77
|
+
help='The environment you want to configure'
|
78
|
+
)
|
79
|
+
],
|
80
|
+
type: Annotated[
|
81
|
+
ConnectionPreference, typer.Option(
|
82
|
+
'--type', '-t',
|
83
|
+
help='The type of credentials. `--type team` will mean the credentials apply to all users, `--type member` will mean each user will have to provide their own credentials'
|
84
|
+
)
|
85
|
+
],
|
86
|
+
kind: Annotated[
|
87
|
+
ConnectionKind, typer.Option(
|
88
|
+
'--kind', '-k',
|
89
|
+
help='The kind of credentials the connection will use.'
|
90
|
+
)
|
91
|
+
],
|
92
|
+
server_url: Annotated[
|
93
|
+
str, typer.Option(
|
94
|
+
'--server-url', '--url', '-u',
|
95
|
+
help='The url the connection is going to be used access.'
|
96
|
+
)
|
97
|
+
] = None,
|
98
|
+
sso: Annotated[
|
99
|
+
bool, typer.Option(
|
100
|
+
'--sso', '-s',
|
101
|
+
help='Does the OAuth require a SAML provider. Only applicable to OAuth kinds'
|
102
|
+
)
|
103
|
+
] = False,
|
104
|
+
idp_token_use: Annotated[
|
105
|
+
str, typer.Option(
|
106
|
+
'--idp-token-use',
|
107
|
+
help='The OAuth token use for the identity provider. Only applicable to OAuth kinds with sso'
|
108
|
+
)
|
109
|
+
] = None,
|
110
|
+
idp_token_type: Annotated[
|
111
|
+
str, typer.Option(
|
112
|
+
'--idp-token-type',
|
113
|
+
help='The OAuth token type for the identity provider. Only applicable to OAuth kinds with sso'
|
114
|
+
)
|
115
|
+
] = None,
|
116
|
+
idp_token_header: Annotated[
|
117
|
+
List[str], typer.Option(
|
118
|
+
'--idp-token-header',
|
119
|
+
help='Header values for the identity provider token request. Defaults to using `content-type: application/x-www-form-urlencoded`. Multiple can be set using `--idp-token-header "content-type: application/x-www-form-urlencoded" --idp-token-header "encoding:..."` . Only applicable to OAuth kinds with sso'
|
120
|
+
)
|
121
|
+
] = None,
|
122
|
+
app_token_header: Annotated[
|
123
|
+
List[str], typer.Option(
|
124
|
+
'--app-token-header',
|
125
|
+
help='Header values for the app token request. Defaults to using `content-type: application/x-www-form-urlencoded`. Multiple can be set using `--app-token-header "content-type: application/x-www-form-urlencoded" --app-token-header "encoding:..."` . Only applicable to OAuth kinds with sso'
|
126
|
+
)
|
127
|
+
] = None,
|
128
|
+
|
129
|
+
):
|
130
|
+
configure_connection(
|
131
|
+
app_id=app_id,
|
132
|
+
environment=environment,
|
133
|
+
type=type,
|
134
|
+
kind=kind,
|
135
|
+
server_url=server_url,
|
136
|
+
sso=sso,
|
137
|
+
idp_token_use=idp_token_use,
|
138
|
+
idp_token_type=idp_token_type,
|
139
|
+
idp_token_header=idp_token_header,
|
140
|
+
app_token_header=app_token_header
|
141
|
+
)
|
142
|
+
|
143
|
+
@connections_app.command(name="set-credentials")
|
144
|
+
def set_credentials_connection_command(
|
145
|
+
|
146
|
+
app_id: Annotated[
|
147
|
+
str, typer.Option(
|
148
|
+
'--app-id', '-a',
|
149
|
+
help='The app id you want to configure'
|
150
|
+
)
|
151
|
+
],
|
152
|
+
environment: Annotated[
|
153
|
+
ConnectionEnvironment, typer.Option(
|
154
|
+
'--environment', '--env',
|
155
|
+
help='The environment you want to configure'
|
156
|
+
)
|
157
|
+
],
|
158
|
+
username: Annotated[
|
159
|
+
str,
|
160
|
+
typer.Option(
|
161
|
+
'--username',
|
162
|
+
'-u',
|
163
|
+
help='For basic auth, the username to login with'
|
164
|
+
)
|
165
|
+
] = None,
|
166
|
+
password: Annotated[
|
167
|
+
str,
|
168
|
+
typer.Option(
|
169
|
+
'--password',
|
170
|
+
'-p',
|
171
|
+
help='For basic auth, the password to login with'
|
172
|
+
)
|
173
|
+
] = None,
|
174
|
+
token: Annotated[
|
175
|
+
str,
|
176
|
+
typer.Option(
|
177
|
+
'--token',
|
178
|
+
help='For bearer auth, the bearer token to use'
|
179
|
+
)
|
180
|
+
] = None,
|
181
|
+
api_key: Annotated[
|
182
|
+
str,
|
183
|
+
typer.Option(
|
184
|
+
'--api-key',
|
185
|
+
'-k',
|
186
|
+
help='For api_key auth, the api key to use'
|
187
|
+
)
|
188
|
+
] = None,
|
189
|
+
client_id: Annotated[
|
190
|
+
str,
|
191
|
+
typer.Option(
|
192
|
+
'--client-id',
|
193
|
+
# help='For oauth_auth_on_behalf_of_flow, oauth_auth_code_flow, oauth_auth_implicit_flow, oauth_auth_password_flow and oauth_auth_client_credentials_flow, the client_id to authenticate against the application token server'
|
194
|
+
help='For oauth_auth_on_behalf_of_flow, the client_id to authenticate against the application token server'
|
195
|
+
)
|
196
|
+
] = None,
|
197
|
+
# client_secret: Annotated[
|
198
|
+
# str,
|
199
|
+
# typer.Option(
|
200
|
+
# '--client-secret',
|
201
|
+
# help='For oauth_auth_code_flow, oauth_auth_password_flow and oauth_auth_client_credentials_flow, the client_secret to authenticate with'
|
202
|
+
# )
|
203
|
+
# ] = None,
|
204
|
+
token_url: Annotated[
|
205
|
+
str,
|
206
|
+
typer.Option(
|
207
|
+
'--token-url',
|
208
|
+
# help='For oauth_auth_on_behalf_of_flow, oauth_auth_code_flow, oauth_auth_password_flow and oauth_auth_client_credentials_flow, the url of the application token server'
|
209
|
+
help='For oauth_auth_on_behalf_of_flow, the url of the application token server'
|
210
|
+
)
|
211
|
+
] = None,
|
212
|
+
# auth_url: Annotated[
|
213
|
+
# str,
|
214
|
+
# typer.Option(
|
215
|
+
# '--auth-url',
|
216
|
+
# help='For oauth_auth_code_flow, oauth_auth_implicit_flow and oauth_auth_password_flow, the url of the application token server'
|
217
|
+
# )
|
218
|
+
# ] = None,
|
219
|
+
grant_type: Annotated[
|
220
|
+
str,
|
221
|
+
typer.Option(
|
222
|
+
'--grant-type',
|
223
|
+
help='For oauth_auth_on_behalf_of_flow, the grant type used by the application token server'
|
224
|
+
)
|
225
|
+
] = None,
|
226
|
+
entries: Annotated[
|
227
|
+
List[str],
|
228
|
+
typer.Option(
|
229
|
+
'--entries', "-e",
|
230
|
+
help="For key_value, a key value pair in the form '<key>=<value>'. Multiple values can be passed using `-e key1=value1 -e key2=value2`"
|
231
|
+
)
|
232
|
+
] = None,
|
233
|
+
):
|
234
|
+
set_credentials_connection(
|
235
|
+
app_id=app_id,
|
236
|
+
environment=environment,
|
237
|
+
username=username,
|
238
|
+
password=password,
|
239
|
+
token=token,
|
240
|
+
api_key=api_key,
|
241
|
+
client_id=client_id,
|
242
|
+
# client_secret=client_secret,
|
243
|
+
token_url=token_url,
|
244
|
+
# auth_url=auth_url,
|
245
|
+
grant_type=grant_type,
|
246
|
+
entries=entries
|
247
|
+
)
|
248
|
+
|
249
|
+
@connections_app.command(name="set-identity-provider")
|
250
|
+
def set_identity_provider_connection_command(
|
251
|
+
|
252
|
+
app_id: Annotated[
|
253
|
+
str, typer.Option(
|
254
|
+
'--app-id', '-a',
|
255
|
+
help='The app id you want to configure'
|
256
|
+
)
|
257
|
+
],
|
258
|
+
environment: Annotated[
|
259
|
+
ConnectionEnvironment, typer.Option(
|
260
|
+
'--environment', '--env',
|
261
|
+
help='The environment you want to configure'
|
262
|
+
)
|
263
|
+
],
|
264
|
+
url: Annotated[
|
265
|
+
str, typer.Option(
|
266
|
+
'--url', '-u',
|
267
|
+
help='The token url of the identity provider'
|
268
|
+
)
|
269
|
+
],
|
270
|
+
client_id: Annotated[
|
271
|
+
str,
|
272
|
+
typer.Option(
|
273
|
+
'--client-id',
|
274
|
+
help='The client_id to authenticate with the identity provider'
|
275
|
+
)
|
276
|
+
],
|
277
|
+
client_secret: Annotated[
|
278
|
+
str,
|
279
|
+
typer.Option(
|
280
|
+
'--client-secret',
|
281
|
+
help='The client_secret to authenticate with the identity provider'
|
282
|
+
)
|
283
|
+
],
|
284
|
+
scope: Annotated[
|
285
|
+
str,
|
286
|
+
typer.Option(
|
287
|
+
'--scope',
|
288
|
+
help='The scope of the identity provider'
|
289
|
+
)
|
290
|
+
],
|
291
|
+
grant_type: Annotated[
|
292
|
+
str,
|
293
|
+
typer.Option(
|
294
|
+
'--grant-type',
|
295
|
+
help='The grant-type of the the identity provider'
|
296
|
+
)
|
297
|
+
],
|
298
|
+
):
|
299
|
+
set_identity_provider_connection(
|
300
|
+
app_id=app_id,
|
301
|
+
environment=environment,
|
302
|
+
url=url,
|
303
|
+
client_id=client_id,
|
304
|
+
client_secret=client_secret,
|
305
|
+
scope=scope,
|
306
|
+
grant_type=grant_type
|
307
|
+
)
|