Beispiel #1
0
def get_blob_service_connection(
    account_name=None,
    account_key=None,
    connection_string=None,
    context_path: Optional[str] = None,
):
    account_name = account_name or get_account_name(context_path=context_path)
    account_key = account_key or get_account_key(context_path=context_path)
    connection_string = connection_string or get_connection_string(
        context_path=context_path
    )
    if connection_string:
        return BlobServiceClient.from_connection_string(
            conn_str=connection_string,
            credential=account_key,
        )
    if account_name:
        return BlobServiceClient(
            account_url="https://{account}.blob.core.windows.net".format(
                account=account_name
            ),
            credential=account_key,
        )
    raise PolyaxonConnectionError(
        "Azure blob service connection requires an account name or a connection string"
    )
Beispiel #2
0
def get_blob_service_connection(
    account_name=None,
    account_key=None,
    connection_string=None,
    context_path: Optional[str] = None,
):
    account_name = account_name or get_account_name(context_path=context_path)
    account_key = account_key or get_account_key(context_path=context_path)
    connection_string = connection_string or get_connection_string(
        context_path=context_path)
    return BlockBlobService(
        account_name=account_name,
        account_key=account_key,
        connection_string=connection_string,
    )