Credentials¶
Credential¶
list()¶
Returns list of available credentials.
Returns
| Returns | Description |
|---|---|
| credentials | contains a list of available credentials. |
Return type: list of Credential instances
Examples
>>> import datarobot as dr
>>> data_sources = dr.Credential.list()
>>> data_sources
[
Credential('5e429d6ecf8a5f36c5693e03', 'my_s3_cred', 's3'),
Credential('5e42cc4dcf8a5f3256865840', 'my_jdbc_cred', 'jdbc'),
]
get()¶
Gets the Credential.
Parameters
| Parameter | Type | Description |
|---|---|---|
credential_id |
str |
the identifier of the credential. |
Returns
| Returns | Description |
|---|---|
| credential | the requested credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.get('5a8ac9ab07a57a0001be501f')
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'my_s3_cred', 's3'),
delete()¶
Deletes the Credential the store.
Parameters
| Parameter | Type | Description |
|---|---|---|
credential_id |
str |
the identifier of the credential. |
Returns
| Returns | Description |
|---|---|
| credential | the requested credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.get('5a8ac9ab07a57a0001be501f')
>>> cred.delete()
create_basic()¶
Creates the credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
the name to use for this set of credentials. |
user |
str |
the username to store for this set of credentials. |
password |
str |
the password to store for this set of credentials. |
description |
Optional[str] |
the description to use for this set of credentials. |
Returns
| Returns | Description |
|---|---|
| credential | the created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_basic(
... name='my_basic_cred',
... user='username',
... password='password',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'my_basic_cred', 'basic'),
create_oauth()¶
Creates the OAUTH credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
the name to use for this set of credentials. |
token |
str |
the OAUTH token |
refresh_token |
str |
The OAUTH token |
description |
Optional[str] |
the description to use for this set of credentials. |
Returns
| Returns | Description |
|---|---|
| credential | the created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_oauth(
... name='my_oauth_cred',
... token='XXX',
... refresh_token='YYY',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'my_oauth_cred', 'oauth'),
create_s3()¶
Creates the S3 credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
the name to use for this set of credentials. |
aws_access_key_id |
Optional[str] |
the AWS access key id. |
aws_secret_access_key |
Optional[str] |
the AWS secret access key. |
aws_session_token |
Optional[str] |
the AWS session token. |
config_id |
Optional[str] |
The ID of the saved shared secure configuration. If specified, cannot include awsAccessKeyId, awsSecretAccessKey or awsSessionToken. |
description |
Optional[str] |
the description to use for this set of credentials. |
Returns
| Returns | Description |
|---|---|
| credential | the created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_s3(
... name='my_s3_cred',
... aws_access_key_id='XXX',
... aws_secret_access_key='YYY',
... aws_session_token='ZZZ',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'my_s3_cred', 's3'),
create_azure()¶
Creates the Azure storage credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
the name to use for this set of credentials. |
azure_connection_string |
str |
the Azure connection string. |
description |
Optional[str] |
the description to use for this set of credentials. |
Returns
| Returns | Description |
|---|---|
| credential | the created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_azure(
... name='my_azure_cred',
... azure_connection_string='XXX',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'my_azure_cred', 'azure'),
create_snowflake_key_pair()¶
Creates the Snowflake Key Pair credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
the name to use for this set of credentials. |
user |
Optional[str] |
the Snowflake login name |
private_key |
Optional[str] |
the private key copied exactly from user private key file. Since it contains multiple lines, when assign to a variable, put the key string inside triple-quotes |
passphrase |
Optional[str] |
the string used to encrypt the private key |
config_id |
Optional[str] |
The ID of the saved shared secure configuration. If specified, cannot include user, privateKeyStr or passphrase. |
description |
Optional[str] |
the description to use for this set of credentials. |
Returns
| Returns | Description |
|---|---|
| credential | the created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_snowflake_key_pair(
... name='key_pair_cred',
... user='XXX',
... private_key='YYY',
... passphrase='ZZZ',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'key_pair_cred', 'snowflake_key_pair_user_account'),
create_databricks_access_token()¶
Creates the Databricks access token credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
the name to use for this set of credentials. |
databricks_access_token |
Optional[str] |
the Databricks personal access token |
description |
Optional[str] |
the description to use for this set of credentials. |
Returns
| Returns | Description |
|---|---|
| credential | the created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_databricks_access_token(
... name='access_token_cred',
... databricks_access_token='XXX',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'access_token_cred', 'databricks_access_token_account'),
create_databricks_service_principal()¶
Creates the Databricks access token credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
the name to use for this set of credentials. |
client_id |
Optional[str] |
the client ID for Databricks Service Principal |
client_secret |
Optional[str] |
the client secret for Databricks Service Principal |
config_id |
Optional[str] |
The ID of the saved shared secure configuration. If specified, cannot include clientId and clientSecret. |
description |
Optional[str] |
the description to use for this set of credentials. |
Returns
| Returns | Description |
|---|---|
| credential | the created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_databricks_service_principal(
... name='svc_principal_cred',
... client_id='XXX',
... client_secret='XXX',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'svc_principal_cred', 'databricks_service_principal_account'),
create_azure_service_principal()¶
Creates the Azure service principal credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
The name to use for these credentials. |
client_id |
Optional[str] |
The client ID. |
client_secret |
Optional[str] |
The client secret. |
azure_tenant_id |
Optional[str] |
The Azure tenant ID. |
config_id |
Optional[str] |
The ID of the saved secure configuration. If specified, the ID cannot include clientId, clientSecret, or azureTenantId. |
description |
Optional[str] |
The description to use for these credentials. |
Returns
| Returns | Description |
|---|---|
| credential | the created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_azure_service_principal(
... name='my_azure_service_principal_cred',
... client_id='XXX',
... client_secret='YYY',
... azure_tenant_id='ZZZ',
... )
>>> cred
Credential('66c9172d8b7a361cda126f5c', 'my_azure_service_principal_cred', 'azure_service_principal')
create_adls_oauth()¶
Creates the ADLS OAuth credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
The name to use for these credentials. |
client_id |
Optional[str] |
The client ID. |
client_secret |
Optional[str] |
The client secret. |
oauth_scopes |
List[str], optional |
The OAuth scopes. |
config_id |
Optional[str] |
The ID of the saved shared secure configuration. If specified, cannot include clientId, clientSecret, or oauthScopes. |
description |
Optional[str] |
The description to use for the ADLS OAuth credentials. |
Returns
| Returns | Description |
|---|---|
| credential | The created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_adls_oauth(
... name='my_adls_oauth_cred',
... client_id='XXX',
... client_secret='YYY',
... oauth_scopes=['ZZZ'],
... )
>>> cred
Credential('66c91e0f03010d4790735220', 'my_adls_oauth_cred', 'adls_gen2_oauth')
create_external_oauth_provider()¶
Creates credentials for an external OAuth provider.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
The display name for these credentials in DataRobot. |
authentication_id |
str |
The authorization identifier returned by the external OAuth provider service. |
description |
Optional[str] |
The description to use for the credentials. |
Returns
| Returns | Description |
|---|---|
| credential | The created credential. |
Return type: Credential
create_box_jwt()¶
Creates the Box JWT credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
The name to use for this set of credentials. |
client_id |
str |
The Box JWT client ID. |
client_secret |
str |
The Box JWT client secret. |
enterprise_id |
str |
The Box enterprise identifier. |
public_key_id |
str |
The Box public key identifier. |
private_key_str |
str |
The RSA private key for Box JWT. |
passphrase |
str |
The passphrase for the Box JWT private key. |
description |
Optional[str] |
The description to use for this set of credentials. |
Returns
| Returns | Description |
|---|---|
| credential | The created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_box_jwt(
... name='my_box_jwt_cred',
... client_id='XXX',
... client_secret='YYY',
... enterprise_id='ZZZ',
... public_key_id='AAA',
... private_key_str='-----...', # PKCS#8 formatted private key string with newlines replaced by
... passphrase='BBB',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'my_box_jwt_cred', 'box_jwt')
create_gcp()¶
Creates the GCP credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
the name to use for this set of credentials. |
gcp_key |
str \| dict |
the GCP key in json format or parsed as dict. |
description |
Optional[str] |
the description to use for this set of credentials. |
Returns
| Returns | Description |
|---|---|
| credential | the created credential. |
Return type: Credential
Examples
>>> import datarobot as dr
>>> cred = dr.Credential.create_gcp(
... name='my_gcp_cred',
... gcp_key='XXX',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'my_gcp_cred', 'gcp'),
update()¶
Update the credential values of an existing credential. Updates this object in place.
Added in version v3.2.
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str |
The name to use for this set of credentials. |
description |
Optional[str] |
The description to use for this set of credentials; if omitted, and name is not omitted, then it clears any previous description for that name. |
kwargs |
(Keyword arguments specific to the given credential_type that should be updated.) |
Return type: None