Example #1
0
def remove_entry_for_resource(subscription_id, row_keys, table_service):
    batch = TableBatch()

    for row_key in row_keys:
        batch.delete_entity(subscription_id, row_key)

    table_service.commit_batch(REQUIRED_TAGS_TABLE_NAME, batch)
Example #2
0
def update_table_storage_based_on_new_data(subscription_id,
                                           non_compliant_resources,
                                           non_compliant_ids_to_add,
                                           non_compliant_ids_to_delete,
                                           table_service):
    """
    Makes a batch update by adding / deleting rows from the table storage
    """
    batch = TableBatch()

    for ncr in non_compliant_resources:
        if ncr['RowKey'] in non_compliant_ids_to_add:
            batch.insert_entity(ncr)

    for row_key in non_compliant_ids_to_delete:
        batch.delete_entity(subscription_id, row_key)

    table_service.commit_batch(RECOMMENDATIONS_TABLE_NAME, batch)