Authentication and API keys¶
In the following examples, client is an AgentManagementClient created as described in The main AgentManagementClient class. Authentication and key administration methods are available directly on this client.
Inspecting the current identity¶
auth_info = client.get_auth_info()
print(auth_info)
The permissions of an API call depend on the API key used. Personal keys use the user’s permissions. Global keys can use the permissions of their assigned groups.
Listing global keys¶
These administration examples require an API key with instance administration rights.
for item in client.list_global_api_keys():
print(item.id, item.label)
Creating a key with group permissions¶
Use an existing group with the required platform and agent permissions.
key = client.create_global_api_key_with_groups(
label="Agent inventory integration",
description="Reads the production agent inventory",
groups=["agent-readers"],
)
The returned key handle contains the new secret. Store it in your integration’s secret store. A global key does not inherit the creator’s personal favorites; use a personal key for user-specific favorites.
Using the new key¶
import dataikuapi
integration_client = dataikuapi.AgentManagementClient(
host,
api_key=key.key,
)
agents = integration_client.list_agents()
Here host is the base URL used to create the original client. For TLS settings, see The main AgentManagementClient class.
Reference documentation¶
Classes¶
|
A global API key on the DSS instance |
An item in a list of global API keys. |
Functions¶
|
Create a Global API key, and return a handle to interact with it. |
Returns various information about the user currently authenticated using this instance of the API client. |
|
|
Lists readable agents matching an optional filter. |
|
List all global API keys set up on the Agent Management instance |
