credentials
client.credentials
TileDB Credentials.
Classes
| Name | Description |
|---|---|
| CredentialsError | Raised when credentials can not be accessed. |
CredentialsError
client.credentials.CredentialsError()Raised when credentials can not be accessed.
Functions
| Name | Description |
|---|---|
| create_credential | Create a credential stored by name. |
| delete_credential | Delete a credential by name. |
| get_credential | Get a credential by name. |
| list_credentials | List credentials. |
| update_credential | Update a credential by name. |
| verify_credential | Verify a credential stored by name. |
create_credential
client.credentials.create_credential(
name,
provider,
*,
teamspace=None,
provider_default=None,
allowed_in_tasks=None,
credential=None,
role=None,
token=None,
)Create a credential stored by name.
Note that credential, role, and token are mutually exclusive, and that credential parameters are not verified during creation.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| name | str | A unique short name for the credential. | required |
| provider | CloudProvider | Cloud provider short name. | required |
| teamspace | TeamspaceLike | The teamspace to which the credential will be saved, specified by object or id. Omit this parameter to create a workspace credential. | None |
| provider_default | bool | Whether the credential is to be the default for its cloud provider. Default: False. | None |
| allowed_in_tasks | bool | Whether the credential is allowed to be used in tasks. Default: False. | None |
| credential | Credential | A credential object using keys. | None |
| role | AccessCredentialRole | A credential object using a provider role. | None |
| token | Token | A credential object using a provider token. | None |
Raises
| Name | Type | Description |
|---|---|---|
| CredentialsError | If the credential can not be created. |
Examples
>>> create_credential(
... "cred1",
... "AWS",
... teamspace="teamspace1",
... role=AccessCredentialRole(
... aws=AWSRole(
... role_arn="arn:aws:iam::123456789012:role/demo",
... external_id="123ABC"
... )
... )
... )delete_credential
client.credentials.delete_credential(name, *, teamspace=None)Delete a credential by name.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| name | str | Name of the credential. | required |
| teamspace | TeamspaceLike | The teamspace of the credential. Omit this parameter to specify a workspace credential. | None |
Raises
| Name | Type | Description |
|---|---|---|
| CredentialsError | If the credential can not be deleted. |
get_credential
client.credentials.get_credential(name, *, teamspace=None)Get a credential by name.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| name | str | Name of the credential. | required |
| teamspace | TeamspaceLike | The teamspace of the credential. Omit this parameter to specify a workspace credential. | None |
Returns
| Name | Type | Description |
|---|---|---|
| AccessCredential |
Raises
| Name | Type | Description |
|---|---|---|
| CredentialsError | If the credential can not be retrieved. |
Examples
>>> cred = get_credential("cred1", teamspace="teamspace1")
>>> cred.role.aws.role_arn
'arn:aws:iam::123456789012:role/demo'list_credentials
client.credentials.list_credentials(teamspace=None, page=1, per_page=None)List credentials.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| teamspace | TeamspaceLike | The teamspace of the storage settings, specified by object or id. Omit this parameter to list workspace storage settings. | None |
| page | int | Which page of results to retrieve. 1-based. | 1 |
| per_page | int | How many results to include on each page. | None |
Returns
| Name | Type | Description |
|---|---|---|
| Pager for AccessCredentials |
Raises
| Name | Type | Description |
|---|---|---|
| CredentialsError | Raised when access credentials can not be listed. |
Examples
>>> for cred in list_credentials(teamspace="teamspace1"):
... print(cred.name)
...
cred1update_credential
client.credentials.update_credential(
cred_name,
*,
teamspace=None,
name=None,
provider_default=None,
provider=None,
allowed_in_tasks=None,
credential=None,
role=None,
token=None,
)Update a credential by name.
Renaming or otherwise modifying a credential may impact programs that rely upon it.
Note that credential, role, and token are mutually exclusive.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| cred_name | str | Name of the credential. | required |
| teamspace | TeamspaceLike | The teamspace in which the credential is registered, specified by object or id. Omit this parameter to choose a workspace credential. | None |
| name | str | New name for the credential. | None |
| provider_default | bool | Toggle whether the credential is to be the default for its cloud provider. | None |
| provider | CloudProvider | Change the cloud provider name. | None |
| allowed_in_tasks | bool | Toggle whether the credential is allowed to be used in tasks. | None |
| credential | Credential | Change the credential’s keys. | None |
| role | AccessCredentialRole | Change the role of the credential. | None |
| token | Token | Change the credential’s token. | None |
Raises
| Name | Type | Description |
|---|---|---|
| CredentialsError | If the credential can not be updated. |
Examples
>>> update_credential(
... "cred1",
... teamspace="teamspace1",
... credential=Credential(
... AWSCredential(
... access_key_id="AWS_ACCESS_KEY_ID",
... secret_access_key="AWS_SECRET_ACCESS_KEY",
... )
... )
... )Updates the keys of the AWS credential named “cred1” in teamspace1.
verify_credential
client.credentials.verify_credential(
name,
provider,
*,
teamspace=None,
provider_default=None,
allowed_in_tasks=None,
credential=None,
role=None,
token=None,
)Verify a credential stored by name.
Verification of credentials is mostly structural; existence and consistency of object attributes are checked. In the case of credentials based on AWS roles (see the role parameter below), stricter verification is performed.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| name | str | A unique short name for the credential. | required |
| provider | CloudProvider | Cloud provider short name. | required |
| teamspace | TeamspaceLike | The teamspace of the credential, specified by object or id. Omit this parameter to specify a workspace credential. | None |
| provider_default | bool | Whether the credential is to be the default for its cloud provider. Default: False. | None |
| allowed_in_tasks | bool | Whether the credential is allowed to be used in tasks. Default: False. | None |
| credential | Credential | A credential object using keys. | None |
| role | AccessCredentialRole | A credential object using a provider role. | None |
| token | Token | A credential object using a provider token. | None |
Raises
| Name | Type | Description |
|---|---|---|
| CredentialsError | If the credential parameters do not meet server requirements. |
Examples
>>> verify_credential(
... "cred1",
... "AWS",
... teamspace="teamspace1",
... role=AccessCredentialRole(
... aws=AWSRole(
... role_arn="arn:aws:iam::123456789012:role/demo",
... external_id="123ABC"
... )
... )
... )