Credentials

class datarobot.models.Credential(credential_id=None, name=None, credential_type=None, creation_date=None, description=None)
classmethod list()

Returns list of available credentials.

Returns:
credentialslist of Credential instances

contains a list of available credentials.

Return type:

List[Credential]

Examples

>>> import datarobot as dr
>>> data_sources = dr.Credential.list()
>>> data_sources
[
    Credential('5e429d6ecf8a5f36c5693e03', 'my_s3_cred', 's3'),
    Credential('5e42cc4dcf8a5f3256865840', 'my_jdbc_cred', 'jdbc'),
]
classmethod get(credential_id)

Gets the Credential.

Parameters:
credential_idstr

the identifier of the credential.

Returns:
credentialCredential

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:
credential_idstr

the identifier of the credential.

Returns:
credentialCredential

the requested credential.

Return type:

None

Examples

>>> import datarobot as dr
>>> cred = dr.Credential.get('5a8ac9ab07a57a0001be501f')
>>> cred.delete()
classmethod create_basic(name, user, password, description=None)

Creates the credentials.

Parameters:
namestr

the name to use for this set of credentials.

userstr

the username to store for this set of credentials.

passwordstr

the password to store for this set of credentials.

descriptionstr, optional

the description to use for this set of credentials.

Returns:
credentialCredential

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'),
classmethod create_oauth(name, token, refresh_token, description=None)

Creates the OAUTH credentials.

Parameters:
namestr

the name to use for this set of credentials.

token: str

the OAUTH token

refresh_token: str

The OAUTH token

descriptionstr, optional

the description to use for this set of credentials.

Returns:
credentialCredential

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'),
classmethod create_s3(name, aws_access_key_id=None, aws_secret_access_key=None, aws_session_token=None, config_id=None, description=None)

Creates the S3 credentials.

Parameters:
namestr

the name to use for this set of credentials.

aws_access_key_idstr, optional

the AWS access key id.

aws_secret_access_keystr, optional

the AWS secret access key.

aws_session_tokenstr, optional

the AWS session token.

config_id: str, optional

The ID of the saved shared secure configuration. If specified, cannot include awsAccessKeyId, awsSecretAccessKey or awsSessionToken.

descriptionstr, optional

the description to use for this set of credentials.

Returns:
credentialCredential

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'),
classmethod create_azure(name, azure_connection_string, description=None)

Creates the Azure storage credentials.

Parameters:
namestr

the name to use for this set of credentials.

azure_connection_stringstr

the Azure connection string.

descriptionstr, optional

the description to use for this set of credentials.

Returns:
credentialCredential

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'),
classmethod create_snowflake_key_pair(name, user=None, private_key=None, passphrase=None, config_id=None, description=None)

Creates the Snowflake Key Pair credentials.

Parameters:
namestr

the name to use for this set of credentials.

user: str, optional

the Snowflake login name

private_key: str, optional

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: str, optional

the string used to encrypt the private key

config_id: str, optional

The ID of the saved shared secure configuration. If specified, cannot include user, privateKeyStr or passphrase.

descriptionstr, optional

the description to use for this set of credentials.

Returns:
credentialCredential

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'),
classmethod create_databricks_access_token(name, databricks_access_token, description=None)

Creates the Databricks access token credentials.

Parameters:
namestr

the name to use for this set of credentials.

databricks_access_token: str, optional

the Databricks personal access token

descriptionstr, optional

the description to use for this set of credentials.

Returns:
credentialCredential

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'),
classmethod create_databricks_service_principal(name, client_id=None, client_secret=None, config_id=None, description=None)

Creates the Databricks access token credentials.

Parameters:
namestr

the name to use for this set of credentials.

client_id: str, optional

the client ID for Databricks Service Principal

client_secret: str, optional

the client secret for Databricks Service Principal

config_id: str, optional

The ID of the saved shared secure configuration. If specified, cannot include clientId and clientSecret.

descriptionstr, optional

the description to use for this set of credentials.

Returns:
credentialCredential

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'),
classmethod create_azure_service_principal(name, client_id=None, client_secret=None, azure_tenant_id=None, config_id=None, description=None)

Creates the Azure service principal credentials.

Parameters:
namestr

The name to use for these credentials.

client_idstr, optional

The client ID.

client_secretstr, optional

The client secret.

azure_tenant_idstr, optional

The Azure tenant ID.

config_id: str, optional

The ID of the saved secure configuration. If specified, the ID cannot include clientId, clientSecret, or azureTenantId.

descriptionstr, optional

The description to use for these credentials.

Returns:
credentialCredential

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')
classmethod create_adls_oauth(name, client_id=None, client_secret=None, oauth_scopes=None, config_id=None, description=None)

Creates the ADLS OAuth credentials.

Parameters:
namestr

The name to use for these credentials.

client_idstr, optional

The client ID.

client_secretstr, optional

The client secret.

oauth_scopesList[str], optional

The OAuth scopes.

config_id: str, optional

The ID of the saved shared secure configuration. If specified, cannot include clientId, clientSecret, or oauthScopes.

descriptionstr, optional

The description to use for thesse credentials.

Returns:
credentialCredential

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')
classmethod create_gcp(name, gcp_key=None, description=None)

Creates the GCP credentials.

Parameters:
namestr

the name to use for this set of credentials.

gcp_keystr | dict

the GCP key in json format or parsed as dict.

descriptionstr, optional

the description to use for this set of credentials.

Returns:
credentialCredential

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(name=None, description=None, **kwargs)

Update the credential values of an existing credential. Updates this object in place. :rtype: None

Added in version v3.2.

Parameters:
namestr

The name to use for this set of credentials.

descriptionstr, optional

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.

kwargsKeyword arguments specific to the given credential_type that should be updated.