CredentialsClient
Client for managing credentials for any Datagrok entity. Credentials can be associated with data connections, packages, or other entity types.
Examples
Get credentials for a connection
>>> creds = grok.credentials.for_entity(connection.id)
>>> print(creds.parameters)
Save credentials for a package
>>> creds = grok.credentials.for_entity(package.id)
>>> creds.parameters['apiKey'] = 'new-key'
>>> grok.credentials.save(creds)
Methods
__init__()
for_entity()
Get credentials for an entity by its ID.
Parameters
| Name | Type | Description |
|---|---|---|
| entity_id | str | The entity ID (UUID) to retrieve credentials for. |
Returns
| Type | Description |
|---|---|
| Credentials | The credentials associated with the entity. |
save()
Save or update credentials. The credentials must have entity_bind_id set to associate them with an entity. Typically, first call for_entity() to load existing credentials, modify parameters, then save.
Parameters
| Name | Type | Description |
|---|---|---|
| credentials | Credentials | The credentials object to save. |
delete()
Delete credentials by object or ID.
Parameters
| Name | Type | Description |
|---|---|---|
| credentials | Credentials or str | The credentials object or credentials ID to delete. |