a.storage_credentials
: Account Storage Credentials¶
- class databricks.sdk.service.catalog.AccountStorageCredentialsAPI¶
These APIs manage storage credentials for a particular metastore.
- create(metastore_id: str [, credential_info: Optional[CreateStorageCredential]]) AccountsStorageCredentialInfo ¶
Usage:
import os import time from databricks.sdk import WorkspaceClient from databricks.sdk.service import catalog w = WorkspaceClient() created = w.storage_credentials.create( name=f'sdk-{time.time_ns()}', aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) # cleanup w.storage_credentials.delete(delete=created.name)
Create a storage credential.
Creates a new storage credential. The request object is specific to the cloud:
AwsIamRole for AWS credentials * AzureServicePrincipal for Azure credentials *
GcpServiceAcountKey for GCP credentials.
The caller must be a metastore admin and have the CREATE_STORAGE_CREDENTIAL privilege on the metastore.
- Parameters:
metastore_id – str Unity Catalog metastore ID
credential_info –
CreateStorageCredential
(optional)
- Returns:
- delete(metastore_id: str, storage_credential_name: str [, force: Optional[bool]])¶
Delete a storage credential.
Deletes a storage credential from the metastore. The caller must be an owner of the storage credential.
- Parameters:
metastore_id – str Unity Catalog metastore ID
storage_credential_name – str Name of the storage credential.
force – bool (optional) Force deletion even if the Storage Credential is not empty. Default is false.
- get(metastore_id: str, storage_credential_name: str) AccountsStorageCredentialInfo ¶
Usage:
import os import time from databricks.sdk import WorkspaceClient from databricks.sdk.service import catalog w = WorkspaceClient() created = w.storage_credentials.create( name=f'sdk-{time.time_ns()}', aws_iam_role=catalog.AwsIamRoleRequest(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) by_name = w.storage_credentials.get(name=created.name) # cleanup w.storage_credentials.delete(name=created.name)
Gets the named storage credential.
Gets a storage credential from the metastore. The caller must be a metastore admin, the owner of the storage credential, or have a level of privilege on the storage credential.
- Parameters:
metastore_id – str Unity Catalog metastore ID
storage_credential_name – str Name of the storage credential.
- Returns:
- list(metastore_id: str) Iterator[StorageCredentialInfo] ¶
Usage:
from databricks.sdk import WorkspaceClient w = WorkspaceClient() all = w.storage_credentials.list()
Get all storage credentials assigned to a metastore.
Gets a list of all storage credentials that have been assigned to given metastore.
- Parameters:
metastore_id – str Unity Catalog metastore ID
- Returns:
Iterator over
StorageCredentialInfo
- update(metastore_id: str, storage_credential_name: str [, credential_info: Optional[UpdateStorageCredential]]) AccountsStorageCredentialInfo ¶
Usage:
import os import time from databricks.sdk import WorkspaceClient from databricks.sdk.service import catalog w = WorkspaceClient() created = w.storage_credentials.create( name=f'sdk-{time.time_ns()}', aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) _ = w.storage_credentials.update( name=created.name, comment=f'sdk-{time.time_ns()}', aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) # cleanup w.storage_credentials.delete(delete=created.name)
Updates a storage credential.
Updates a storage credential on the metastore. The caller must be the owner of the storage credential. If the caller is a metastore admin, only the __owner__ credential can be changed.
- Parameters:
metastore_id – str Unity Catalog metastore ID
storage_credential_name – str Name of the storage credential.
credential_info –
UpdateStorageCredential
(optional)
- Returns: