Exemplo n.º 1
0
def create_storage_clients():
    # type: (None) -> tuple
    """Create storage clients
    :rtype: tuple
    :return: blob_client, queue_client, table_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,
    )
    queue_client = azurequeue.QueueService(
        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,
    )
    return blob_client, queue_client, table_client
def _create_credentials() -> azuretable.TableService:
    """Create storage credentials
    :rtype: azure.storage.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
Exemplo n.º 3
0
def _create_credentials() -> azure.storage.table.TableService:
    """Create storage credentials
    :rtype: azure.storage.table.TableService
    :return: table client
    """
    global _CASCADE_STORAGEACCOUNT
    _CASCADE_STORAGEACCOUNT, ep, sakey = os.environ[
        'CASCADE_STORAGE_ENV'].split(':')
    table_client = azuretable.TableService(
        account_name=_CASCADE_STORAGEACCOUNT,
        account_key=sakey,
        endpoint_suffix=ep)
    return table_client
Exemplo n.º 4
0
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
Exemplo n.º 5
0
def create_clients():
    # type: (None) -> tuple
    """Create storage clients
    :rtype: tuple
    :return: blob_client, queue_client, table_client
    """
    blob_client = azureblob.BlockBlobService(account_name=_STORAGEACCOUNT,
                                             account_key=_STORAGEACCOUNTKEY,
                                             endpoint_suffix=_STORAGEACCOUNTEP)
    queue_client = azurequeue.QueueService(account_name=_STORAGEACCOUNT,
                                           account_key=_STORAGEACCOUNTKEY,
                                           endpoint_suffix=_STORAGEACCOUNTEP)
    table_client = azuretable.TableService(account_name=_STORAGEACCOUNT,
                                           account_key=_STORAGEACCOUNTKEY,
                                           endpoint_suffix=_STORAGEACCOUNTEP)
    return blob_client, queue_client, table_client
Exemplo n.º 6
0
def _create_credentials(config: dict) -> azuretable.TableService:
    """Create authenticated clients
    :param dict config: configuration dict
    :rtype: azure.storage.table.TableService
    :return: table client
    """
    global _PARTITION_KEY, _TABLE_NAME
    _PARTITION_KEY = '{}${}'.format(
        config['credentials']['batch']['account'],
        config['pool_specification']['id'])
    _TABLE_NAME = config['batch_shipyard']['storage_entity_prefix'] + '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
Exemplo n.º 7
0
    def __init__(self, config):
        self.config = config
        self.config["_auto_confirm"] = False

        self.batch_client = self._get_batch_client(
            config['credentials']['batch'])
        self.batch_client.config.add_user_agent(
            'batch-shipyard/{}'.format('2.0.0rc2'))

        config_storage_credentials = \
            config['credentials']['storage']['__storage_account_name__']

        parameters = {
            'account_name': config_storage_credentials['account'],
            'account_key': config_storage_credentials['account_key'],
            'endpoint_suffix': config_storage_credentials['endpoint']
        }

        self.blob_client = azure_storage_blob.BlockBlobService(**parameters)
        self.queue_client = azure_storage_queue.QueueService(**parameters)
        self.table_client = azure_storage_table.TableService(**parameters)
Exemplo n.º 8
0
 def tearDownClass(cls):
     s = table.TableService(connection_string=cls._azure_webjobs_storage)
     s.delete_table(cls.TestTableName)
Exemplo n.º 9
0
 def setUpClass(cls):
     super().setUpClass()
     service = table.TableService(
         connection_string=cls._azure_webjobs_storage)
     service.create_table(cls.TestTableName)
Exemplo n.º 10
0
 def __init__(self, table_name: str):
     super().__init__()
     self._service = table.TableService(
         connection_string=self._connection_string)
     self._table_name = table_name