def create_storage_clients(): # type: (None) -> tuple """Create storage clients :rtype: tuple :return: blob_client, table_client, queue_client """ account_name = storage.get_storageaccount() account_key = storage.get_storageaccount_key() endpoint_suffix = storage.get_storageaccount_endpoint() blob_client = azureblob.BlockBlobService( account_name=account_name, account_key=account_key, endpoint_suffix=endpoint_suffix, ) table_client = azuretable.TableService( account_name=account_name, account_key=account_key, endpoint_suffix=endpoint_suffix, ) queue_client = azurequeue.QueueService( account_name=account_name, account_key=account_key, endpoint_suffix=endpoint_suffix, ) return blob_client, table_client, queue_client
def create_storage_clients(): # type: (None) -> tuple """Create storage clients :rtype: tuple :return: blob_client, table_client, queue_client """ account_name = storage.get_storageaccount() account_key = storage.get_storageaccount_key() if account_key is None: raise RuntimeError( 'No storage account key provided for storage account {}. If ' 'accessing via AAD, ensure that a subscription id is specified ' 'under management in the credentials configuration.'.format( account_name)) endpoint_suffix = storage.get_storageaccount_endpoint() blob_client = azureblob.BlockBlobService( account_name=account_name, account_key=account_key, endpoint_suffix=endpoint_suffix, ) table_client = azuretable.TableService( account_name=account_name, account_key=account_key, endpoint_suffix=endpoint_suffix, ) queue_client = azurequeue.QueueService( account_name=account_name, account_key=account_key, endpoint_suffix=endpoint_suffix, ) return blob_client, table_client, queue_client
def _create_credentials() -> azuretable.TableService: """Create storage credentials :rtype: azure.cosmosdb.table.TableService :return: azure storage table client """ sa, ep, sakey = os.environ['SHIPYARD_STORAGE_ENV'].split(':') table_client = azuretable.TableService(account_name=sa, account_key=sakey, endpoint_suffix=ep) return table_client
def _create_credentials() -> tuple: """Create storage credentials :rtype: tuple :return: (blob_client, table_client) """ sa, ep, sakey = os.environ['SHIPYARD_STORAGE_ENV'].split(':') blob_client = azureblob.BlockBlobService(account_name=sa, account_key=sakey, endpoint_suffix=ep) table_client = azuretable.TableService(account_name=sa, account_key=sakey, endpoint_suffix=ep) return blob_client, table_client
def _create_credentials(config: dict) -> azuretable.TableService: """Create authenticated clients :param dict config: configuration dict :rtype: azure.cosmosdb.table.TableService :return: table client """ global _PARTITION_KEY, _TABLE_NAME _PARTITION_KEY = '{}${}'.format(config['credentials']['batch']['account'], config['pool_specification']['id']) try: sep = config['batch_shipyard']['storage_entity_prefix'] if sep is None or len(sep) == 0: raise KeyError() except KeyError: sep = 'shipyard' _TABLE_NAME = sep + 'perf' ssel = config['batch_shipyard']['storage_account_settings'] table_client = azuretable.TableService( account_name=config['credentials']['storage'][ssel]['account'], account_key=config['credentials']['storage'][ssel]['account_key'], endpoint_suffix=config['credentials']['storage'][ssel]['endpoint']) return table_client