ds_provider_azure_py_lib.linked_service.storage_account

File: storage_account.py Region: ds_provider_azure_py_lib/linked_service/storage_account

Azure Linked Service

This module implements a linked service for Azure Storage services (Blob and Table). Example: >>>linked_service = AzureLinkedService( … settings=AzureLinkedServiceSettings( … account_name=”account name”, … access_key=”account key”, … ), … id=uuid.uuid4(), … name=”testazurepackage”, … version=”0.0.1”, … description=”testazurepackage” … )

Attributes

logger

AzureLinkedServiceSettingsType

Classes

AzureLinkedServiceSettings

The object containing the Azure linked service settings.

AzureLinkedServiceConnection

The object containing the Azure linked service connection clients.

AzureLinkedService

Linked service for connecting to AzureLinkedService.

Module Contents

ds_provider_azure_py_lib.linked_service.storage_account.logger
class ds_provider_azure_py_lib.linked_service.storage_account.AzureLinkedServiceSettings[source]

Bases: ds_resource_plugin_py_lib.common.resource.linked_service.LinkedServiceSettings

The object containing the Azure linked service settings.

account_name: str
access_key: str
ds_provider_azure_py_lib.linked_service.storage_account.AzureLinkedServiceSettingsType
class ds_provider_azure_py_lib.linked_service.storage_account.AzureLinkedServiceConnection[source]

The object containing the Azure linked service connection clients.

blob_service_client: azure.storage.blob.BlobServiceClient
table_service_client: azure.data.tables.TableServiceClient
class ds_provider_azure_py_lib.linked_service.storage_account.AzureLinkedService[source]

Bases: ds_resource_plugin_py_lib.common.resource.linked_service.LinkedService[AzureLinkedServiceSettingsType], Generic[AzureLinkedServiceSettingsType]

Linked service for connecting to AzureLinkedService.

settings: AzureLinkedServiceSettingsType
_blob_service_client: azure.storage.blob.BlobServiceClient | None = None
_table_service_client: azure.data.tables.TableServiceClient | None = None
_credential: azure.core.credentials.AzureNamedKeyCredential | None = None
check_settings_is_set() None[source]

Check if settings are set correctly.

Returns:

None

Raises:

AttributeError – If settings are not set correctly.

property type: ds_provider_azure_py_lib.enums.ResourceType

Get the type of the linked service.

Returns:

ResourceType

property connection: AzureLinkedServiceConnection

Get the connection object for Azure StorageAccount.

Returns:

AzureLinkedServiceConnection

property blob_service_client: azure.storage.blob.BlobServiceClient

Get the BlobServiceClient instance.

Returns:

BlobServiceClient

Raises:

ConnectionError – If blob service client is not connected.

property table_service_client: azure.data.tables.TableServiceClient

Get the TableServiceClient instance.

Returns:

TableServiceClient

Raises:

ConnectionError – If table service client is not connected.

get_blob_service() azure.storage.blob.BlobServiceClient[source]

Connect to Azure Blob StorageAccount.

Returns:

BlobServiceClient

get_table_service() azure.data.tables.TableServiceClient[source]

Connect to Azure Table StorageAccount.

Returns:

TableServiceClient

connect() None[source]

Connect to Azure Storage (Blob and Table), ensuring both service clients are initialized.

Returns:

None

test_connection() tuple[bool, str][source]

Test the connection to Azure Storage (Blob or Table).

Returns:

tuple[bool, str]

close() None[source]

No need to close the linked service. Just to comply with the interface.

Returns:

None

__enter__() AzureLinkedService[AzureLinkedServiceSettingsType][source]

Enter context manager.

Returns:

Returns self for use in with statement.

Return type:

AzureLinkedService

__exit__(exc_type: object, exc_val: object, exc_tb: object) None[source]

Exit context manager and close the connection.

Parameters:
  • exc_type – Exception type if an exception occurred.

  • exc_val – Exception value if an exception occurred.

  • exc_tb – Exception traceback if an exception occurred.

Returns:

None