From 48a813342e74e02b2a291201277b93cbd164c13f Mon Sep 17 00:00:00 2001 From: LibbaLawrence <46537478+LibbaLawrence@users.noreply.github.com> Date: Thu, 30 Jul 2020 16:06:49 -0400 Subject: [PATCH] [Tables] Azure Data Tables SDK, sync and async code (#12766) * updated design of update and upsert methods * fixed upsert/update * reflected change to create_entity * fixed problems with upsert function * fixed upsert/update functions on async clients * pausing on tests * fixed test failing on HttpResponse * fixing 2.7 errorZ * trying to fix 2.7 * fixed tests * removed problem with unbpund fucntion * track 1 async sdk * renamed aio to _aio * updating comments * tweaking comments and types for stub gen * fixed pylint issue * fixed list_tables to query_tables * pylint errors * fixing type errors * updating samples * fixing comments * updating README * fixing PR comments on keyword and credential * editing order of docstrings * fixing queue comments * fixing queue comments * delete table has no return response * changing types to model types * added keys to dictionary * changing types to model types * fixed stroage reference * fixing docstring reutrn * fixed cathc and raise same error * UpdateMode in init * obj to _ * fixing comments * fixed metadata return * fixed comments * fixing test error * fixed depedncies * fixing type * fixing stubgen error * changed to ivar * fixing type error * editing samples/ fixing pylint * reformatted service client sampels * added more official samples * added in teh create and delete table in table client * working on client samples * linked README to samples * TODO for return types * changed query entity to get entity * edited README * made UpdateMode into an enum * changed return type of cont token to dict * fixed readme common uses * todos created * fixed continuation token to a dictionary * fixed continuation error * changed query to individual entries * editing README pr comments * removed AAD from readme * removed TODO * getting rid of exposed secret * added design updates to async client * stahs * fixed import * fixed init file * fixed import * added todo for table * added return type * editing table client return * changed table name for table standards (Sean fix) * editing sas methods * work in progress - fixing pre api review comments * updated tests to work with fixes * re-running tests for verification' * fixed small errors with changing method names * fixed storgae_process_error -> table instead of storage, created metadata tag on entity instead of returning etag as part of entity * made metadata for entities separate from entity itself (see _entity.py) * updated readme and added regex check for table names on TableClient and TableServiceClient * oops forgot to import re in the _table_client.py * metadata test passing * fixed unimported entity * added user defined filter option with parameters * added user defined filter option with parameters * changed the regex test to match to fit with python2 * fixed linting issues thrown by pylint * re-ran test * updating samples part 1 * updating asserts part 2 * removing references to common * fixing sas on sample * fixing import statement * attempting to fix dateutil error * trying to fix enum in entity property * fix #2 dateutil * attempting to fix dateutil error * fixing test import * remove unuse import * added tests for table_client and table_service_client * adding live recordings * fix #2 dateutil * updated dev_requirements, changed test name * py 2.7 doesnt have timezone - siwtch to UTC * reverting back to libbas recordings * reverting to using tzutc -- for now * updating samples a little with error printing * replicated tzutc class with class Timezone * forgot to create table twice for error * changed regex to fxn in _error.py, added second assertion to tests, updated readme * updating samples to reflect sdk part 1 * commented out cryptogrpahy from encryption test * removed commented out code and changed the invalid table name * updating docstrings * 'commented out references to cryptography * commented out pylint errors related to encryption * updated delete entity to show etag * still finding encryption * removed list froma round itempaged * commenting out test * commented out tests * fixed enum on edmtype * updated update entity * fixing apiview comments on sas * added table name to table clinet * changing ItemPaged to ItemPaged[str[ * changing properties to private * changes form apiview archboard pre meeting * added filter type * TODO on from_string in SAS, fixed error in table querying ItemPaged return * changed name to _primary_hostname not primay_hopstname * oops missed the other hostname * oops missed the other other hostname * added a client base for tableclient and tableserviceclient, passes all tests as is for sync code * fixed TODO on sas * changes to satisfy linter * tweaking delete * moved account parsing to the base class, fixed more linting issues * resolved comments * updating samples * updating updatemode * updating UpdateMode * importing typing for union * initial commit for diff * change to REPLACE' * initial commit for pulling down current async status, ran a tests live for updated yaml files * renamed entity tableentity * allowed select to be array or str * made Table class * renamed a new directory for azure-data-tables * removing storgae reference * changed query 'r' to read * removing some commented out code * updating delete/create table comments * docstring return type for table * bullet point auth * base work for async models, working on passing last few tests, added _models for async entities * removing packages to exclude * fixing README * adding to the blurb in the readme from the archboard pwpt * passing most async tests, issues with list_tables query_options currently * fixing blank line * making nspkg for data * removed async * changed to relative imports * :had to update naming * stahs * stahs * had to fix list and query tables * build mad about version * changed version to match 1.0.0 * changed how results_per_page is passed in, need to verify with Libba and change up sync code if we are correct * forgot and init file - path was being skipped in build * changing list and query to align with new api view * passing the list_tables_with_num_results again * passes tests when run locally, does not pass in live-mode. the behavior of results_per_page combined with by_page() is still slightly confusing * fixed test back * hand to change query to list tables * temp fix on README error * had to change msrest version * fixing pylint error * Update README.md * ignorning nspkg readme * addressed Libbas comments * regenerated code * fixed Krista comments on readmes * fixing Krista comments * fixed anna's changes * addressed all of izzys comments * removing unsued import * fixing merge errors * fixing docstrings * fixewd docstring * fixing docstrings * fixing docs * verifying tests work: * verifying tests' * fixed sync for parameters * fixed async clients parameters * fixing error for mode * fixing pylint errors * re running tests * added more tests * fixing models for tests * fixed init * had to fix fomratting of async docstring types * deleting stubgens * fixing references to storage, and tokens * working to refactor mentions of storage * making links to cosmos * changed naming of header for changelog * added azure data init to include * fixed exposed model * fixed return of create table to be Table object * fixed return of create table to be Table object * updated docstring * added try catch to code calls * fixed exposed model * working on fixing error handling: * not overriding etag * fixed table entity metadata * editing table object * fixing sas protocol * remvoed tables from aio model * removing identity * adding comment to install requirement * changing docstrings for edm type - making an issue to infer * fixing pylint errro * fixing readme * fixed tests for metadata * removing links from REAMDE * fixing broken link * fixing pylint * trying to fix bandit fail * trying to fix bandit fail * oops forget to disable bandit check * adding back md5 with nosec Co-authored-by: Sean Kane Co-authored-by: Sean Kane <68240067+seankane-msft@users.noreply.github.com> --- eng/.docsettings.yml | 1 + sdk/tables/azure-data-nspkg/MANIFEST.in | 3 + sdk/tables/azure-data-nspkg/README.md | 11 + sdk/tables/azure-data-nspkg/azure/__init__.py | 1 + .../azure-data-nspkg/azure/data/__init__.py | 1 + sdk/tables/azure-data-nspkg/setup.cfg | 2 + sdk/tables/azure-data-nspkg/setup.py | 45 + sdk/tables/azure-data-tables/CHANGELOG.md | 6 + sdk/tables/azure-data-tables/MANIFEST.in | 6 + sdk/tables/azure-data-tables/README.md | 299 +++ .../azure-data-tables/azure/__init__.py | 1 + .../azure-data-tables/azure/data/__init__.py | 1 + .../azure/data/tables/__init__.py | 54 + .../azure/data/tables/_deserialize.py | 176 ++ .../azure/data/tables/_entity.py | 119 ++ .../azure/data/tables/_generated/__init__.py | 14 + .../data/tables/_generated/_azure_table.py | 64 + .../data/tables/_generated/_configuration.py | 55 + .../data/tables/_generated/aio/__init__.py | 10 + .../_generated/aio/_azure_table_async.py | 56 + .../_generated/aio/_configuration_async.py | 49 + .../aio/operations_async/__init__.py | 13 + .../_service_operations_async.py | 246 +++ .../_table_operations_async.py | 1043 ++++++++++ .../data/tables/_generated/models/__init__.py | 68 + .../_generated/models/_azure_table_enums.py | 26 + .../data/tables/_generated/models/_models.py | 539 +++++ .../tables/_generated/models/_models_py3.py | 607 ++++++ .../tables/_generated/operations/__init__.py | 13 + .../operations/_service_operations.py | 253 +++ .../operations/_table_operations.py | 1058 ++++++++++ .../azure/data/tables/_generated/py.typed | 1 + .../azure/data/tables/_generated/version.py | 13 + .../azure/data/tables/_models.py | 499 +++++ .../azure/data/tables/_serialize.py | 217 +++ .../azure/data/tables/_shared/__init__.py | 56 + .../data/tables/_shared/_common_conversion.py | 107 + .../azure/data/tables/_shared/_constants.py | 51 + .../azure/data/tables/_shared/_error.py | 230 +++ .../data/tables/_shared/_table_client_base.py | 98 + .../_shared/_table_service_client_base.py | 75 + .../data/tables/_shared/authentication.py | 138 ++ .../azure/data/tables/_shared/base_client.py | 434 +++++ .../data/tables/_shared/base_client_async.py | 174 ++ .../azure/data/tables/_shared/constants.py | 26 + .../azure/data/tables/_shared/models.py | 350 ++++ .../azure/data/tables/_shared/parser.py | 20 + .../azure/data/tables/_shared/policies.py | 628 ++++++ .../data/tables/_shared/policies_async.py | 221 +++ .../data/tables/_shared/request_handlers.py | 147 ++ .../data/tables/_shared/response_handlers.py | 159 ++ .../tables/_shared/shared_access_signature.py | 243 +++ .../_shared/table_shared_access_signature.py | 298 +++ .../azure/data/tables/_table_client.py | 471 +++++ .../data/tables/_table_service_client.py | 264 +++ .../azure/data/tables/_version.py | 7 + .../azure/data/tables/aio/__init__.py | 13 + .../azure/data/tables/aio/_models.py | 104 + .../data/tables/aio/_table_client_async.py | 407 ++++ .../tables/aio/_table_service_client_async.py | 293 +++ .../azure/data/tables/py.typed | 1 + .../azure-data-tables/dev_requirements.txt | 6 + sdk/tables/azure-data-tables/mypy.ini | 13 + .../samples/create_query_entities.py | 30 + .../samples/creation_deletion_of_table.py | 61 + .../samples/inserting_deleting_entities.py | 58 + .../samples/querying_table.py | 25 + .../samples/table_exists_error_handling.py | 24 + .../samples/table_samples_authentication.py | 88 + .../samples/table_samples_client.py | 212 ++ .../samples/table_samples_service.py | 114 ++ .../samples/update_entity.py | 36 + sdk/tables/azure-data-tables/setup.cfg | 2 + sdk/tables/azure-data-tables/setup.py | 84 + .../tests/_shared/__init__.py | 0 .../tests/_shared/asynctestcase.py | 56 + .../tests/_shared/testcase.py | 442 +++++ .../azure-data-tables/tests/conftest.py | 40 + .../tests/encryption_test_helper.py | 90 + .../test_table.test_account_sas.yaml | 224 +++ .../test_table.test_create_table.yaml | 90 + ...table.test_create_table_fail_on_exist.yaml | 137 ++ ...test_delete_table_with_existing_table.yaml | 90 + ...ith_non_existing_table_fail_not_exist.yaml | 49 + .../test_table.test_get_table_acl.yaml | 127 ++ .../test_table.test_list_tables.yaml | 132 ++ ...st_table.test_list_tables_with_filter.yaml | 132 ++ ...st_table.test_list_tables_with_marker.yaml | 282 +++ ...ble.test_list_tables_with_num_results.yaml | 280 +++ .../test_table.test_query_tables.yaml | 132 ++ ...t_table.test_query_tables_with_filter.yaml | 132 ++ ...t_table.test_query_tables_with_marker.yaml | 282 +++ ...le.test_query_tables_with_num_results.yaml | 280 +++ ...table.test_set_table_acl_too_many_ids.yaml | 90 + ...able_acl_with_empty_signed_identifier.yaml | 166 ++ ...ble_acl_with_empty_signed_identifiers.yaml | 165 ++ ...set_table_acl_with_signed_identifiers.yaml | 166 ++ .../test_table_async.test_account_sas.yaml | 165 ++ .../test_table_async.test_create_table.yaml | 66 + ...async.test_create_table_fail_on_exist.yaml | 103 + ...test_delete_table_with_existing_table.yaml | 66 + ...ith_non_existing_table_fail_not_exist.yaml | 35 + .../test_table_async.test_get_table_acl.yaml | 95 + .../test_table_async.test_list_tables.yaml | 71 + ...le_async.test_list_tables_with_filter.yaml | 39 + ...le_async.test_list_tables_with_marker.yaml | 214 ++ ...ync.test_list_tables_with_num_results.yaml | 247 +++ ...e_async.test_query_tables_with_filter.yaml | 98 + ...async.test_set_table_acl_too_many_ids.yaml | 66 + ...ble_acl_with_empty_signed_identifiers.yaml | 124 ++ ...set_table_acl_with_signed_identifiers.yaml | 127 ++ ...t.test_request_callback_signed_header.yaml | 114 ++ ...t_table_client.test_response_callback.yaml | 39 + ...t_table_client.test_user_agent_append.yaml | 56 + ...t_table_client.test_user_agent_custom.yaml | 87 + ..._table_client.test_user_agent_default.yaml | 44 + ...ble_entity.test_binary_property_value.yaml | 185 ++ .../test_table_entity.test_delete_entity.yaml | 233 +++ ...ntity.test_delete_entity_not_existing.yaml | 141 ++ ...st_delete_entity_with_if_doesnt_match.yaml | 197 ++ ...ty.test_delete_entity_with_if_matches.yaml | 233 +++ ....test_empty_and_spaces_property_value.yaml | 188 ++ .../test_table_entity.test_get_entity.yaml | 190 ++ ..._entity.test_get_entity_full_metadata.yaml | 190 ++ ...table_entity.test_get_entity_if_match.yaml | 234 +++ ...le_entity.test_get_entity_no_metadata.yaml | 190 ++ ...e_entity.test_get_entity_not_existing.yaml | 133 ++ ...able_entity.test_get_entity_with_hook.yaml | 190 ++ ...le_entity.test_get_entity_with_select.yaml | 250 +++ ....test_get_entity_with_special_doubles.yaml | 186 ++ ...le_entity.test_insert_entity_conflict.yaml | 199 ++ ..._entity.test_insert_entity_dictionary.yaml | 146 ++ ...ty.test_insert_entity_empty_string_pk.yaml | 140 ++ ...ty.test_insert_entity_empty_string_rk.yaml | 140 ++ ..._entity.test_insert_entity_missing_pk.yaml | 90 + ..._entity.test_insert_entity_missing_rk.yaml | 90 + ..._insert_entity_property_name_too_long.yaml | 138 ++ ...est_insert_entity_too_many_properties.yaml | 207 ++ ...test_insert_entity_with_full_metadata.yaml | 146 ++ ...e_entity.test_insert_entity_with_hook.yaml | 146 ++ ..._entity_with_large_int32_value_throws.yaml | 90 + ..._entity_with_large_int64_value_throws.yaml | 90 + ...y.test_insert_entity_with_no_metadata.yaml | 146 ++ .../test_table_entity.test_insert_etag.yaml | 150 ++ ..._or_merge_entity_with_existing_entity.yaml | 238 +++ ...merge_entity_with_non_existing_entity.yaml | 182 ++ ...r_replace_entity_with_existing_entity.yaml | 238 +++ ...place_entity_with_non_existing_entity.yaml | 182 ++ .../test_table_entity.test_merge_entity.yaml | 240 +++ ...entity.test_merge_entity_not_existing.yaml | 145 ++ ...est_merge_entity_with_if_doesnt_match.yaml | 201 ++ ...ity.test_merge_entity_with_if_matches.yaml | 240 +++ ...table_entity.test_none_property_value.yaml | 184 ++ ...ith_partition_key_having_single_quote.yaml | 376 ++++ ...test_table_entity.test_query_entities.yaml | 332 ++++ ...ity.test_query_entities_full_metadata.yaml | 332 ++++ ...ntity.test_query_entities_no_metadata.yaml | 332 ++++ ...ntity.test_query_entities_with_filter.yaml | 188 ++ ...ntity.test_query_entities_with_select.yaml | 332 ++++ ...e_entity.test_query_entities_with_top.yaml | 392 ++++ ...test_query_entities_with_top_and_next.yaml | 592 ++++++ ...t_table_entity.test_query_user_filter.yaml | 146 ++ ...table_entity.test_query_zero_entities.yaml | 220 +++ .../test_table_entity.test_sas_add.yaml | 190 ++ ...able_entity.test_sas_add_inside_range.yaml | 190 ++ ...ble_entity.test_sas_add_outside_range.yaml | 143 ++ .../test_table_entity.test_sas_delete.yaml | 233 +++ .../test_table_entity.test_sas_query.yaml | 188 ++ ...ble_entity.test_sas_signed_identifier.yaml | 228 +++ .../test_table_entity.test_sas_update.yaml | 240 +++ ...entity.test_sas_upper_case_table_name.yaml | 188 ++ .../test_table_entity.test_timezone.yaml | 245 +++ ...ble_entity.test_unicode_property_name.yaml | 234 +++ ...le_entity.test_unicode_property_value.yaml | 232 +++ .../test_table_entity.test_update_entity.yaml | 240 +++ ...ntity.test_update_entity_not_existing.yaml | 145 ++ ...st_update_entity_with_if_doesnt_match.yaml | 201 ++ ...ty.test_update_entity_with_if_matches.yaml | 240 +++ ...tity_async.test_binary_property_value.yaml | 138 ++ ...table_entity_async.test_delete_entity.yaml | 174 ++ ...async.test_delete_entity_not_existing.yaml | 103 + ...st_delete_entity_with_if_doesnt_match.yaml | 147 ++ ...nc.test_delete_entity_with_if_matches.yaml | 174 ++ ....test_empty_and_spaces_property_value.yaml | 141 ++ ...st_table_entity_async.test_get_entity.yaml | 143 ++ ...y_async.test_get_entity_full_metadata.yaml | 143 ++ ...entity_async.test_get_entity_if_match.yaml | 174 ++ ...ity_async.test_get_entity_no_metadata.yaml | 143 ++ ...ty_async.test_get_entity_not_existing.yaml | 99 + ...ntity_async.test_get_entity_with_hook.yaml | 143 ++ ...ity_async.test_get_entity_with_select.yaml | 110 ++ ....test_get_entity_with_special_doubles.yaml | 139 ++ ...ity_async.test_insert_entity_conflict.yaml | 153 ++ ...y_async.test_insert_entity_dictionary.yaml | 110 ++ ...nc.test_insert_entity_empty_string_pk.yaml | 104 + ...nc.test_insert_entity_empty_string_rk.yaml | 104 + ...y_async.test_insert_entity_missing_pk.yaml | 66 + ...y_async.test_insert_entity_missing_rk.yaml | 66 + ..._insert_entity_property_name_too_long.yaml | 104 + ...est_insert_entity_too_many_properties.yaml | 173 ++ ...test_insert_entity_with_full_metadata.yaml | 110 ++ ...ty_async.test_insert_entity_with_hook.yaml | 110 ++ ..._entity_with_large_int32_value_throws.yaml | 66 + ..._entity_with_large_int64_value_throws.yaml | 66 + ...c.test_insert_entity_with_no_metadata.yaml | 110 ++ ..._or_merge_entity_with_existing_entity.yaml | 179 ++ ...merge_entity_with_non_existing_entity.yaml | 135 ++ ...r_replace_entity_with_existing_entity.yaml | 179 ++ ...place_entity_with_non_existing_entity.yaml | 135 ++ ..._table_entity_async.test_merge_entity.yaml | 181 ++ ..._async.test_merge_entity_not_existing.yaml | 109 ++ ...est_merge_entity_with_if_doesnt_match.yaml | 153 ++ ...ync.test_merge_entity_with_if_matches.yaml | 181 ++ ...entity_async.test_none_property_value.yaml | 137 ++ ...ith_partition_key_having_single_quote.yaml | 151 ++ ...able_entity_async.test_query_entities.yaml | 250 +++ ...ync.test_query_entities_full_metadata.yaml | 250 +++ ...async.test_query_entities_no_metadata.yaml | 250 +++ ...async.test_query_entities_with_filter.yaml | 142 ++ ...async.test_query_entities_with_select.yaml | 250 +++ ...ty_async.test_query_entities_with_top.yaml | 328 ++++ ...test_query_entities_with_top_and_next.yaml | 450 +++++ ...entity_async.test_query_zero_entities.yaml | 162 ++ .../test_table_entity_async.test_sas_add.yaml | 143 ++ ...ntity_async.test_sas_add_inside_range.yaml | 143 ++ ...tity_async.test_sas_add_outside_range.yaml | 109 ++ ...st_table_entity_async.test_sas_delete.yaml | 174 ++ ...est_table_entity_async.test_sas_query.yaml | 142 ++ ...tity_async.test_sas_signed_identifier.yaml | 175 ++ ...st_table_entity_async.test_sas_update.yaml | 181 ++ ..._async.test_sas_upper_case_table_name.yaml | 142 ++ ...test_table_entity_async.test_timezone.yaml | 138 ++ ...tity_async.test_unicode_property_name.yaml | 176 ++ ...ity_async.test_unicode_property_value.yaml | 174 ++ ...table_entity_async.test_update_entity.yaml | 181 ++ ...async.test_update_entity_not_existing.yaml | 109 ++ ...st_update_entity_with_if_doesnt_match.yaml | 153 ++ ...nc.test_update_entity_with_if_matches.yaml | 181 ++ ...ce_properties.test_retention_too_long.yaml | 51 + ...able_service_properties.test_set_cors.yaml | 82 + ...vice_properties.test_set_hour_metrics.yaml | 81 + ...e_service_properties.test_set_logging.yaml | 81 + ...ce_properties.test_set_minute_metrics.yaml | 81 + ...perties.test_table_service_properties.yaml | 80 + ...e_properties.test_too_many_cors_rules.yaml | 57 + ...vice_stats.test_table_service_stats_f.yaml | 38 + ..._table_service_stats_when_unavailable.yaml | 38 + .../azure-data-tables/tests/test_table.py | 489 +++++ .../tests/test_table_async.py | 435 +++++ .../tests/test_table_batch.py | 646 ++++++ .../tests/test_table_client.py | 567 ++++++ .../tests/test_table_encryption.py | 977 ++++++++++ .../tests/test_table_entity.py | 1714 ++++++++++++++++ .../tests/test_table_entity_async.py | 1731 +++++++++++++++++ .../tests/test_table_service_properties.py | 262 +++ .../tests/test_table_service_stats.py | 81 + sdk/tables/ci.yml | 41 + sdk/tables/tests.yml | 39 + shared_requirements.txt | 3 +- 259 files changed, 46494 insertions(+), 1 deletion(-) create mode 100644 sdk/tables/azure-data-nspkg/MANIFEST.in create mode 100644 sdk/tables/azure-data-nspkg/README.md create mode 100644 sdk/tables/azure-data-nspkg/azure/__init__.py create mode 100644 sdk/tables/azure-data-nspkg/azure/data/__init__.py create mode 100644 sdk/tables/azure-data-nspkg/setup.cfg create mode 100644 sdk/tables/azure-data-nspkg/setup.py create mode 100644 sdk/tables/azure-data-tables/CHANGELOG.md create mode 100644 sdk/tables/azure-data-tables/MANIFEST.in create mode 100644 sdk/tables/azure-data-tables/README.md create mode 100644 sdk/tables/azure-data-tables/azure/__init__.py create mode 100644 sdk/tables/azure-data-tables/azure/data/__init__.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/__init__.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_entity.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/__init__.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/_azure_table.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/_configuration.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/__init__.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_azure_table_async.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_configuration_async.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/__init__.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_service_operations_async.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_table_operations_async.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/models/__init__.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_azure_table_enums.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models_py3.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/__init__.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_service_operations.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_table_operations.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/py.typed create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_generated/version.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_models.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_serialize.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/__init__.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/_common_conversion.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/_constants.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/_error.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/_table_client_base.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/_table_service_client_base.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/authentication.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/base_client.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/base_client_async.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/constants.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/models.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/parser.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/policies.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/policies_async.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/request_handlers.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/response_handlers.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/shared_access_signature.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_shared/table_shared_access_signature.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_table_client.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/_version.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/aio/__init__.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py create mode 100644 sdk/tables/azure-data-tables/azure/data/tables/py.typed create mode 100644 sdk/tables/azure-data-tables/dev_requirements.txt create mode 100644 sdk/tables/azure-data-tables/mypy.ini create mode 100644 sdk/tables/azure-data-tables/samples/create_query_entities.py create mode 100644 sdk/tables/azure-data-tables/samples/creation_deletion_of_table.py create mode 100644 sdk/tables/azure-data-tables/samples/inserting_deleting_entities.py create mode 100644 sdk/tables/azure-data-tables/samples/querying_table.py create mode 100644 sdk/tables/azure-data-tables/samples/table_exists_error_handling.py create mode 100644 sdk/tables/azure-data-tables/samples/table_samples_authentication.py create mode 100644 sdk/tables/azure-data-tables/samples/table_samples_client.py create mode 100644 sdk/tables/azure-data-tables/samples/table_samples_service.py create mode 100644 sdk/tables/azure-data-tables/samples/update_entity.py create mode 100644 sdk/tables/azure-data-tables/setup.cfg create mode 100644 sdk/tables/azure-data-tables/setup.py create mode 100644 sdk/tables/azure-data-tables/tests/_shared/__init__.py create mode 100644 sdk/tables/azure-data-tables/tests/_shared/asynctestcase.py create mode 100644 sdk/tables/azure-data-tables/tests/_shared/testcase.py create mode 100644 sdk/tables/azure-data-tables/tests/conftest.py create mode 100644 sdk/tables/azure-data-tables/tests/encryption_test_helper.py create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_account_sas.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_table.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_table_fail_on_exist.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_delete_table_with_existing_table.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_delete_table_with_non_existing_table_fail_not_exist.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_get_table_acl.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_filter.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_marker.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_num_results.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_filter.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_marker.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_num_results.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_too_many_ids.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifier.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifiers.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_signed_identifiers.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_account_sas.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_table.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_table_fail_on_exist.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_existing_table.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_non_existing_table_fail_not_exist.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_get_table_acl.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_filter.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_marker.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_num_results.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_query_tables_with_filter.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_too_many_ids.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_empty_signed_identifiers.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_signed_identifiers.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_request_callback_signed_header.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_response_callback.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_binary_property_value.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_not_existing.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_with_if_doesnt_match.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_with_if_matches.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_empty_and_spaces_property_value.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_full_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_no_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_not_existing.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_hook.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_special_doubles.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_conflict.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_dictionary.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_empty_string_pk.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_empty_string_rk.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_missing_pk.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_missing_rk.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_property_name_too_long.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_too_many_properties.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_full_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_hook.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_large_int32_value_throws.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_large_int64_value_throws.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_no_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_etag.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_merge_entity_with_existing_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_merge_entity_with_non_existing_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_replace_entity_with_existing_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_replace_entity_with_non_existing_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_not_existing.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_with_if_doesnt_match.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_with_if_matches.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_none_property_value.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_operations_on_entity_with_partition_key_having_single_quote.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_full_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_no_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_filter.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_select.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_top.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_top_and_next.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_user_filter.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_zero_entities.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add_inside_range.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add_outside_range.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_delete.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_query.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_signed_identifier.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_update.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_upper_case_table_name.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_timezone.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_unicode_property_name.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_unicode_property_value.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_not_existing.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_with_if_doesnt_match.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_with_if_matches.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_binary_property_value.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_not_existing.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_with_if_doesnt_match.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_with_if_matches.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_empty_and_spaces_property_value.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_full_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_no_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_not_existing.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_hook.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_select.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_special_doubles.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_conflict.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_dictionary.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_empty_string_pk.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_empty_string_rk.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_missing_pk.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_missing_rk.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_property_name_too_long.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_too_many_properties.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_full_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_hook.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_large_int32_value_throws.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_large_int64_value_throws.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_no_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_merge_entity_with_existing_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_merge_entity_with_non_existing_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_replace_entity_with_existing_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_replace_entity_with_non_existing_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_not_existing.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_with_if_doesnt_match.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_with_if_matches.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_none_property_value.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_operations_on_entity_with_partition_key_having_single_quote.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_full_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_no_metadata.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_filter.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_select.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_top.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_top_and_next.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_zero_entities.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add_inside_range.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add_outside_range.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_delete.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_query.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_signed_identifier.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_update.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_upper_case_table_name.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_timezone.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_unicode_property_name.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_unicode_property_value.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_not_existing.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_with_if_doesnt_match.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_with_if_matches.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_retention_too_long.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_cors.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_hour_metrics.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_logging.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_minute_metrics.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_table_service_properties.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_too_many_cors_rules.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_service_stats.test_table_service_stats_f.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_service_stats.test_table_service_stats_when_unavailable.yaml create mode 100644 sdk/tables/azure-data-tables/tests/test_table.py create mode 100644 sdk/tables/azure-data-tables/tests/test_table_async.py create mode 100644 sdk/tables/azure-data-tables/tests/test_table_batch.py create mode 100644 sdk/tables/azure-data-tables/tests/test_table_client.py create mode 100644 sdk/tables/azure-data-tables/tests/test_table_encryption.py create mode 100644 sdk/tables/azure-data-tables/tests/test_table_entity.py create mode 100644 sdk/tables/azure-data-tables/tests/test_table_entity_async.py create mode 100644 sdk/tables/azure-data-tables/tests/test_table_service_properties.py create mode 100644 sdk/tables/azure-data-tables/tests/test_table_service_stats.py create mode 100644 sdk/tables/ci.yml create mode 100644 sdk/tables/tests.yml diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 804df46c48df..6fa386df06c5 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -119,6 +119,7 @@ known_content_issues: - ['sdk/storage/azure-storage-queue/samples/README.md', 'nspkg and common'] - ['sdk/textanalytics/azure-ai-nspkg/README.md', 'nspkg and common'] - ['sdk/eventhub/azure-eventhub/samples/README.md', 'nspkg and common'] + - ['sdk/tables/azure-data-nspkg/README.md', 'nspkg and common'] # HISTORY.rst - ['sdk/core/azure/HISTORY.rst','#4554'] diff --git a/sdk/tables/azure-data-nspkg/MANIFEST.in b/sdk/tables/azure-data-nspkg/MANIFEST.in new file mode 100644 index 000000000000..ae46fa1cbe7c --- /dev/null +++ b/sdk/tables/azure-data-nspkg/MANIFEST.in @@ -0,0 +1,3 @@ +include *.md +include azure/__init__.py +include azure/data/__init__.py diff --git a/sdk/tables/azure-data-nspkg/README.md b/sdk/tables/azure-data-nspkg/README.md new file mode 100644 index 000000000000..2b07e10788ef --- /dev/null +++ b/sdk/tables/azure-data-nspkg/README.md @@ -0,0 +1,11 @@ +# Microsoft Azure Data SDK for Python + +This is the Microsoft Azure Data namespace package. + +This package is not intended to be installed directly by the end user. + +It provides the necessary files for other packages to extend the +azure.data namespace. + +If you are looking to install the Azure Data libraries, see the +[azure](https://pypi.python.org/pypi/azure) bundle package. diff --git a/sdk/tables/azure-data-nspkg/azure/__init__.py b/sdk/tables/azure-data-nspkg/azure/__init__.py new file mode 100644 index 000000000000..69e3be50dac4 --- /dev/null +++ b/sdk/tables/azure-data-nspkg/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/sdk/tables/azure-data-nspkg/azure/data/__init__.py b/sdk/tables/azure-data-nspkg/azure/data/__init__.py new file mode 100644 index 000000000000..69e3be50dac4 --- /dev/null +++ b/sdk/tables/azure-data-nspkg/azure/data/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/sdk/tables/azure-data-nspkg/setup.cfg b/sdk/tables/azure-data-nspkg/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/tables/azure-data-nspkg/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/tables/azure-data-nspkg/setup.py b/sdk/tables/azure-data-nspkg/setup.py new file mode 100644 index 000000000000..8d9a5455678d --- /dev/null +++ b/sdk/tables/azure-data-nspkg/setup.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import sys +from setuptools import setup + +PACKAGES = [] +# Do an empty package on Python 3 and not python_requires, since not everybody is ready +# https://github.com/Azure/azure-sdk-for-python/issues/3447 +# https://github.com/Azure/azure-sdk-for-python/issues/3481 +if sys.version_info[0] < 3: + PACKAGES = ['azure.data'] + +setup( + name='azure-data-nspkg', + version='1.0.0', + description="Microsoft Azure Data Namespace Package [Internal]", + long_description=open("README.md", "r").read(), + long_description_content_type="text/markdown", + license='MIT License', + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/tables", + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "License :: OSI Approved :: MIT License", + ], + zip_safe=False, + packages=PACKAGES, + install_requires=[ + 'azure-nspkg>=3.0.0', + ] +) diff --git a/sdk/tables/azure-data-tables/CHANGELOG.md b/sdk/tables/azure-data-tables/CHANGELOG.md new file mode 100644 index 000000000000..53f73cf90855 --- /dev/null +++ b/sdk/tables/azure-data-tables/CHANGELOG.md @@ -0,0 +1,6 @@ +# Release History + +## 12.0.0b1 (Unreleased) + + + diff --git a/sdk/tables/azure-data-tables/MANIFEST.in b/sdk/tables/azure-data-tables/MANIFEST.in new file mode 100644 index 000000000000..428787a39347 --- /dev/null +++ b/sdk/tables/azure-data-tables/MANIFEST.in @@ -0,0 +1,6 @@ +include *.md +include azure/__init__.py +include azure/data/__init__.py +include LICENSE.txt +recursive-include tests *.py +recursive-include samples *.py *.md diff --git a/sdk/tables/azure-data-tables/README.md b/sdk/tables/azure-data-tables/README.md new file mode 100644 index 000000000000..02ea72a9fab9 --- /dev/null +++ b/sdk/tables/azure-data-tables/README.md @@ -0,0 +1,299 @@ +# Azure Data Tables client library for Python + +Azure Data Tables is a NoSQL data storing service that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. +Tables scale as needed to support the amount of data inserted, and allow for the storing of data with non-complex accessing. +Tables scale as needed to support the amount of data inserted, and allow for the storing of data with non-complex accessing. +The Azure Data Tables client can be used to access Azure Storage or Cosmos accounts. + +Common uses of Azure Data Tables include: + +* Storing structured data in the form of tables +* Quickly querying data using a clustered index + +[Source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk) | [Package (PyPI)](https://pypi.org) | [API reference documentation](https://aka.ms/azsdk/python/tables/docs) | [Product documentation](https://docs.microsoft.com/azure/storage/) | [Samples](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk) + +## Getting started + +### Prerequisites +* Python 2.7, or 3.5 or later is required to use this package. +* You must have an [Azure subscription](https://azure.microsoft.com/free/) and an +[Azure storage account](https://docs.microsoft.com/azure/storage/common/storage-account-overview) to use this package + or you must have a [Azure Cosmos Account](https://docs.microsoft.com/en-us/azure/cosmos-db/account-overview). + +### Install the package +Install the Azure Data Tables client library for Python with [pip](https://pypi.org/project/pip/): + +```bash +pip install --pre azure-data-tables +``` + +### Create a storage account +If you wish to create a new cosmos storage account, you can use the [Azure Cosmos DB](https://docs.microsoft.com/en-us/azure/cosmos-db/create-cosmosdb-resources-portal) +If you wish to create a new storage account, you can use the +[Azure Portal](https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal), +[Azure PowerShell](https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-powershell), +or [Azure CLI](https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli): + +```bash +# Create a new resource group to hold the storage account - +# if using an existing resource group, skip this step +az group create --name MyResourceGroup --location westus2 + +# Create the storage account +az storage account create -n mystorageaccount -g MyResourceGroup +``` + +### Create the client +The Azure Data Tables client library for Python allows you to interact with two types of resources: the +account and tables, and entities. Interaction with these resources starts with an instance of a [client](#clients). +To create a client object, you will need the account's table service endpoint URL and a credential that allows +you to access the account: + +```python +from azure.data.tables import TableServiceClient + +service = TableServiceClient(account_url="https://.table.core.windows.net/", credential=credential) +``` + +#### Looking up the account URL +You can find the account's table service URL using the +[Azure Portal](https://docs.microsoft.com/azure/storage/common/storage-account-overview#storage-account-endpoints), +[Azure PowerShell](https://docs.microsoft.com/powershell/module/az.storage/get-azstorageaccount), +or [Azure CLI](https://docs.microsoft.com/cli/azure/storage/account?view=azure-cli-latest#az-storage-account-show): + +```bash +# Get the table service URL for the account +az storage account show -n mystorageaccount -g MyResourceGroup --query "primaryEndpoints.table" +``` + +#### Types of credentials +The `credential` parameter may be provided in a number of different forms, depending on the type of +[authorization](https://docs.microsoft.com/azure/storage/common/storage-auth) you wish to use: +1. To use a [shared access signature (SAS) token](https://docs.microsoft.com/azure/storage/common/storage-sas-overview), + provide the token as a string. If your account URL includes the SAS token, omit the credential parameter. + You can generate a SAS token from the Azure Portal under "Shared access signature" or use one of the `generate_sas()` + functions to create a sas token for the account or table: + +```python + from datetime import datetime, timedelta + from azure.data.tables import TableServiceClient, generate_account_sas, ResourceTypes, AccountSasPermissions + + sas_token = generate_account_sas( + account_name="", + account_key="", + resource_types=ResourceTypes(service=True), + permission=AccountSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1) + ) + + table_service_client = TableServiceClient(account_url="https://.table.core.windows.net", credential=sas_token) +``` + +2. To use an account [shared key](https://docs.microsoft.com/rest/api/storageservices/authenticate-with-shared-key/) + (aka account key or access key), provide the key as a string. This can be found in the Azure Portal under the "Access Keys" + section or by running the following Azure CLI command: + + ```az storage account keys list -g MyResourceGroup -n mystorageaccount``` + + Use the key as the credential parameter to authenticate the client: + ```python + from azure.data.tables import TableServiceClient + service = TableServiceClient(account_url="https://.table.core.windows.net", credential="") + ``` + +#### Creating the client from a connection string +Depending on your use case and authorization method, you may prefer to initialize a client instance with a +connection string instead of providing the account URL and credential separately. To do this, pass the +connection string to the client's `from_connection_string` class method: + +```python +from azure.data.tables import TableServiceClient + +connection_string = "DefaultEndpointsProtocol=https;AccountName=xxxx;AccountKey=xxxx;EndpointSuffix=core.windows.net" +service = TableServiceClient.from_connection_string(conn_str=connection_string) +``` + +The connection string to your account can be found in the Azure Portal under the "Access Keys" section or by running the following CLI command: + +```bash +az storage account show-connection-string -g MyResourceGroup -n mystorageaccount +``` + +## Key concepts +The following components make up the Azure Data Tables Service: +* The account +* A table within the account, which contains a set of entities +* An entity within a table, as a dictionary + +The Azure Data Tables client library for Python allows you to interact with each of these components through the +use of a dedicated client object. + +### Clients +Two different clients are provided to to interact with the various components of the Table Service: +1. [TableServiceClient](https://aka.ms/azsdk/python/tables/docs) - + this client represents interaction with the Azure account itself, and allows you to acquire preconfigured + client instances to access the tables within. It provides operations to retrieve and configure the account + properties as well as query, create, and delete tables within the account. To perform operations on a specific table, + retrieve a client using the `get_table_client` method. +2. [TableClient](https://aka.ms/azsdk/python/tables/docs) - + this client represents interaction with a specific table (which need not exist yet). It provides operations to + create, delete, or update a table and includes operations to query, get, and upsert entities + within it. + +### Entities +* **Create** - Adds an entity to the table. +* **Delete** - Deletes an entity from the table. +* **Update** - Updates an entities information by either merging or replacing the existing entity. +* **Query** - Queries existing entities in a table based off of the QueryOptions (OData). +* **Get** - Gets a specific entity from a table by partition and row key. +* **Upsert** - Merges or replaces an entity in a table, or if the entity does not exist, inserts the entity. + +## Examples + +The following sections provide several code snippets covering some of the most common Table tasks, including: + +* [Creating a table](#creating-a-table "Creating a table") +* [Creating entities](#creating-entities "Creating entities") +* [Querying entities](#querying-entities "Querying entities") + + +### Creating a table +Create a table in your account + +```python +from azure.data.tables import TableServiceClient + +table_service_client = TableServiceClient.from_connection_string(conn_str="") +table_service_client.create_table(table_name="myTable") +``` + +### Creating entities +Create entities in the table + +```python +from azure.data.tables import TableClient + +my_entity = {'PartitionKey':'part','RowKey':'row'} + +table_client = TableClient.from_connection_string(conn_str="", table_name="myTable") +entity = table_client.create_entity(entity=my_entity) +``` + +### Querying entities +Querying entities in the table + +```python +from azure.data.tables import TableClient + +my_filter = "text eq Marker" + +table_client = TableClient.from_connection_string(conn_str="", table_name="mytable") +entity = table_client.query_entities(filter=my_filter) +``` + +## Optional Configuration + +Optional keyword arguments can be passed in at the client and per-operation level. The azure-core [reference documentation](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html) describes available configurations for retries, logging, transport protocols, and more. + + +### Retry Policy configuration + +Use the following keyword arguments when instantiating a client to configure the retry policy: + +* __retry_total__ (int): Total number of retries to allow. Takes precedence over other counts. +Pass in `retry_total=0` if you do not want to retry on requests. Defaults to 10. +* __retry_connect__ (int): How many connection-related errors to retry on. Defaults to 3. +* __retry_read__ (int): How many times to retry on read errors. Defaults to 3. +* __retry_status__ (int): How many times to retry on bad status codes. Defaults to 3. +* __retry_to_secondary__ (bool): Whether the request should be retried to secondary, if able. +This should only be enabled of RA-GRS accounts are used and potentially stale data can be handled. +Defaults to `False`. + +### Other client / per-operation configuration + +Other optional configuration keyword arguments that can be specified on the client or per-operation. + +**Client keyword arguments:** + +* __connection_timeout__ (int): Optionally sets the connect and read timeout value, in seconds. +* __transport__ (Any): User-provided transport to send the HTTP request. + +**Per-operation keyword arguments:** + +* __raw_response_hook__ (callable): The given callback uses the response returned from the service. +* __raw_request_hook__ (callable): The given callback uses the request before being sent to service. +* __client_request_id__ (str): Optional user specified identification of the request. +* __user_agent__ (str): Appends the custom value to the user-agent header to be sent with the request. +* __logging_enable__ (bool): Enables logging at the DEBUG level. Defaults to False. Can also be passed in at +the client level to enable it for all requests. +* __headers__ (dict): Pass in custom headers as key, value pairs. E.g. `headers={'CustomValue': value}` + + +## Troubleshooting +### General +Azure Data Tables clients raise exceptions defined in [Azure Core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/README.md). +All Table service operations will throw a `HttpResponseError` on failure with helpful [error codes](https://docs.microsoft.com/en-us/rest/api/storageservices/table-service-error-codes). + +### Logging +This library uses the standard +[logging](https://docs.python.org/3/library/logging.html) library for logging. +Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO +level. + +Detailed DEBUG level logging, including request/response bodies and unredacted +headers, can be enabled on a client with the `logging_enable` argument: +```python +import sys +import logging +from azure.data.tables import TableServiceClient + +# Create a logger for the 'azure.data.tables' SDK +logger = logging.getLogger('azure.data.tables') +logger.setLevel(logging.DEBUG) + +# Configure a console output +handler = logging.StreamHandler(stream=sys.stdout) +logger.addHandler(handler) + +# This client will log detailed information about its HTTP sessions, at DEBUG level +service_client = TableServiceClient.from_connection_string("your_connection_string", logging_enable=True) +``` + +Similarly, `logging_enable` can enable detailed logging for a single operation, +even when it isn't enabled for the client: +```py +service_client.get_service_stats(logging_enable=True) +``` + +## Next steps + +Get started with our [Table samples](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk). + +Several Azure Data Tables Python SDK samples are available to you in the SDK's GitHub repository. These samples provide example code for additional scenarios commonly encountered while working with Tables: + +* [table_samples_authentication.py](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk) - Examples found in this article: + * From a connection string + * From a shared access key + * From a shared access signature token +* [table_samples_service.py](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk) - Examples found in this article: + * Get and set service properties + * List tables in a account + * Create and delete a table from the service + * Get the TableClient +* [table_samples_client.py](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk) - Examples found in this article: + * Client creation + * Create a table + * Create and Delete entities + * Query entities + * Update entities + * Upsert entities + +### Additional documentation +For more extensive documentation on Azure Data Tables, see the [Azure Data Tables documentation](https://docs.microsoft.com/azure/storage/tables/) on docs.microsoft.com. + +## Contributing +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. diff --git a/sdk/tables/azure-data-tables/azure/__init__.py b/sdk/tables/azure-data-tables/azure/__init__.py new file mode 100644 index 000000000000..59cb70146572 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: str diff --git a/sdk/tables/azure-data-tables/azure/data/__init__.py b/sdk/tables/azure-data-tables/azure/data/__init__.py new file mode 100644 index 000000000000..59cb70146572 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: str diff --git a/sdk/tables/azure-data-tables/azure/data/tables/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/__init__.py new file mode 100644 index 000000000000..784eae1b1948 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/__init__.py @@ -0,0 +1,54 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from azure.data.tables._models import TableServiceStats + +from ._entity import TableEntity, EntityProperty, EdmType +from ._shared.table_shared_access_signature import generate_table_sas, \ + generate_account_sas +from ._table_client import TableClient +from ._table_service_client import TableServiceClient + +from ._models import ( + AccessPolicy, + Metrics, + RetentionPolicy, TableAnalyticsLogging, TableSasPermissions, CorsRule, UpdateMode, SASProtocol, Table, +) +from ._shared.models import ( + LocationMode, + ResourceTypes, + AccountSasPermissions, + TableErrorCode +) +from ._shared.policies import ExponentialRetry, LinearRetry +from ._version import VERSION + +__version__ = VERSION + +__all__ = [ + 'TableClient', + 'TableServiceClient', + 'ExponentialRetry', + 'LinearRetry', + 'LocationMode', + 'ResourceTypes', + 'AccountSasPermissions', + 'TableErrorCode', + 'TableServiceStats', + 'TableSasPermissions', + 'AccessPolicy', + 'TableAnalyticsLogging', + 'Metrics', + 'generate_account_sas', + 'CorsRule', + 'UpdateMode', + 'Table', + 'TableEntity', + 'EntityProperty', + 'EdmType', + 'RetentionPolicy', + 'generate_table_sas', + 'SASProtocol' +] diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py b/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py new file mode 100644 index 000000000000..4555dad01241 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py @@ -0,0 +1,176 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +# pylint: disable=unused-argument +import datetime +from uuid import UUID +from azure.core.exceptions import ResourceExistsError +from ._shared import url_quote +from ._entity import EntityProperty, EdmType, TableEntity +from ._shared._common_conversion import _decode_base64_to_bytes +from ._generated.models import TableProperties + + +from ._shared.models import TableErrorCode + + +def deserialize_metadata(response, _, headers): + return {k[10:]: v for k, v in response.headers.items() if k.startswith("x-ms-meta-")} + + +def deserialize_table_properties(response, obj, headers): + metadata = deserialize_metadata(response, obj, headers) + table_properties = TableProperties( + metadata=metadata, + **headers + ) + return table_properties + + +def deserialize_table_creation(response, _, headers): + if response.status_code == 204: + error_code = TableErrorCode.table_already_exists + error = ResourceExistsError( + message="Table already exists\nRequestId:{}\nTime:{}\nErrorCode:{}".format( + headers['x-ms-request-id'], + headers['Date'], + error_code + ), + response=response) + error.error_code = error_code + error.additional_info = {} + raise error + return headers + + +def _from_entity_binary(value): + return EntityProperty(EdmType.BINARY, _decode_base64_to_bytes(value)) + + +def _from_entity_int32(value): + return EntityProperty(EdmType.INT32, int(value)) + + +zero = datetime.timedelta(0) # same as 00:00 + + +class Timezone(datetime.tzinfo): # pylint: disable : W0223 + + def utcoffset(self, dt): + return zero + + def dst(self, dt): + return zero + + def tzname(self, dt): + return + + +def _from_entity_datetime(value): + # # TODO: Fix this + return datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ'). \ + replace(tzinfo=Timezone()) + + +def _from_entity_guid(value): + return UUID(value) + + +_EDM_TYPES = [EdmType.BINARY, EdmType.INT64, EdmType.GUID, EdmType.DATETIME, + EdmType.STRING, EdmType.INT32, EdmType.DOUBLE, EdmType.BOOLEAN] + +_ENTITY_TO_PYTHON_CONVERSIONS = { + EdmType.BINARY: _from_entity_binary, + EdmType.INT32: _from_entity_int32, + EdmType.INT64: int, + EdmType.DOUBLE: float, + EdmType.DATETIME: _from_entity_datetime, + EdmType.GUID: _from_entity_guid, +} + + +def _convert_to_entity(entry_element): + ''' Convert json response to entity. + The entity format is: + { + "Address":"Mountain View", + "Age":23, + "AmountDue":200.23, + "CustomerCode@odata.type":"Edm.Guid", + "CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833", + "CustomerSince@odata.type":"Edm.DateTime", + "CustomerSince":"2008-07-10T00:00:00", + "IsActive":true, + "NumberOfOrders@odata.type":"Edm.Int64", + "NumberOfOrders":"255", + "PartitionKey":"mypartitionkey", + "RowKey":"myrowkey" + } + ''' + entity = TableEntity() + + properties = {} + edmtypes = {} + odata = {} + + for name, value in entry_element.items(): + if name.startswith('odata.'): + odata[name[6:]] = value + elif name.endswith('@odata.type'): + edmtypes[name[:-11]] = value + else: + properties[name] = value + + # Partition key is a known property + partition_key = properties.pop('PartitionKey', None) + if partition_key: + entity['PartitionKey'] = partition_key + + # Row key is a known property + row_key = properties.pop('RowKey', None) + if row_key: + entity['RowKey'] = row_key + + # Timestamp is a known property + timestamp = properties.pop('Timestamp', None) + if timestamp: + # TODO: verify change here + # entity['Timestamp'] = _from_entity_datetime(timestamp) + entity['Timestamp'] = timestamp + + for name, value in properties.items(): + mtype = edmtypes.get(name) + + # Add type for Int32 + if type(value) is int: # pylint:disable=C0123 + mtype = EdmType.INT32 + + # no type info, property should parse automatically + if not mtype: + entity[name] = value + else: # need an object to hold the property + conv = _ENTITY_TO_PYTHON_CONVERSIONS.get(mtype) + if conv is not None: + new_property = conv(value) + else: + new_property = EntityProperty(mtype, value) + entity[name] = new_property + + # extract etag from entry + etag = odata.get('etag') + if timestamp and not etag: + etag = 'W/"datetime\'' + url_quote(timestamp) + '\'"' + entity['etag'] = etag + + entity._set_metadata() # pylint: disable = W0212 + return entity + + +def _extract_etag(response): + """ Extracts the etag from the response headers. """ + if response and response.headers: + return response.headers.get('etag') + + return None diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_entity.py b/sdk/tables/azure-data-tables/azure/data/tables/_entity.py new file mode 100644 index 000000000000..cc3265c2860c --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_entity.py @@ -0,0 +1,119 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from enum import Enum + +from ._shared._error import _ERROR_ATTRIBUTE_MISSING + + +class TableEntity(dict): + """ + An entity object. Can be accessed as a dict or as an obj. The attributes of + the entity will be created dynamically. For example, the following are both + valid:: + TableEntity = TableEntity() + TableEntity.a = 'b' + TableEntity['x'] = 'y' + + """ + + def _set_metadata(self): + if 'Timestamp' in self.keys(): + self._metadata = {'etag': self.pop('etag'), "timestamp": self.pop('Timestamp')} # pylint:disable=W0201 + else: + self._metadata = {'etag': self.pop('etag')} # pylint:disable=W0201 + + def metadata(self, **kwargs): # pylint: disable = W0613 + # type: (...) -> Dict[str,Any] + """Resets metadata to be a part of the entity + :return Dict of entity metadata + :rtype Dict[str, Any] + """ + return self._metadata + + def __getattr__(self, name): + """ + :param name:name of entity entry + :type name: str + :return: TableEntity dictionary + :rtype: dict[str,str] + """ + try: + return self[name] + except KeyError: + raise AttributeError(_ERROR_ATTRIBUTE_MISSING.format('TableEntity', name)) + + __setattr__ = dict.__setitem__ + + def __delattr__(self, name): + """ + :param name:name of entity entry + :type name: str + """ + try: + if name is not None: + del self[name] + except KeyError: + raise AttributeError(_ERROR_ATTRIBUTE_MISSING.format('TableEntity', name)) + + def __dir__(self): + return dir({}) + list(self.keys()) + + +class EntityProperty(object): + """ + An entity property. Used to explicitly set :class:`~EdmType` when necessary. + + Values which require explicit typing are GUID, INT32, and BINARY. Other EdmTypes + may be explicitly create as EntityProperty objects but need not be. For example, + the below with both create STRING typed properties on the entity:: + entity = Entity() + entity.a = 'b' + entity.x = EntityProperty(EdmType.STRING, 'y') + """ + + def __init__(self, + type=None, # type: Union[str,EdmType] # pylint:disable=W0622 + value=None # type: Any + ): + """ + Represents an Azure Table. Returned by list_tables. + + :param Union[str, EdmType] type: The type of the property. + :param Any value: The value of the property. + """ + self.type = type + self.value = value + + +class EdmType(str, Enum): + """ + Used by :class:`~.EntityProperty` to represent the type of the entity property + to be stored by the Table service. + """ + + BINARY = "Edm.Binary" + ''' Represents byte data. This type will be inferred for Python bytes.. ''' + + INT64 = "Edm.Int64" + ''' Represents a number between -(2^31) and 2^31. This is the default type for Python numbers. ''' + + GUID = "Edm.Guid" + ''' Represents a GUID. This type will be inferred for uuid.UUID. ''' + + DATETIME = "Edm.DateTime" + ''' Represents a date. This type will be inferred for Python datetime objects. ''' + + STRING = "Edm.String" + ''' Represents a string. This type will be inferred for Python strings. ''' + + INT32 = "Edm.Int32" + ''' Represents a number between -(2^15) and 2^15. Must be specified or numbers will default to INT64. ''' + + DOUBLE = "Edm.Double" + ''' Represents a double. This type will be inferred for Python floating point numbers. ''' + + BOOLEAN = "Edm.Boolean" + ''' Represents a boolean. This type will be inferred for Python bools. ''' diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/__init__.py new file mode 100644 index 000000000000..38dbb2a7267b --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/__init__.py @@ -0,0 +1,14 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._azure_table import AzureTable +__all__ = ['AzureTable'] + +try: + from ._patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/_azure_table.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/_azure_table.py new file mode 100644 index 000000000000..b9331513f6f5 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/_azure_table.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + +from ._configuration import AzureTableConfiguration +from .operations import TableOperations +from .operations import ServiceOperations +from . import models + + +class AzureTable(object): + """AzureTable. + + :ivar table: TableOperations operations + :vartype table: azure_table.operations.TableOperations + :ivar service: ServiceOperations operations + :vartype service: azure_table.operations.ServiceOperations + :param url: The URL of the service account or table that is the targe of the desired operation. + :type url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + url, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + base_url = '{url}' + self._config = AzureTableConfiguration(url, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.table = TableOperations( + self._client, self._config, self._serialize, self._deserialize) + self.service = ServiceOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AzureTable + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/_configuration.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/_configuration.py new file mode 100644 index 000000000000..f822bc3d1ad0 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/_configuration.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + +VERSION = "unknown" + +class AzureTableConfiguration(Configuration): + """Configuration for AzureTable. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param url: The URL of the service account or table that is the targe of the desired operation. + :type url: str + """ + + def __init__( + self, + url, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if url is None: + raise ValueError("Parameter 'url' must not be None.") + super(AzureTableConfiguration, self).__init__(**kwargs) + + self.url = url + self.version = "2019-02-02" + kwargs.setdefault('sdk_moniker', 'azuretable/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/__init__.py new file mode 100644 index 000000000000..4c1512d94a8a --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/__init__.py @@ -0,0 +1,10 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +__all__ = ['AzureTable'] + +from ._azure_table_async import AzureTable + + diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_azure_table_async.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_azure_table_async.py new file mode 100644 index 000000000000..1b3c4d87d19c --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_azure_table_async.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any + +from azure.core import AsyncPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import AzureTableConfiguration +from .operations_async import TableOperations +from .operations_async import ServiceOperations +from .. import models + + +class AzureTable(object): + """AzureTable. + + :ivar table: TableOperations operations + :vartype table: azure_table.aio.operations_async.TableOperations + :ivar service: ServiceOperations operations + :vartype service: azure_table.aio.operations_async.ServiceOperations + :param url: The URL of the service account or table that is the targe of the desired operation. + :type url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + url: str, + **kwargs: Any + ) -> None: + base_url = '{url}' + self._config = AzureTableConfiguration(url, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.table = TableOperations( + self._client, self._config, self._serialize, self._deserialize) + self.service = ServiceOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AzureTable": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_configuration_async.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_configuration_async.py new file mode 100644 index 000000000000..d2581e2463c9 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_configuration_async.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class AzureTableConfiguration(Configuration): + """Configuration for AzureTable. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param url: The URL of the service account or table that is the targe of the desired operation. + :type url: str + """ + + def __init__( + self, + url: str, + **kwargs: Any + ) -> None: + if url is None: + raise ValueError("Parameter 'url' must not be None.") + super(AzureTableConfiguration, self).__init__(**kwargs) + + self.url = url + self.version = "2019-02-02" + kwargs.setdefault('sdk_moniker', 'azuretable/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/__init__.py new file mode 100644 index 000000000000..90d9a5059444 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._table_operations_async import TableOperations +from ._service_operations_async import ServiceOperations + +__all__ = [ + 'TableOperations', + 'ServiceOperations', +] diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_service_operations_async.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_service_operations_async.py new file mode 100644 index 000000000000..b9a2d2b3d664 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_service_operations_async.py @@ -0,0 +1,246 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServiceOperations: + """ServiceOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_table.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def set_properties( + self, + table_service_properties: "models.TableServiceProperties", + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs + ) -> None: + """Sets properties for an account's Table service endpoint, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param table_service_properties: The Table Service properties. + :type table_service_properties: ~azure_table.models.TableServiceProperties + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + restype = "service" + comp = "properties" + content_type = kwargs.pop("content_type", "application/xml") + + # Construct URL + url = self.set_properties.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['restype'] = self._serialize.query("restype", restype, 'str') + query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(table_service_properties, 'TableServiceProperties', is_xml=True) + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + + if cls: + return cls(pipeline_response, None, response_headers) + + set_properties.metadata = {'url': '/'} # type: ignore + + async def get_properties( + self, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs + ) -> "models.TableServiceProperties": + """Gets the properties of an account's Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableServiceProperties, or the result of cls(response) + :rtype: ~azure_table.models.TableServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableServiceProperties"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + restype = "service" + comp = "properties" + + # Construct URL + url = self.get_properties.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['restype'] = self._serialize.query("restype", restype, 'str') + query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['Accept'] = 'application/xml' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('TableServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_properties.metadata = {'url': '/'} # type: ignore + + async def get_statistics( + self, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs + ) -> "models.TableServiceStats": + """Retrieves statistics related to replication for the Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the account. + + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableServiceStats, or the result of cls(response) + :rtype: ~azure_table.models.TableServiceStats + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableServiceStats"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + restype = "service" + comp = "stats" + + # Construct URL + url = self.get_statistics.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['restype'] = self._serialize.query("restype", restype, 'str') + query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['Accept'] = 'application/xml' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('TableServiceStats', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_statistics.metadata = {'url': '/'} # type: ignore diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_table_operations_async.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_table_operations_async.py new file mode 100644 index 000000000000..80d2a09252d7 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_table_operations_async.py @@ -0,0 +1,1043 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TableOperations: + """TableOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_table.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def query( + self, + request_id_parameter: Optional[str] = None, + next_table_name: Optional[str] = None, + query_options: Optional["models.QueryOptions"] = None, + **kwargs + ) -> "models.TableQueryResponse": + """Queries tables under the given account. + + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param next_table_name: A table query continuation token from a previous call. + :type next_table_name: str + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableQueryResponse, or the result of cls(response) + :rtype: ~azure_table.models.TableQueryResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableQueryResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + _top = None + _select = None + _filter = None + if query_options is not None: + _format = query_options.format + _top = query_options.top + _select = query_options.select + _filter = query_options.filter + data_service_version = "3.0" + + # Construct URL + url = self.query.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + if _top is not None: + query_parameters['$top'] = self._serialize.query("top", _top, 'int', minimum=0) + if _select is not None: + query_parameters['$select'] = self._serialize.query("select", _select, 'str') + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + if next_table_name is not None: + query_parameters['NextTableName'] = self._serialize.query("next_table_name", next_table_name, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + header_parameters['Accept'] = 'application/json;odata=minimalmetadata' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['x-ms-continuation-NextTableName']=self._deserialize('str', response.headers.get('x-ms-continuation-NextTableName')) + deserialized = self._deserialize('TableQueryResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + query.metadata = {'url': '/Tables'} # type: ignore + + async def create( + self, + table_properties: "models.TableProperties", + request_id_parameter: Optional[str] = None, + response_preference: Optional[Union[str, "models.ResponseFormat"]] = None, + query_options: Optional["models.QueryOptions"] = None, + **kwargs + ) -> "models.TableResponse": + """Creates a new table under the given account. + + :param table_properties: The Table properties. + :type table_properties: ~azure_table.models.TableProperties + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param response_preference: Specifies whether the response should include the inserted entity + in the payload. Possible values are return-no-content and return-content. + :type response_preference: str or ~azure_table.models.ResponseFormat + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableResponse, or the result of cls(response) + :rtype: ~azure_table.models.TableResponse or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + if query_options is not None: + _format = query_options.format + data_service_version = "3.0" + content_type = kwargs.pop("content_type", "application/json;odata=nometadata") + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + if response_preference is not None: + header_parameters['Prefer'] = self._serialize.header("response_preference", response_preference, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json;odata=minimalmetadata' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(table_properties, 'TableProperties') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 201: + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['Preference-Applied']=self._deserialize('str', response.headers.get('Preference-Applied')) + deserialized = self._deserialize('TableResponse', pipeline_response) + + if response.status_code == 204: + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['Preference-Applied']=self._deserialize('str', response.headers.get('Preference-Applied')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + create.metadata = {'url': '/Tables'} # type: ignore + + async def delete( + self, + table: str, + request_id_parameter: Optional[str] = None, + **kwargs + ) -> None: + """Operation permanently deletes the specified table. + + :param table: The name of the table. + :type table: str + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete.metadata = {'url': '/Tables(\'{table}\')'} # type: ignore + + async def query_entities( + self, + table: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + next_partition_key: Optional[str] = None, + next_row_key: Optional[str] = None, + query_options: Optional["models.QueryOptions"] = None, + **kwargs + ) -> "models.TableEntityQueryResponse": + """Queries entities in a table. + + :param table: The name of the table. + :type table: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param next_partition_key: An entity query continuation token from a previous call. + :type next_partition_key: str + :param next_row_key: An entity query continuation token from a previous call. + :type next_row_key: str + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableEntityQueryResponse, or the result of cls(response) + :rtype: ~azure_table.models.TableEntityQueryResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableEntityQueryResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + _top = None + _select = None + _filter = None + if query_options is not None: + _format = query_options.format + _top = query_options.top + _select = query_options.select + _filter = query_options.filter + data_service_version = "3.0" + + # Construct URL + url = self.query_entities.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + if _top is not None: + query_parameters['$top'] = self._serialize.query("top", _top, 'int', minimum=0) + if _select is not None: + query_parameters['$select'] = self._serialize.query("select", _select, 'str') + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + if next_partition_key is not None: + query_parameters['NextPartitionKey'] = self._serialize.query("next_partition_key", next_partition_key, 'str') + if next_row_key is not None: + query_parameters['NextRowKey'] = self._serialize.query("next_row_key", next_row_key, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + header_parameters['Accept'] = 'application/json;odata=minimalmetadata' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['x-ms-continuation-NextPartitionKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextPartitionKey')) + response_headers['x-ms-continuation-NextRowKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextRowKey')) + deserialized = self._deserialize('TableEntityQueryResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + query_entities.metadata = {'url': '/{table}()'} # type: ignore + + async def query_entities_with_partition_and_row_key( + self, + table: str, + partition_key: str, + row_key: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + query_options: Optional["models.QueryOptions"] = None, + **kwargs + ) -> "models.TableEntityQueryResponse": + """Queries entities in a table. + + :param table: The name of the table. + :type table: str + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableEntityQueryResponse, or the result of cls(response) + :rtype: ~azure_table.models.TableEntityQueryResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableEntityQueryResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + _select = None + _filter = None + if query_options is not None: + _format = query_options.format + _select = query_options.select + _filter = query_options.filter + data_service_version = "3.0" + + # Construct URL + url = self.query_entities_with_partition_and_row_key.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + 'partitionKey': self._serialize.url("partition_key", partition_key, 'str'), + 'rowKey': self._serialize.url("row_key", row_key, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + if _select is not None: + query_parameters['$select'] = self._serialize.query("select", _select, 'str') + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + header_parameters['Accept'] = 'application/json;odata=minimalmetadata' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + response_headers['x-ms-continuation-NextPartitionKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextPartitionKey')) + response_headers['x-ms-continuation-NextRowKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextRowKey')) + deserialized = self._deserialize('TableEntityQueryResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + query_entities_with_partition_and_row_key.metadata = {'url': '/{table}(PartitionKey=\'{partitionKey}\',RowKey=\'{rowKey}\')'} # type: ignore + + async def update_entity( + self, + table: str, + partition_key: str, + row_key: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + if_match: Optional[str] = None, + table_entity_properties: Optional[Dict[str, object]] = None, + query_options: Optional["models.QueryOptions"] = None, + **kwargs + ) -> None: + """Update entity in a table. + + :param table: The name of the table. + :type table: str + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param if_match: Match condition for an entity to be updated. If specified and a matching + entity is not found, an error will be raised. To force an unconditional update, set to the + wildcard character (*). If not specified, an insert will be performed when no existing entity + is found to update and a replace will be performed if an existing entity is found. + :type if_match: str + :param table_entity_properties: The properties for the table entity. + :type table_entity_properties: dict[str, object] + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + if query_options is not None: + _format = query_options.format + data_service_version = "3.0" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_entity.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + 'partitionKey': self._serialize.url("partition_key", partition_key, 'str'), + 'rowKey': self._serialize.url("row_key", row_key, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + if table_entity_properties is not None: + body_content = self._serialize.body(table_entity_properties, '{object}') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + if cls: + return cls(pipeline_response, None, response_headers) + + update_entity.metadata = {'url': '/{table}(PartitionKey=\'{partitionKey}\',RowKey=\'{rowKey}\')'} # type: ignore + + async def merge_entity( + self, + table: str, + partition_key: str, + row_key: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + if_match: Optional[str] = None, + table_entity_properties: Optional[Dict[str, object]] = None, + query_options: Optional["models.QueryOptions"] = None, + **kwargs + ) -> None: + """Merge entity in a table. + + :param table: The name of the table. + :type table: str + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param if_match: Match condition for an entity to be updated. If specified and a matching + entity is not found, an error will be raised. To force an unconditional update, set to the + wildcard character (*). If not specified, an insert will be performed when no existing entity + is found to update and a merge will be performed if an existing entity is found. + :type if_match: str + :param table_entity_properties: The properties for the table entity. + :type table_entity_properties: dict[str, object] + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + if query_options is not None: + _format = query_options.format + data_service_version = "3.0" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.merge_entity.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + 'partitionKey': self._serialize.url("partition_key", partition_key, 'str'), + 'rowKey': self._serialize.url("row_key", row_key, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + if table_entity_properties is not None: + body_content = self._serialize.body(table_entity_properties, '{object}') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + if cls: + return cls(pipeline_response, None, response_headers) + + merge_entity.metadata = {'url': '/{table}(PartitionKey=\'{partitionKey}\',RowKey=\'{rowKey}\')'} # type: ignore + + async def delete_entity( + self, + table: str, + partition_key: str, + row_key: str, + if_match: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + query_options: Optional["models.QueryOptions"] = None, + **kwargs + ) -> None: + """Deletes the specified entity in a table. + + :param table: The name of the table. + :type table: str + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :param if_match: Match condition for an entity to be deleted. If specified and a matching + entity is not found, an error will be raised. To force an unconditional delete, set to the + wildcard character (*). + :type if_match: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + if query_options is not None: + _format = query_options.format + data_service_version = "3.0" + + # Construct URL + url = self.delete_entity.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + 'partitionKey': self._serialize.url("partition_key", partition_key, 'str'), + 'rowKey': self._serialize.url("row_key", row_key, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete_entity.metadata = {'url': '/{table}(PartitionKey=\'{partitionKey}\',RowKey=\'{rowKey}\')'} # type: ignore + + async def insert_entity( + self, + table: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + response_preference: Optional[Union[str, "models.ResponseFormat"]] = None, + table_entity_properties: Optional[Dict[str, object]] = None, + query_options: Optional["models.QueryOptions"] = None, + **kwargs + ) -> Dict[str, object]: + """Insert entity in a table. + + :param table: The name of the table. + :type table: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param response_preference: Specifies whether the response should include the inserted entity + in the payload. Possible values are return-no-content and return-content. + :type response_preference: str or ~azure_table.models.ResponseFormat + :param table_entity_properties: The properties for the table entity. + :type table_entity_properties: dict[str, object] + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: dict mapping str to object, or the result of cls(response) + :rtype: dict[str, object] or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, object]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + if query_options is not None: + _format = query_options.format + data_service_version = "3.0" + content_type = kwargs.pop("content_type", "application/json;odata=nometadata") + + # Construct URL + url = self.insert_entity.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + if response_preference is not None: + header_parameters['Prefer'] = self._serialize.header("response_preference", response_preference, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json;odata=minimalmetadata' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + if table_entity_properties is not None: + body_content = self._serialize.body(table_entity_properties, '{object}') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 201: + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + response_headers['Preference-Applied']=self._deserialize('str', response.headers.get('Preference-Applied')) + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = self._deserialize('{object}', pipeline_response) + + if response.status_code == 204: + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + response_headers['Preference-Applied']=self._deserialize('str', response.headers.get('Preference-Applied')) + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + insert_entity.metadata = {'url': '/{table}'} # type: ignore + + async def get_access_policy( + self, + table: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs + ) -> List["models.SignedIdentifier"]: + """Retrieves details about any stored access policies specified on the table that may be used with Shared Access Signatures. + + :param table: The name of the table. + :type table: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of SignedIdentifier, or the result of cls(response) + :rtype: list[~azure_table.models.SignedIdentifier] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.SignedIdentifier"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + comp = "acl" + + # Construct URL + url = self.get_access_policy.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['Accept'] = 'application/xml' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[SignedIdentifier]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_access_policy.metadata = {'url': '/{table}'} # type: ignore + + async def set_access_policy( + self, + table: str, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + table_acl: Optional[List["models.SignedIdentifier"]] = None, + **kwargs + ) -> None: + """Sets stored access policies for the table that may be used with Shared Access Signatures. + + :param table: The name of the table. + :type table: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param table_acl: The acls for the table. + :type table_acl: list[~azure_table.models.SignedIdentifier] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + comp = "acl" + content_type = kwargs.pop("content_type", "application/xml") + + # Construct URL + url = self.set_access_policy.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/xml' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True, 'itemsName': 'SignedIdentifier'}} + if table_acl is not None: + body_content = self._serialize.body(table_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + + if cls: + return cls(pipeline_response, None, response_headers) + + set_access_policy.metadata = {'url': '/{table}'} # type: ignore diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/__init__.py new file mode 100644 index 000000000000..944581fccd98 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/__init__.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AccessPolicy + from ._models_py3 import CorsRule + from ._models_py3 import GeoReplication + from ._models_py3 import Logging + from ._models_py3 import Metrics + from ._models_py3 import QueryOptions + from ._models_py3 import RetentionPolicy + from ._models_py3 import SignedIdentifier + from ._models_py3 import TableEntityQueryResponse + from ._models_py3 import TableProperties + from ._models_py3 import TableQueryResponse + from ._models_py3 import TableResponse + from ._models_py3 import TableResponseProperties + from ._models_py3 import TableServiceError + from ._models_py3 import TableServiceProperties + from ._models_py3 import TableServiceStats +except (SyntaxError, ImportError): + from ._models import AccessPolicy # type: ignore + from ._models import CorsRule # type: ignore + from ._models import GeoReplication # type: ignore + from ._models import Logging # type: ignore + from ._models import Metrics # type: ignore + from ._models import QueryOptions # type: ignore + from ._models import RetentionPolicy # type: ignore + from ._models import SignedIdentifier # type: ignore + from ._models import TableEntityQueryResponse # type: ignore + from ._models import TableProperties # type: ignore + from ._models import TableQueryResponse # type: ignore + from ._models import TableResponse # type: ignore + from ._models import TableResponseProperties # type: ignore + from ._models import TableServiceError # type: ignore + from ._models import TableServiceProperties # type: ignore + from ._models import TableServiceStats # type: ignore + +from ._azure_table_enums import ( + GeoReplicationStatusType, + OdataMetadataFormat, + ResponseFormat, +) + +__all__ = [ + 'AccessPolicy', + 'CorsRule', + 'GeoReplication', + 'Logging', + 'Metrics', + 'QueryOptions', + 'RetentionPolicy', + 'SignedIdentifier', + 'TableEntityQueryResponse', + 'TableProperties', + 'TableQueryResponse', + 'TableResponse', + 'TableResponseProperties', + 'TableServiceError', + 'TableServiceProperties', + 'TableServiceStats', + 'GeoReplicationStatusType', + 'OdataMetadataFormat', + 'ResponseFormat', +] diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_azure_table_enums.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_azure_table_enums.py new file mode 100644 index 000000000000..ef8e90bd92c9 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_azure_table_enums.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + +class GeoReplicationStatusType(str, Enum): + """The status of the secondary location. + """ + + live = "live" + bootstrap = "bootstrap" + unavailable = "unavailable" + +class OdataMetadataFormat(str, Enum): + + application_json_odata_nometadata = "application/json;odata=nometadata" + application_json_odata_minimalmetadata = "application/json;odata=minimalmetadata" + application_json_odata_fullmetadata = "application/json;odata=fullmetadata" + +class ResponseFormat(str, Enum): + + return_no_content = "return-no-content" + return_content = "return-content" diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models.py new file mode 100644 index 000000000000..3ca6eee7318e --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models.py @@ -0,0 +1,539 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AccessPolicy(msrest.serialization.Model): + """An Access policy. + + All required parameters must be populated in order to send to Azure. + + :param start: Required. The start datetime from which the policy is active. + :type start: ~datetime.datetime + :param expiry: Required. The datetime that the policy expires. + :type expiry: ~datetime.datetime + :param permission: Required. The permissions for the acl policy. + :type permission: str + """ + + _validation = { + 'start': {'required': True}, + 'expiry': {'required': True}, + 'permission': {'required': True}, + } + + _attribute_map = { + 'start': {'key': 'Start', 'type': 'str', 'xml': {'name': 'Start'}}, + 'expiry': {'key': 'Expiry', 'type': 'str', 'xml': {'name': 'Expiry'}}, + 'permission': {'key': 'Permission', 'type': 'str', 'xml': {'name': 'Permission'}}, + } + _xml_map = { + 'name': 'AccessPolicy' + } + + def __init__( + self, + **kwargs + ): + super(AccessPolicy, self).__init__(**kwargs) + self.start = kwargs['start'] + self.expiry = kwargs['expiry'] + self.permission = kwargs['permission'] + + +class CorsRule(msrest.serialization.Model): + """CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain. + + All required parameters must be populated in order to send to Azure. + + :param allowed_origins: Required. The origin domains that are permitted to make a request + against the service via CORS. The origin domain is the domain from which the request + originates. Note that the origin must be an exact case-sensitive match with the origin that the + user age sends to the service. You can also use the wildcard character '*' to allow all origin + domains to make requests via CORS. + :type allowed_origins: str + :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + use for a CORS request. (comma separated). + :type allowed_methods: str + :param allowed_headers: Required. The request headers that the origin domain may specify on the + CORS request. + :type allowed_headers: str + :param exposed_headers: Required. The response headers that may be sent in the response to the + CORS request and exposed by the browser to the request issuer. + :type exposed_headers: str + :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the + preflight OPTIONS request. + :type max_age_in_seconds: int + """ + + _validation = { + 'allowed_origins': {'required': True}, + 'allowed_methods': {'required': True}, + 'allowed_headers': {'required': True}, + 'exposed_headers': {'required': True}, + 'max_age_in_seconds': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'allowed_origins': {'key': 'AllowedOrigins', 'type': 'str', 'xml': {'name': 'AllowedOrigins'}}, + 'allowed_methods': {'key': 'AllowedMethods', 'type': 'str', 'xml': {'name': 'AllowedMethods'}}, + 'allowed_headers': {'key': 'AllowedHeaders', 'type': 'str', 'xml': {'name': 'AllowedHeaders'}}, + 'exposed_headers': {'key': 'ExposedHeaders', 'type': 'str', 'xml': {'name': 'ExposedHeaders'}}, + 'max_age_in_seconds': {'key': 'MaxAgeInSeconds', 'type': 'int', 'xml': {'name': 'MaxAgeInSeconds'}}, + } + _xml_map = { + 'name': 'CorsRule' + } + + def __init__( + self, + **kwargs + ): + super(CorsRule, self).__init__(**kwargs) + self.allowed_origins = kwargs['allowed_origins'] + self.allowed_methods = kwargs['allowed_methods'] + self.allowed_headers = kwargs['allowed_headers'] + self.exposed_headers = kwargs['exposed_headers'] + self.max_age_in_seconds = kwargs['max_age_in_seconds'] + + +class GeoReplication(msrest.serialization.Model): + """GeoReplication. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The status of the secondary location. Possible values include: "live", + "bootstrap", "unavailable". + :type status: str or ~azure_table.models.GeoReplicationStatusType + :param last_sync_time: Required. A GMT date/time value, to the second. All primary writes + preceding this value are guaranteed to be available for read operations at the secondary. + Primary writes after this point in time may or may not be available for reads. + :type last_sync_time: ~datetime.datetime + """ + + _validation = { + 'status': {'required': True}, + 'last_sync_time': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'Status', 'type': 'str', 'xml': {'name': 'Status'}}, + 'last_sync_time': {'key': 'LastSyncTime', 'type': 'rfc-1123', 'xml': {'name': 'LastSyncTime'}}, + } + _xml_map = { + 'name': 'GeoReplication' + } + + def __init__( + self, + **kwargs + ): + super(GeoReplication, self).__init__(**kwargs) + self.status = kwargs['status'] + self.last_sync_time = kwargs['last_sync_time'] + + +class Logging(msrest.serialization.Model): + """Azure Analytics Logging settings. + + All required parameters must be populated in order to send to Azure. + + :param version: Required. The version of Analytics to configure. + :type version: str + :param delete: Required. Indicates whether all delete requests should be logged. + :type delete: bool + :param read: Required. Indicates whether all read requests should be logged. + :type read: bool + :param write: Required. Indicates whether all write requests should be logged. + :type write: bool + :param retention_policy: Required. The retention policy. + :type retention_policy: ~azure_table.models.RetentionPolicy + """ + + _validation = { + 'version': {'required': True}, + 'delete': {'required': True}, + 'read': {'required': True}, + 'write': {'required': True}, + 'retention_policy': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}}, + 'delete': {'key': 'Delete', 'type': 'bool', 'xml': {'name': 'Delete'}}, + 'read': {'key': 'Read', 'type': 'bool', 'xml': {'name': 'Read'}}, + 'write': {'key': 'Write', 'type': 'bool', 'xml': {'name': 'Write'}}, + 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'}, + } + _xml_map = { + 'name': 'Logging' + } + + def __init__( + self, + **kwargs + ): + super(Logging, self).__init__(**kwargs) + self.version = kwargs['version'] + self.delete = kwargs['delete'] + self.read = kwargs['read'] + self.write = kwargs['write'] + self.retention_policy = kwargs['retention_policy'] + + +class Metrics(msrest.serialization.Model): + """Metrics. + + All required parameters must be populated in order to send to Azure. + + :param version: The version of Analytics to configure. + :type version: str + :param enabled: Required. Indicates whether metrics are enabled for the Table service. + :type enabled: bool + :param include_apis: Indicates whether metrics should generate summary statistics for called + API operations. + :type include_apis: bool + :param retention_policy: The retention policy. + :type retention_policy: ~azure_table.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}}, + 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}}, + 'include_apis': {'key': 'IncludeAPIs', 'type': 'bool', 'xml': {'name': 'IncludeAPIs'}}, + 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'}, + } + _xml_map = { + + } + + def __init__( + self, + **kwargs + ): + super(Metrics, self).__init__(**kwargs) + self.version = kwargs.get('version', None) + self.enabled = kwargs['enabled'] + self.include_apis = kwargs.get('include_apis', None) + self.retention_policy = kwargs.get('retention_policy', None) + + +class QueryOptions(msrest.serialization.Model): + """Parameter group. + + :param format: Specifies the media type for the response. Possible values include: + "application/json;odata=nometadata", "application/json;odata=minimalmetadata", + "application/json;odata=fullmetadata". + :type format: str or ~azure_table.models.OdataMetadataFormat + :param top: Maximum number of records to return. + :type top: int + :param select: Select expression using OData notation. Limits the columns on each record to + just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + :type select: str + :param filter: OData filter expression. + :type filter: str + """ + + _validation = { + 'top': {'minimum': 0}, + } + + _attribute_map = { + 'format': {'key': 'Format', 'type': 'str'}, + 'top': {'key': 'Top', 'type': 'int'}, + 'select': {'key': 'Select', 'type': 'str'}, + 'filter': {'key': 'Filter', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryOptions, self).__init__(**kwargs) + self.format = kwargs.get('format', None) + self.top = kwargs.get('top', None) + self.select = kwargs.get('select', None) + self.filter = kwargs.get('filter', None) + + +class RetentionPolicy(msrest.serialization.Model): + """The retention policy. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. Indicates whether a retention policy is enabled for the service. + :type enabled: bool + :param days: Indicates the number of days that metrics or logging or soft-deleted data should + be retained. All data older than this value will be deleted. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'minimum': 1}, + } + + _attribute_map = { + 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}}, + 'days': {'key': 'Days', 'type': 'int', 'xml': {'name': 'Days'}}, + } + _xml_map = { + 'name': 'RetentionPolicy' + } + + def __init__( + self, + **kwargs + ): + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = kwargs['enabled'] + self.days = kwargs.get('days', None) + + +class SignedIdentifier(msrest.serialization.Model): + """A signed identifier. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. A unique id. + :type id: str + :param access_policy: Required. The access policy. + :type access_policy: ~azure_table.models.AccessPolicy + """ + + _validation = { + 'id': {'required': True}, + 'access_policy': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'Id', 'type': 'str', 'xml': {'name': 'Id'}}, + 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy'}, + } + _xml_map = { + 'name': 'SignedIdentifier' + } + + def __init__( + self, + **kwargs + ): + super(SignedIdentifier, self).__init__(**kwargs) + self.id = kwargs['id'] + self.access_policy = kwargs['access_policy'] + + +class TableEntityQueryResponse(msrest.serialization.Model): + """The properties for the table entity query response. + + :param odata_metadata: The metadata response of the table. + :type odata_metadata: str + :param value: List of table entities. + :type value: list[dict[str, object]] + """ + + _attribute_map = { + 'odata_metadata': {'key': 'odata\\.metadata', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[{object}]'}, + } + + def __init__( + self, + **kwargs + ): + super(TableEntityQueryResponse, self).__init__(**kwargs) + self.odata_metadata = kwargs.get('odata_metadata', None) + self.value = kwargs.get('value', None) + + +class TableProperties(msrest.serialization.Model): + """The properties for creating a table. + + :param table_name: The name of the table to create. + :type table_name: str + """ + + _attribute_map = { + 'table_name': {'key': 'TableName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TableProperties, self).__init__(**kwargs) + self.table_name = kwargs.get('table_name', None) + + +class TableQueryResponse(msrest.serialization.Model): + """The properties for the table query response. + + :param odata_metadata: The metadata response of the table. + :type odata_metadata: str + :param value: List of tables. + :type value: list[~azure_table.models.TableResponseProperties] + """ + + _attribute_map = { + 'odata_metadata': {'key': 'odata\\.metadata', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[TableResponseProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(TableQueryResponse, self).__init__(**kwargs) + self.odata_metadata = kwargs.get('odata_metadata', None) + self.value = kwargs.get('value', None) + + +class TableResponseProperties(msrest.serialization.Model): + """The properties for the table response. + + :param table_name: The name of the table. + :type table_name: str + :param odata_type: The odata type of the table. + :type odata_type: str + :param odata_id: The id of the table. + :type odata_id: str + :param odata_edit_link: The edit link of the table. + :type odata_edit_link: str + """ + + _attribute_map = { + 'table_name': {'key': 'TableName', 'type': 'str'}, + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'odata_id': {'key': 'odata\\.id', 'type': 'str'}, + 'odata_edit_link': {'key': 'odata\\.editLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TableResponseProperties, self).__init__(**kwargs) + self.table_name = kwargs.get('table_name', None) + self.odata_type = kwargs.get('odata_type', None) + self.odata_id = kwargs.get('odata_id', None) + self.odata_edit_link = kwargs.get('odata_edit_link', None) + + +class TableResponse(TableResponseProperties): + """The response for a single table. + + :param table_name: The name of the table. + :type table_name: str + :param odata_type: The odata type of the table. + :type odata_type: str + :param odata_id: The id of the table. + :type odata_id: str + :param odata_edit_link: The edit link of the table. + :type odata_edit_link: str + :param odata_metadata: The metadata response of the table. + :type odata_metadata: str + """ + + _attribute_map = { + 'table_name': {'key': 'TableName', 'type': 'str'}, + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'odata_id': {'key': 'odata\\.id', 'type': 'str'}, + 'odata_edit_link': {'key': 'odata\\.editLink', 'type': 'str'}, + 'odata_metadata': {'key': 'odata\\.metadata', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TableResponse, self).__init__(**kwargs) + self.odata_metadata = kwargs.get('odata_metadata', None) + + +class TableServiceError(msrest.serialization.Model): + """Table Service error. + + :param message: The error message. + :type message: str + """ + + _attribute_map = { + 'message': {'key': 'Message', 'type': 'str', 'xml': {'name': 'Message'}}, + } + _xml_map = { + + } + + def __init__( + self, + **kwargs + ): + super(TableServiceError, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + + +class TableServiceProperties(msrest.serialization.Model): + """Table Service Properties. + + :param logging: Azure Analytics Logging settings. + :type logging: ~azure_table.models.Logging + :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for + tables. + :type hour_metrics: ~azure_table.models.Metrics + :param minute_metrics: A summary of request statistics grouped by API in minute aggregates for + tables. + :type minute_metrics: ~azure_table.models.Metrics + :param cors: The set of CORS rules. + :type cors: list[~azure_table.models.CorsRule] + """ + + _attribute_map = { + 'logging': {'key': 'Logging', 'type': 'Logging'}, + 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics'}, + 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics'}, + 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'name': 'Cors', 'wrapped': True, 'itemsName': 'CorsRule'}}, + } + _xml_map = { + 'name': 'StorageServiceProperties' + } + + def __init__( + self, + **kwargs + ): + super(TableServiceProperties, self).__init__(**kwargs) + self.logging = kwargs.get('logging', None) + self.hour_metrics = kwargs.get('hour_metrics', None) + self.minute_metrics = kwargs.get('minute_metrics', None) + self.cors = kwargs.get('cors', None) + + +class TableServiceStats(msrest.serialization.Model): + """Stats for the service. + + :param geo_replication: Geo-Replication information for the Secondary Storage Service. + :type geo_replication: ~azure_table.models.GeoReplication + """ + + _attribute_map = { + 'geo_replication': {'key': 'GeoReplication', 'type': 'GeoReplication'}, + } + _xml_map = { + 'name': 'StorageServiceStats' + } + + def __init__( + self, + **kwargs + ): + super(TableServiceStats, self).__init__(**kwargs) + self.geo_replication = kwargs.get('geo_replication', None) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models_py3.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models_py3.py new file mode 100644 index 000000000000..001b3ff92b4b --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models_py3.py @@ -0,0 +1,607 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._azure_table_enums import * + + +class AccessPolicy(msrest.serialization.Model): + """An Access policy. + + All required parameters must be populated in order to send to Azure. + + :param start: Required. The start datetime from which the policy is active. + :type start: ~datetime.datetime + :param expiry: Required. The datetime that the policy expires. + :type expiry: ~datetime.datetime + :param permission: Required. The permissions for the acl policy. + :type permission: str + """ + + _validation = { + 'start': {'required': True}, + 'expiry': {'required': True}, + 'permission': {'required': True}, + } + + _attribute_map = { + 'start': {'key': 'Start', 'type': 'str', 'xml': {'name': 'Start'}}, + 'expiry': {'key': 'Expiry', 'type': 'str', 'xml': {'name': 'Expiry'}}, + 'permission': {'key': 'Permission', 'type': 'str', 'xml': {'name': 'Permission'}}, + } + _xml_map = { + 'name': 'AccessPolicy' + } + + def __init__( + self, + *, + start: datetime.datetime, + expiry: datetime.datetime, + permission: str, + **kwargs + ): + super(AccessPolicy, self).__init__(**kwargs) + self.start = start + self.expiry = expiry + self.permission = permission + + +class CorsRule(msrest.serialization.Model): + """CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain. + + All required parameters must be populated in order to send to Azure. + + :param allowed_origins: Required. The origin domains that are permitted to make a request + against the service via CORS. The origin domain is the domain from which the request + originates. Note that the origin must be an exact case-sensitive match with the origin that the + user age sends to the service. You can also use the wildcard character '*' to allow all origin + domains to make requests via CORS. + :type allowed_origins: str + :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + use for a CORS request. (comma separated). + :type allowed_methods: str + :param allowed_headers: Required. The request headers that the origin domain may specify on the + CORS request. + :type allowed_headers: str + :param exposed_headers: Required. The response headers that may be sent in the response to the + CORS request and exposed by the browser to the request issuer. + :type exposed_headers: str + :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the + preflight OPTIONS request. + :type max_age_in_seconds: int + """ + + _validation = { + 'allowed_origins': {'required': True}, + 'allowed_methods': {'required': True}, + 'allowed_headers': {'required': True}, + 'exposed_headers': {'required': True}, + 'max_age_in_seconds': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'allowed_origins': {'key': 'AllowedOrigins', 'type': 'str', 'xml': {'name': 'AllowedOrigins'}}, + 'allowed_methods': {'key': 'AllowedMethods', 'type': 'str', 'xml': {'name': 'AllowedMethods'}}, + 'allowed_headers': {'key': 'AllowedHeaders', 'type': 'str', 'xml': {'name': 'AllowedHeaders'}}, + 'exposed_headers': {'key': 'ExposedHeaders', 'type': 'str', 'xml': {'name': 'ExposedHeaders'}}, + 'max_age_in_seconds': {'key': 'MaxAgeInSeconds', 'type': 'int', 'xml': {'name': 'MaxAgeInSeconds'}}, + } + _xml_map = { + 'name': 'CorsRule' + } + + def __init__( + self, + *, + allowed_origins: str, + allowed_methods: str, + allowed_headers: str, + exposed_headers: str, + max_age_in_seconds: int, + **kwargs + ): + super(CorsRule, self).__init__(**kwargs) + self.allowed_origins = allowed_origins + self.allowed_methods = allowed_methods + self.allowed_headers = allowed_headers + self.exposed_headers = exposed_headers + self.max_age_in_seconds = max_age_in_seconds + + +class GeoReplication(msrest.serialization.Model): + """GeoReplication. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The status of the secondary location. Possible values include: "live", + "bootstrap", "unavailable". + :type status: str or ~azure_table.models.GeoReplicationStatusType + :param last_sync_time: Required. A GMT date/time value, to the second. All primary writes + preceding this value are guaranteed to be available for read operations at the secondary. + Primary writes after this point in time may or may not be available for reads. + :type last_sync_time: ~datetime.datetime + """ + + _validation = { + 'status': {'required': True}, + 'last_sync_time': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'Status', 'type': 'str', 'xml': {'name': 'Status'}}, + 'last_sync_time': {'key': 'LastSyncTime', 'type': 'rfc-1123', 'xml': {'name': 'LastSyncTime'}}, + } + _xml_map = { + 'name': 'GeoReplication' + } + + def __init__( + self, + *, + status: Union[str, "GeoReplicationStatusType"], + last_sync_time: datetime.datetime, + **kwargs + ): + super(GeoReplication, self).__init__(**kwargs) + self.status = status + self.last_sync_time = last_sync_time + + +class Logging(msrest.serialization.Model): + """Azure Analytics Logging settings. + + All required parameters must be populated in order to send to Azure. + + :param version: Required. The version of Analytics to configure. + :type version: str + :param delete: Required. Indicates whether all delete requests should be logged. + :type delete: bool + :param read: Required. Indicates whether all read requests should be logged. + :type read: bool + :param write: Required. Indicates whether all write requests should be logged. + :type write: bool + :param retention_policy: Required. The retention policy. + :type retention_policy: ~azure_table.models.RetentionPolicy + """ + + _validation = { + 'version': {'required': True}, + 'delete': {'required': True}, + 'read': {'required': True}, + 'write': {'required': True}, + 'retention_policy': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}}, + 'delete': {'key': 'Delete', 'type': 'bool', 'xml': {'name': 'Delete'}}, + 'read': {'key': 'Read', 'type': 'bool', 'xml': {'name': 'Read'}}, + 'write': {'key': 'Write', 'type': 'bool', 'xml': {'name': 'Write'}}, + 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'}, + } + _xml_map = { + 'name': 'Logging' + } + + def __init__( + self, + *, + version: str, + delete: bool, + read: bool, + write: bool, + retention_policy: "RetentionPolicy", + **kwargs + ): + super(Logging, self).__init__(**kwargs) + self.version = version + self.delete = delete + self.read = read + self.write = write + self.retention_policy = retention_policy + + +class Metrics(msrest.serialization.Model): + """Metrics. + + All required parameters must be populated in order to send to Azure. + + :param version: The version of Analytics to configure. + :type version: str + :param enabled: Required. Indicates whether metrics are enabled for the Table service. + :type enabled: bool + :param include_apis: Indicates whether metrics should generate summary statistics for called + API operations. + :type include_apis: bool + :param retention_policy: The retention policy. + :type retention_policy: ~azure_table.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}}, + 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}}, + 'include_apis': {'key': 'IncludeAPIs', 'type': 'bool', 'xml': {'name': 'IncludeAPIs'}}, + 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'}, + } + _xml_map = { + + } + + def __init__( + self, + *, + enabled: bool, + version: Optional[str] = None, + include_apis: Optional[bool] = None, + retention_policy: Optional["RetentionPolicy"] = None, + **kwargs + ): + super(Metrics, self).__init__(**kwargs) + self.version = version + self.enabled = enabled + self.include_apis = include_apis + self.retention_policy = retention_policy + + +class QueryOptions(msrest.serialization.Model): + """Parameter group. + + :param format: Specifies the media type for the response. Possible values include: + "application/json;odata=nometadata", "application/json;odata=minimalmetadata", + "application/json;odata=fullmetadata". + :type format: str or ~azure_table.models.OdataMetadataFormat + :param top: Maximum number of records to return. + :type top: int + :param select: Select expression using OData notation. Limits the columns on each record to + just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + :type select: str + :param filter: OData filter expression. + :type filter: str + """ + + _validation = { + 'top': {'minimum': 0}, + } + + _attribute_map = { + 'format': {'key': 'Format', 'type': 'str'}, + 'top': {'key': 'Top', 'type': 'int'}, + 'select': {'key': 'Select', 'type': 'str'}, + 'filter': {'key': 'Filter', 'type': 'str'}, + } + + def __init__( + self, + *, + format: Optional[Union[str, "OdataMetadataFormat"]] = None, + top: Optional[int] = None, + select: Optional[str] = None, + filter: Optional[str] = None, + **kwargs + ): + super(QueryOptions, self).__init__(**kwargs) + self.format = format + self.top = top + self.select = select + self.filter = filter + + +class RetentionPolicy(msrest.serialization.Model): + """The retention policy. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. Indicates whether a retention policy is enabled for the service. + :type enabled: bool + :param days: Indicates the number of days that metrics or logging or soft-deleted data should + be retained. All data older than this value will be deleted. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'minimum': 1}, + } + + _attribute_map = { + 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}}, + 'days': {'key': 'Days', 'type': 'int', 'xml': {'name': 'Days'}}, + } + _xml_map = { + 'name': 'RetentionPolicy' + } + + def __init__( + self, + *, + enabled: bool, + days: Optional[int] = None, + **kwargs + ): + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.days = days + + +class SignedIdentifier(msrest.serialization.Model): + """A signed identifier. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. A unique id. + :type id: str + :param access_policy: Required. The access policy. + :type access_policy: ~azure_table.models.AccessPolicy + """ + + _validation = { + 'id': {'required': True}, + 'access_policy': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'Id', 'type': 'str', 'xml': {'name': 'Id'}}, + 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy'}, + } + _xml_map = { + 'name': 'SignedIdentifier' + } + + def __init__( + self, + *, + id: str, + access_policy: "AccessPolicy", + **kwargs + ): + super(SignedIdentifier, self).__init__(**kwargs) + self.id = id + self.access_policy = access_policy + + +class TableEntityQueryResponse(msrest.serialization.Model): + """The properties for the table entity query response. + + :param odata_metadata: The metadata response of the table. + :type odata_metadata: str + :param value: List of table entities. + :type value: list[dict[str, object]] + """ + + _attribute_map = { + 'odata_metadata': {'key': 'odata\\.metadata', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[{object}]'}, + } + + def __init__( + self, + *, + odata_metadata: Optional[str] = None, + value: Optional[List[Dict[str, object]]] = None, + **kwargs + ): + super(TableEntityQueryResponse, self).__init__(**kwargs) + self.odata_metadata = odata_metadata + self.value = value + + +class TableProperties(msrest.serialization.Model): + """The properties for creating a table. + + :param table_name: The name of the table to create. + :type table_name: str + """ + + _attribute_map = { + 'table_name': {'key': 'TableName', 'type': 'str'}, + } + + def __init__( + self, + *, + table_name: Optional[str] = None, + **kwargs + ): + super(TableProperties, self).__init__(**kwargs) + self.table_name = table_name + + +class TableQueryResponse(msrest.serialization.Model): + """The properties for the table query response. + + :param odata_metadata: The metadata response of the table. + :type odata_metadata: str + :param value: List of tables. + :type value: list[~azure_table.models.TableResponseProperties] + """ + + _attribute_map = { + 'odata_metadata': {'key': 'odata\\.metadata', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[TableResponseProperties]'}, + } + + def __init__( + self, + *, + odata_metadata: Optional[str] = None, + value: Optional[List["TableResponseProperties"]] = None, + **kwargs + ): + super(TableQueryResponse, self).__init__(**kwargs) + self.odata_metadata = odata_metadata + self.value = value + + +class TableResponseProperties(msrest.serialization.Model): + """The properties for the table response. + + :param table_name: The name of the table. + :type table_name: str + :param odata_type: The odata type of the table. + :type odata_type: str + :param odata_id: The id of the table. + :type odata_id: str + :param odata_edit_link: The edit link of the table. + :type odata_edit_link: str + """ + + _attribute_map = { + 'table_name': {'key': 'TableName', 'type': 'str'}, + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'odata_id': {'key': 'odata\\.id', 'type': 'str'}, + 'odata_edit_link': {'key': 'odata\\.editLink', 'type': 'str'}, + } + + def __init__( + self, + *, + table_name: Optional[str] = None, + odata_type: Optional[str] = None, + odata_id: Optional[str] = None, + odata_edit_link: Optional[str] = None, + **kwargs + ): + super(TableResponseProperties, self).__init__(**kwargs) + self.table_name = table_name + self.odata_type = odata_type + self.odata_id = odata_id + self.odata_edit_link = odata_edit_link + + +class TableResponse(TableResponseProperties): + """The response for a single table. + + :param table_name: The name of the table. + :type table_name: str + :param odata_type: The odata type of the table. + :type odata_type: str + :param odata_id: The id of the table. + :type odata_id: str + :param odata_edit_link: The edit link of the table. + :type odata_edit_link: str + :param odata_metadata: The metadata response of the table. + :type odata_metadata: str + """ + + _attribute_map = { + 'table_name': {'key': 'TableName', 'type': 'str'}, + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'odata_id': {'key': 'odata\\.id', 'type': 'str'}, + 'odata_edit_link': {'key': 'odata\\.editLink', 'type': 'str'}, + 'odata_metadata': {'key': 'odata\\.metadata', 'type': 'str'}, + } + + def __init__( + self, + *, + table_name: Optional[str] = None, + odata_type: Optional[str] = None, + odata_id: Optional[str] = None, + odata_edit_link: Optional[str] = None, + odata_metadata: Optional[str] = None, + **kwargs + ): + super(TableResponse, self).__init__(table_name=table_name, odata_type=odata_type, odata_id=odata_id, odata_edit_link=odata_edit_link, **kwargs) + self.odata_metadata = odata_metadata + + +class TableServiceError(msrest.serialization.Model): + """Table Service error. + + :param message: The error message. + :type message: str + """ + + _attribute_map = { + 'message': {'key': 'Message', 'type': 'str', 'xml': {'name': 'Message'}}, + } + _xml_map = { + + } + + def __init__( + self, + *, + message: Optional[str] = None, + **kwargs + ): + super(TableServiceError, self).__init__(**kwargs) + self.message = message + + +class TableServiceProperties(msrest.serialization.Model): + """Table Service Properties. + + :param logging: Azure Analytics Logging settings. + :type logging: ~azure_table.models.Logging + :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for + tables. + :type hour_metrics: ~azure_table.models.Metrics + :param minute_metrics: A summary of request statistics grouped by API in minute aggregates for + tables. + :type minute_metrics: ~azure_table.models.Metrics + :param cors: The set of CORS rules. + :type cors: list[~azure_table.models.CorsRule] + """ + + _attribute_map = { + 'logging': {'key': 'Logging', 'type': 'Logging'}, + 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics'}, + 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics'}, + 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'name': 'Cors', 'wrapped': True, 'itemsName': 'CorsRule'}}, + } + _xml_map = { + 'name': 'StorageServiceProperties' + } + + def __init__( + self, + *, + logging: Optional["Logging"] = None, + hour_metrics: Optional["Metrics"] = None, + minute_metrics: Optional["Metrics"] = None, + cors: Optional[List["CorsRule"]] = None, + **kwargs + ): + super(TableServiceProperties, self).__init__(**kwargs) + self.logging = logging + self.hour_metrics = hour_metrics + self.minute_metrics = minute_metrics + self.cors = cors + + +class TableServiceStats(msrest.serialization.Model): + """Stats for the service. + + :param geo_replication: Geo-Replication information for the Secondary Storage Service. + :type geo_replication: ~azure_table.models.GeoReplication + """ + + _attribute_map = { + 'geo_replication': {'key': 'GeoReplication', 'type': 'GeoReplication'}, + } + _xml_map = { + 'name': 'StorageServiceStats' + } + + def __init__( + self, + *, + geo_replication: Optional["GeoReplication"] = None, + **kwargs + ): + super(TableServiceStats, self).__init__(**kwargs) + self.geo_replication = geo_replication diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/__init__.py new file mode 100644 index 000000000000..1298fa41c6f8 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._table_operations import TableOperations +from ._service_operations import ServiceOperations + +__all__ = [ + 'TableOperations', + 'ServiceOperations', +] diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_service_operations.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_service_operations.py new file mode 100644 index 000000000000..be2f182e168a --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_service_operations.py @@ -0,0 +1,253 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ServiceOperations(object): + """ServiceOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_table.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def set_properties( + self, + table_service_properties, # type: "models.TableServiceProperties" + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Sets properties for an account's Table service endpoint, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param table_service_properties: The Table Service properties. + :type table_service_properties: ~azure_table.models.TableServiceProperties + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + restype = "service" + comp = "properties" + content_type = kwargs.pop("content_type", "application/xml") + + # Construct URL + url = self.set_properties.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['restype'] = self._serialize.query("restype", restype, 'str') + query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(table_service_properties, 'TableServiceProperties', is_xml=True) + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + + if cls: + return cls(pipeline_response, None, response_headers) + + set_properties.metadata = {'url': '/'} # type: ignore + + def get_properties( + self, + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.TableServiceProperties" + """Gets the properties of an account's Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableServiceProperties, or the result of cls(response) + :rtype: ~azure_table.models.TableServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableServiceProperties"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + restype = "service" + comp = "properties" + + # Construct URL + url = self.get_properties.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['restype'] = self._serialize.query("restype", restype, 'str') + query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['Accept'] = 'application/xml' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('TableServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_properties.metadata = {'url': '/'} # type: ignore + + def get_statistics( + self, + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.TableServiceStats" + """Retrieves statistics related to replication for the Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the account. + + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableServiceStats, or the result of cls(response) + :rtype: ~azure_table.models.TableServiceStats + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableServiceStats"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + restype = "service" + comp = "stats" + + # Construct URL + url = self.get_statistics.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['restype'] = self._serialize.query("restype", restype, 'str') + query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['Accept'] = 'application/xml' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('TableServiceStats', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_statistics.metadata = {'url': '/'} # type: ignore diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_table_operations.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_table_operations.py new file mode 100644 index 000000000000..9686ea544832 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_table_operations.py @@ -0,0 +1,1058 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TableOperations(object): + """TableOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_table.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def query( + self, + request_id_parameter=None, # type: Optional[str] + next_table_name=None, # type: Optional[str] + query_options=None, # type: Optional["models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.TableQueryResponse" + """Queries tables under the given account. + + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param next_table_name: A table query continuation token from a previous call. + :type next_table_name: str + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableQueryResponse, or the result of cls(response) + :rtype: ~azure_table.models.TableQueryResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableQueryResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + _top = None + _select = None + _filter = None + if query_options is not None: + _format = query_options.format + _top = query_options.top + _select = query_options.select + _filter = query_options.filter + data_service_version = "3.0" + + # Construct URL + url = self.query.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + if _top is not None: + query_parameters['$top'] = self._serialize.query("top", _top, 'int', minimum=0) + if _select is not None: + query_parameters['$select'] = self._serialize.query("select", _select, 'str') + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + if next_table_name is not None: + query_parameters['NextTableName'] = self._serialize.query("next_table_name", next_table_name, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + header_parameters['Accept'] = 'application/json;odata=minimalmetadata' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['x-ms-continuation-NextTableName']=self._deserialize('str', response.headers.get('x-ms-continuation-NextTableName')) + deserialized = self._deserialize('TableQueryResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + query.metadata = {'url': '/Tables'} # type: ignore + + def create( + self, + table_properties, # type: "models.TableProperties" + request_id_parameter=None, # type: Optional[str] + response_preference=None, # type: Optional[Union[str, "models.ResponseFormat"]] + query_options=None, # type: Optional["models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.TableResponse" + """Creates a new table under the given account. + + :param table_properties: The Table properties. + :type table_properties: ~azure_table.models.TableProperties + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param response_preference: Specifies whether the response should include the inserted entity + in the payload. Possible values are return-no-content and return-content. + :type response_preference: str or ~azure_table.models.ResponseFormat + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableResponse, or the result of cls(response) + :rtype: ~azure_table.models.TableResponse or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + if query_options is not None: + _format = query_options.format + data_service_version = "3.0" + content_type = kwargs.pop("content_type", "application/json;odata=nometadata") + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + if response_preference is not None: + header_parameters['Prefer'] = self._serialize.header("response_preference", response_preference, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json;odata=minimalmetadata' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(table_properties, 'TableProperties') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 201: + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['Preference-Applied']=self._deserialize('str', response.headers.get('Preference-Applied')) + deserialized = self._deserialize('TableResponse', pipeline_response) + + if response.status_code == 204: + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['Preference-Applied']=self._deserialize('str', response.headers.get('Preference-Applied')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + create.metadata = {'url': '/Tables'} # type: ignore + + def delete( + self, + table, # type: str + request_id_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Operation permanently deletes the specified table. + + :param table: The name of the table. + :type table: str + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete.metadata = {'url': '/Tables(\'{table}\')'} # type: ignore + + def query_entities( + self, + table, # type: str + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + next_partition_key=None, # type: Optional[str] + next_row_key=None, # type: Optional[str] + query_options=None, # type: Optional["models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.TableEntityQueryResponse" + """Queries entities in a table. + + :param table: The name of the table. + :type table: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param next_partition_key: An entity query continuation token from a previous call. + :type next_partition_key: str + :param next_row_key: An entity query continuation token from a previous call. + :type next_row_key: str + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableEntityQueryResponse, or the result of cls(response) + :rtype: ~azure_table.models.TableEntityQueryResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableEntityQueryResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + _top = None + _select = None + _filter = None + if query_options is not None: + _format = query_options.format + _top = query_options.top + _select = query_options.select + _filter = query_options.filter + data_service_version = "3.0" + + # Construct URL + url = self.query_entities.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + if _top is not None: + query_parameters['$top'] = self._serialize.query("top", _top, 'int', minimum=0) + if _select is not None: + query_parameters['$select'] = self._serialize.query("select", _select, 'str') + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + if next_partition_key is not None: + query_parameters['NextPartitionKey'] = self._serialize.query("next_partition_key", next_partition_key, 'str') + if next_row_key is not None: + query_parameters['NextRowKey'] = self._serialize.query("next_row_key", next_row_key, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + header_parameters['Accept'] = 'application/json;odata=minimalmetadata' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['x-ms-continuation-NextPartitionKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextPartitionKey')) + response_headers['x-ms-continuation-NextRowKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextRowKey')) + deserialized = self._deserialize('TableEntityQueryResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + query_entities.metadata = {'url': '/{table}()'} # type: ignore + + def query_entities_with_partition_and_row_key( + self, + table, # type: str + partition_key, # type: str + row_key, # type: str + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + query_options=None, # type: Optional["models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.TableEntityQueryResponse" + """Queries entities in a table. + + :param table: The name of the table. + :type table: str + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableEntityQueryResponse, or the result of cls(response) + :rtype: ~azure_table.models.TableEntityQueryResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TableEntityQueryResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + _select = None + _filter = None + if query_options is not None: + _format = query_options.format + _select = query_options.select + _filter = query_options.filter + data_service_version = "3.0" + + # Construct URL + url = self.query_entities_with_partition_and_row_key.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + 'partitionKey': self._serialize.url("partition_key", partition_key, 'str'), + 'rowKey': self._serialize.url("row_key", row_key, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + if _select is not None: + query_parameters['$select'] = self._serialize.query("select", _select, 'str') + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + header_parameters['Accept'] = 'application/json;odata=minimalmetadata' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + response_headers['x-ms-continuation-NextPartitionKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextPartitionKey')) + response_headers['x-ms-continuation-NextRowKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextRowKey')) + deserialized = self._deserialize('TableEntityQueryResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + query_entities_with_partition_and_row_key.metadata = {'url': '/{table}(PartitionKey=\'{partitionKey}\',RowKey=\'{rowKey}\')'} # type: ignore + + def update_entity( + self, + table, # type: str + partition_key, # type: str + row_key, # type: str + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + if_match=None, # type: Optional[str] + table_entity_properties=None, # type: Optional[Dict[str, object]] + query_options=None, # type: Optional["models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> None + """Update entity in a table. + + :param table: The name of the table. + :type table: str + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param if_match: Match condition for an entity to be updated. If specified and a matching + entity is not found, an error will be raised. To force an unconditional update, set to the + wildcard character (*). If not specified, an insert will be performed when no existing entity + is found to update and a replace will be performed if an existing entity is found. + :type if_match: str + :param table_entity_properties: The properties for the table entity. + :type table_entity_properties: dict[str, object] + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + if query_options is not None: + _format = query_options.format + data_service_version = "3.0" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_entity.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + 'partitionKey': self._serialize.url("partition_key", partition_key, 'str'), + 'rowKey': self._serialize.url("row_key", row_key, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + if table_entity_properties is not None: + body_content = self._serialize.body(table_entity_properties, '{object}') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + if cls: + return cls(pipeline_response, None, response_headers) + + update_entity.metadata = {'url': '/{table}(PartitionKey=\'{partitionKey}\',RowKey=\'{rowKey}\')'} # type: ignore + + def merge_entity( + self, + table, # type: str + partition_key, # type: str + row_key, # type: str + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + if_match=None, # type: Optional[str] + table_entity_properties=None, # type: Optional[Dict[str, object]] + query_options=None, # type: Optional["models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> None + """Merge entity in a table. + + :param table: The name of the table. + :type table: str + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param if_match: Match condition for an entity to be updated. If specified and a matching + entity is not found, an error will be raised. To force an unconditional update, set to the + wildcard character (*). If not specified, an insert will be performed when no existing entity + is found to update and a merge will be performed if an existing entity is found. + :type if_match: str + :param table_entity_properties: The properties for the table entity. + :type table_entity_properties: dict[str, object] + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + if query_options is not None: + _format = query_options.format + data_service_version = "3.0" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.merge_entity.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + 'partitionKey': self._serialize.url("partition_key", partition_key, 'str'), + 'rowKey': self._serialize.url("row_key", row_key, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + if table_entity_properties is not None: + body_content = self._serialize.body(table_entity_properties, '{object}') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + if cls: + return cls(pipeline_response, None, response_headers) + + merge_entity.metadata = {'url': '/{table}(PartitionKey=\'{partitionKey}\',RowKey=\'{rowKey}\')'} # type: ignore + + def delete_entity( + self, + table, # type: str + partition_key, # type: str + row_key, # type: str + if_match, # type: str + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + query_options=None, # type: Optional["models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the specified entity in a table. + + :param table: The name of the table. + :type table: str + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :param if_match: Match condition for an entity to be deleted. If specified and a matching + entity is not found, an error will be raised. To force an unconditional delete, set to the + wildcard character (*). + :type if_match: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + if query_options is not None: + _format = query_options.format + data_service_version = "3.0" + + # Construct URL + url = self.delete_entity.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + 'partitionKey': self._serialize.url("partition_key", partition_key, 'str'), + 'rowKey': self._serialize.url("row_key", row_key, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete_entity.metadata = {'url': '/{table}(PartitionKey=\'{partitionKey}\',RowKey=\'{rowKey}\')'} # type: ignore + + def insert_entity( + self, + table, # type: str + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + response_preference=None, # type: Optional[Union[str, "models.ResponseFormat"]] + table_entity_properties=None, # type: Optional[Dict[str, object]] + query_options=None, # type: Optional["models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> Dict[str, object] + """Insert entity in a table. + + :param table: The name of the table. + :type table: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param response_preference: Specifies whether the response should include the inserted entity + in the payload. Possible values are return-no-content and return-content. + :type response_preference: str or ~azure_table.models.ResponseFormat + :param table_entity_properties: The properties for the table entity. + :type table_entity_properties: dict[str, object] + :param query_options: Parameter group. + :type query_options: ~azure_table.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: dict mapping str to object, or the result of cls(response) + :rtype: dict[str, object] or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, object]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _format = None + if query_options is not None: + _format = query_options.format + data_service_version = "3.0" + content_type = kwargs.pop("content_type", "application/json;odata=nometadata") + + # Construct URL + url = self.insert_entity.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + if _format is not None: + query_parameters['$format'] = self._serialize.query("format", _format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') + if response_preference is not None: + header_parameters['Prefer'] = self._serialize.header("response_preference", response_preference, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json;odata=minimalmetadata' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + if table_entity_properties is not None: + body_content = self._serialize.body(table_entity_properties, '{object}') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 201: + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + response_headers['Preference-Applied']=self._deserialize('str', response.headers.get('Preference-Applied')) + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = self._deserialize('{object}', pipeline_response) + + if response.status_code == 204: + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + response_headers['Preference-Applied']=self._deserialize('str', response.headers.get('Preference-Applied')) + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + insert_entity.metadata = {'url': '/{table}'} # type: ignore + + def get_access_policy( + self, + table, # type: str + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["models.SignedIdentifier"] + """Retrieves details about any stored access policies specified on the table that may be used with Shared Access Signatures. + + :param table: The name of the table. + :type table: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of SignedIdentifier, or the result of cls(response) + :rtype: list[~azure_table.models.SignedIdentifier] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["models.SignedIdentifier"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + comp = "acl" + + # Construct URL + url = self.get_access_policy.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['Accept'] = 'application/xml' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[SignedIdentifier]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_access_policy.metadata = {'url': '/{table}'} # type: ignore + + def set_access_policy( + self, + table, # type: str + timeout=None, # type: Optional[int] + request_id_parameter=None, # type: Optional[str] + table_acl=None, # type: Optional[List["models.SignedIdentifier"]] + **kwargs # type: Any + ): + # type: (...) -> None + """Sets stored access policies for the table that may be used with Shared Access Signatures. + + :param table: The name of the table. + :type table: str + :param timeout: The timeout parameter is expressed in seconds. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when analytics logging is enabled. + :type request_id_parameter: str + :param table_acl: The acls for the table. + :type table_acl: list[~azure_table.models.SignedIdentifier] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + comp = "acl" + content_type = kwargs.pop("content_type", "application/xml") + + # Construct URL + url = self.set_access_policy.metadata['url'] # type: ignore + path_format_arguments = { + 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), + 'table': self._serialize.url("table", table, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') + if request_id_parameter is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/xml' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True, 'itemsName': 'SignedIdentifier'}} + if table_acl is not None: + body_content = self._serialize.body(table_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.TableServiceError, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + + if cls: + return cls(pipeline_response, None, response_headers) + + set_access_policy.metadata = {'url': '/{table}'} # type: ignore diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/py.typed b/sdk/tables/azure-data-tables/azure/data/tables/_generated/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/version.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/version.py new file mode 100644 index 000000000000..629812170000 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2019-07-07" + diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/_models.py new file mode 100644 index 000000000000..36d203b46690 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_models.py @@ -0,0 +1,499 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from enum import Enum +from azure.core.exceptions import HttpResponseError +from azure.core.paging import PageIterator +from azure.data.tables._generated.models import TableServiceStats as GenTableServiceStats + +from ._deserialize import _convert_to_entity +from ._shared.models import Services +from ._shared.response_handlers import return_context_and_deserialized, process_table_error +from ._generated.models import AccessPolicy as GenAccessPolicy +from ._generated.models import Logging as GeneratedLogging +from ._generated.models import Metrics as GeneratedMetrics +from ._generated.models import RetentionPolicy as GeneratedRetentionPolicy +from ._generated.models import CorsRule as GeneratedCorsRule + + +class TableServiceStats(GenTableServiceStats): + """Stats for the service + :param geo_replication: Geo-Replication information for the Secondary Storage Service. + :type geo_replication: ~azure_table.models.GeoReplication + """ + + def __init__(self, geo_replication=None, **kwargs): # pylint:disable=W0231 + self.geo_replication = geo_replication + + +class AccessPolicy(GenAccessPolicy): + """Access Policy class used by the set and get access policy methods. + + A stored access policy can specify the start time, expiry time, and + permissions for the Shared Access Signatures with which it's associated. + Depending on how you want to control access to your resource, you can + specify all of these parameters within the stored access policy, and omit + them from the URL for the Shared Access Signature. Doing so permits you to + modify the associated signature's behavior at any time, as well as to revoke + it. Or you can specify one or more of the access policy parameters within + the stored access policy, and the others on the URL. Finally, you can + specify all of the parameters on the URL. In this case, you can use the + stored access policy to revoke the signature, but not to modify its behavior. + + Together the Shared Access Signature and the stored access policy must + include all fields required to authenticate the signature. If any required + fields are missing, the request will fail. Likewise, if a field is specified + both in the Shared Access Signature URL and in the stored access policy, the + request will fail with status code 400 (Bad Request). + + :param str permission: + The permissions associated with the shared access signature. The + user is restricted to operations allowed by the permissions. + Required unless an id is given referencing a stored access policy + which contains this field. This field must be omitted if it has been + specified in an associated stored access policy. + :param expiry: + The time at which the shared access signature becomes invalid. + Required unless an id is given referencing a stored access policy + which contains this field. This field must be omitted if it has + been specified in an associated stored access policy. Azure will always + convert values to UTC. If a date is passed in without timezone info, it + is assumed to be UTC. + :type expiry: ~datetime.datetime or str + :param start: + The time at which the shared access signature becomes valid. If + omitted, start time for this call is assumed to be the time when the + storage service receives the request. Azure will always convert values + to UTC. If a date is passed in without timezone info, it is assumed to + be UTC. + :type start: ~datetime.datetime or str + """ + + def __init__(self, permission=None, expiry=None, start=None, **kwargs): # pylint:disable=W0231 + self.start = start + self.expiry = expiry + self.permission = permission + + +class TableAnalyticsLogging(GeneratedLogging): + """Azure Analytics Logging settings. + + All required parameters must be populated in order to send to Azure. + + :keyword str version: Required. The version of Storage Analytics to configure. + :keyword bool delete: Required. Indicates whether all delete requests should be logged. + :keyword bool read: Required. Indicates whether all read requests should be logged. + :keyword bool write: Required. Indicates whether all write requests should be logged. + :keyword ~azure.data.tables.RetentionPolicy retention_policy: Required. + The retention policy for the metrics. + """ + + def __init__( # pylint:disable=W0231 + self, + **kwargs # type: Any + ): + # type: (...)-> None + + self.version = kwargs.get('version', u'1.0') + self.delete = kwargs.get('delete', False) + self.read = kwargs.get('read', False) + self.write = kwargs.get('write', False) + self.retention_policy = kwargs.get('retention_policy') or RetentionPolicy() + + @classmethod + def _from_generated(cls, generated): + if not generated: + return cls() + return cls( + version=generated.version, + delete=generated.delete, + read=generated.read, + write=generated.write, + retention_policy=RetentionPolicy._from_generated(generated.retention_policy) # pylint:disable=W0212 + # pylint: disable=protected-access + ) + + +class Metrics(GeneratedMetrics): + """A summary of request statistics grouped by API in hour or minute aggregates. + + All required parameters must be populated in order to send to Azure. + + :keyword str version: The version of Storage Analytics to configure. + :keyword bool enabled: Required. Indicates whether metrics are enabled for the service. + :keyword bool include_ap_is: Indicates whether metrics should generate summary + statistics for called API operations. + :keyword ~azure.data.tables.RetentionPolicy retention_policy: Required. + The retention policy for the metrics. + """ + + def __init__(self, # pylint:disable=W0231 + **kwargs # type: Any + ): + self.version = kwargs.get('version', u'1.0') + self.enabled = kwargs.get('enabled', False) + self.include_apis = kwargs.get('include_apis') + self.retention_policy = kwargs.get('retention_policy') or RetentionPolicy() + + @classmethod + def _from_generated(cls, generated): + # type: (...) -> cls + """A summary of request statistics grouped by API in hour or minute aggregates. + + :param Metrics generated: generated Metrics + """ + if not generated: + return cls() + return cls( + version=generated.version, + enabled=generated.enabled, + include_apis=generated.include_apis, + retention_policy=RetentionPolicy._from_generated(generated.retention_policy) # pylint:disable=W0212 + # pylint: disable=protected-access + ) + + +class RetentionPolicy(GeneratedRetentionPolicy): + + def __init__( # pylint:disable=W0231 + self, + enabled=False, # type: bool + days=None, # type: int + **kwargs # type: Any + ): + # type: (...) ->None + """The retention policy which determines how long the associated data should + persist. + + All required parameters must be populated in order to send to Azure. + + :param bool enabled: Required. Indicates whether a retention policy is enabled + for the storage service. + :param int days: Indicates the number of days that metrics or logging or + soft-deleted data should be retained. All data older than this value will + be deleted. + :param Any kwargs: + """ + self.enabled = enabled + self.days = days + if self.enabled and (self.days is None): + raise ValueError("If policy is enabled, 'days' must be specified.") + + @classmethod + def _from_generated(cls, generated, **kwargs): # pylint:disable=W0613 + # type: (...) -> cls + """The retention policy which determines how long the associated data should + persist. + + All required parameters must be populated in order to send to Azure. + + :param RetentionPolicy generated: Generated Retention Policy + """ + + if not generated: + return cls() + return cls( + enabled=generated.enabled, + days=generated.days, + ) + + +class CorsRule(GeneratedCorsRule): + """CORS is an HTTP feature that enables a web application running under one + domain to access resources in another domain. Web browsers implement a + security restriction known as same-origin policy that prevents a web page + from calling APIs in a different domain; CORS provides a secure way to + allow one domain (the origin domain) to call APIs in another domain. + + All required parameters must be populated in order to send to Azure. + + :param list[str] allowed_origins: + A list of origin domains that will be allowed via CORS, or "*" to allow + all domains. The list of must contain at least one entry. Limited to 64 + origin domains. Each allowed origin can have up to 256 characters. + :param list[str] allowed_methods: + A list of HTTP methods that are allowed to be executed by the origin. + The list of must contain at least one entry. For Azure Storage, + permitted methods are DELETE, GET, HEAD, MERGE, POST, OPTIONS or PUT. + :keyword int max_age_in_seconds: + The number of seconds that the client/browser should cache a + pre-flight response. + :keyword list[str] exposed_headers: + Defaults to an empty list. A list of response headers to expose to CORS + clients. Limited to 64 defined headers and two prefixed headers. Each + header can be up to 256 characters. + :keyword list[str] allowed_headers: + Defaults to an empty list. A list of headers allowed to be part of + the cross-origin request. Limited to 64 defined headers and 2 prefixed + headers. Each header can be up to 256 characters. + """ + + def __init__( # pylint:disable=W0231 + self, + allowed_origins, # type: list[str] + allowed_methods, # type: list[str] + **kwargs # type: Any + ): + # type: (...)-> None + + self.allowed_origins = ','.join(allowed_origins) + self.allowed_methods = ','.join(allowed_methods) + self.allowed_headers = ','.join(kwargs.get('allowed_headers', [])) + self.exposed_headers = ','.join(kwargs.get('exposed_headers', [])) + self.max_age_in_seconds = kwargs.get('max_age_in_seconds', 0) + + @classmethod + def _from_generated(cls, generated): + return cls( + [generated.allowed_origins], + [generated.allowed_methods], + allowed_headers=[generated.allowed_headers], + exposed_headers=[generated.exposed_headers], + max_age_in_seconds=generated.max_age_in_seconds, + ) + + +class TablePropertiesPaged(PageIterator): + """An iterable of Table properties. + + :keyword str service_endpoint: The service URL. + :keyword str prefix: A queue name prefix being used to filter the list. + :keyword str marker: The continuation token of the current page of results. + :keyword int results_per_page: The maximum number of results retrieved per API call. + :keyword str next_marker: The continuation token to retrieve the next page of results. + :keyword str location_mode: The location mode being used to list results. The available + options include "primary" and "secondary". + :param callable command: Function to retrieve the next page of items. + :param str prefix: Filters the results to return only queues whose names + begin with the specified prefix. + :param int results_per_page: The maximum number of queue names to retrieve per + call. + :param str continuation_token: An opaque continuation token. + """ + + def __init__(self, command, prefix=None, continuation_token=None): + super(TablePropertiesPaged, self).__init__( + self._get_next_cb, + self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command + self.prefix = prefix + self.next_table_name = None + self._headers = None + self.location_mode = None + + def _get_next_cb(self, continuation_token): + try: + return self._command( + next_table_name=continuation_token or None, + cls=return_context_and_deserialized, + use_location=self.location_mode + ) + except HttpResponseError as error: + process_table_error(error) + + def _extract_data_cb(self, get_next_return): + self.location_mode, self._response, self._headers = get_next_return + props_list = [] + props_list = [Table(t) for t in self._response.value] + return self._headers['x-ms-continuation-NextTableName'] or None, props_list + + +class TableEntityPropertiesPaged(PageIterator): + """An iterable of TableEntity properties. + + :keyword str service_endpoint: The service URL. + :keyword str prefix: A queue name prefix being used to filter the list. + :keyword str marker: The continuation token of the current page of results. + :keyword int results_per_page: The maximum number of results retrieved per API call. + :keyword str next_marker: The continuation token to retrieve the next page of results. + :keyword str location_mode: The location mode being used to list results. The available + options include "primary" and "secondary". + :param callable command: Function to retrieve the next page of items. + :param str prefix: Filters the results to return only queues whose names + begin with the specified prefix. + :param int results_per_page: The maximum number of queue names to retrieve per + call. + :param str continuation_token: An opaque continuation token. + """ + + def __init__(self, command, results_per_page=None, table=None, + continuation_token=None): + super(TableEntityPropertiesPaged, self).__init__( + self._get_next_cb, + self._extract_data_cb, + continuation_token=continuation_token or {} + ) + self._command = command + self._headers = None + self.results_per_page = results_per_page + self.table = table + self.location_mode = None + + def _get_next_cb(self, continuation_token): + row_key = "" + partition_key = "" + for key, value in continuation_token.items(): + if key == "RowKey": + row_key = value + if key == "PartitionKey": + partition_key = value + try: + return self._command( + query_options=self.results_per_page or None, + next_row_key=row_key or None, + next_partition_key=partition_key or None, + table=self.table, + cls=return_context_and_deserialized, + use_location=self.location_mode + ) + except HttpResponseError as error: + process_table_error(error) + + def _extract_data_cb(self, get_next_return): + self.location_mode, self._response, self._headers = get_next_return + props_list = [_convert_to_entity(t) for t in self._response.value] + next_entity = {} + if self._headers['x-ms-continuation-NextPartitionKey'] or self._headers['x-ms-continuation-NextRowKey']: + next_entity = {'PartitionKey': self._headers['x-ms-continuation-NextPartitionKey'], + 'RowKey': self._headers['x-ms-continuation-NextRowKey']} + return next_entity or None, props_list + + +class TableSasPermissions(object): + def __init__( + self, + _str=None, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """ + :keyword bool read: + Get entities and query entities. + :keyword bool add: + Add entities. Add and Update permissions are required for upsert operations. + :keyword bool update: + Update entities. Add and Update permissions are required for upsert operations. + :keyword bool delete: + Delete entities. + :param str _str: + A string representing the permissions. + """ + if not _str: + _str = '' + self.read = kwargs.pop('read', None) or ('r' in _str) + self.add = kwargs.pop('add', None) or ('a' in _str) + self.update = kwargs.pop('update', None) or ('u' in _str) + self.delete = kwargs.pop('delete', None) or ('d' in _str) + + def __or__(self, other): + return TableSasPermissions(_str=str(self) + str(other)) + + def __add__(self, other): + return TableSasPermissions(_str=str(self) + str(other)) + + def __str__(self): + return (('r' if self.read else '') + + ('a' if self.add else '') + + ('u' if self.update else '') + + ('d' if self.delete else '')) + + @classmethod + def from_string(cls, + permission, # type: str + **kwargs): # pylint:disable=W0613 + """Create AccountSasPermissions from a string. + + To specify read, write, delete, etc. permissions you need only to + include the first letter of the word in the string. E.g. for read and write + permissions you would provide a string "rw". + + :param str permission: Specify permissions in + the string with the first letter of the word. + :keyword callable cls: A custom type or function that will be passed the direct response + :return: A AccountSasPermissions object + :rtype: ~azure.data.tables.AccountSasPermissions + """ + p_read = 'r' in permission + p_add = 'a' in permission + p_delete = 'd' in permission + p_update = 'u' in permission + + parsed = cls( + **dict(kwargs, read=p_read, add=p_add, delete=p_delete, update=p_update)) + parsed._str = permission # pylint: disable = W0201 + return parsed + + +TableSasPermissions.READ = TableSasPermissions(**dict(read=True)) +TableSasPermissions.ADD = TableSasPermissions(**dict(add=True)) +TableSasPermissions.UPDATE = TableSasPermissions(**dict(update=True)) +TableSasPermissions.DELETE = TableSasPermissions(**dict(delete=True)) + + +def service_stats_deserialize(generated): + """Deserialize a ServiceStats objects into a dict. + """ + return { + 'geo_replication': { + 'status': generated.geo_replication.status, + 'last_sync_time': generated.geo_replication.last_sync_time, + } + } + + +def service_properties_deserialize(generated): + """Deserialize a ServiceProperties objects into a dict. + """ + return { + 'analytics_logging': TableAnalyticsLogging._from_generated(generated.logging), + # pylint: disable=protected-access + 'hour_metrics': Metrics._from_generated(generated.hour_metrics), # pylint: disable=protected-access + 'minute_metrics': Metrics._from_generated(generated.minute_metrics), # pylint: disable=protected-access + 'cors': [CorsRule._from_generated(cors) for cors in generated.cors], # pylint: disable=protected-access + } + + +class TableServices(Services): + def __str__(self): + return 't' + + +class Table(object): + """ + Represents an Azure Table. Returned by list_tables. + + :ivar str name: The name of the table. + """ + + def __init__(self, table): + self.table_name = table + + +class TablePayloadFormat(object): + ''' + Specifies the accepted content type of the response payload. More information + can be found here: https://msdn.microsoft.com/en-us/library/azure/dn535600.aspx + ''' + + JSON_NO_METADATA = 'application/json;odata=nometadata' + '''Returns no type information for the entity properties.''' + + JSON_MINIMAL_METADATA = 'application/json;odata=minimalmetadata' + '''Returns minimal type information for the entity properties.''' + + JSON_FULL_METADATA = 'application/json;odata=fullmetadata' + '''Returns minimal type information for the entity properties plus some extra odata properties.''' + + +class UpdateMode(str, Enum): + REPLACE = "replace" + MERGE = "merge" + + +class SASProtocol(str, Enum): + HTTPS = "https" + HTTP = "http" diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py b/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py new file mode 100644 index 000000000000..32e9db432c57 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py @@ -0,0 +1,217 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +# pylint: disable=no-self-use +import sys +import uuid +from uuid import UUID +from datetime import datetime + +from math import ( + isnan, +) + +from azure.core import MatchConditions +from ._entity import EdmType, EntityProperty +from ._models import TablePayloadFormat +from ._shared._common_conversion import _to_str, _encode_base64, _to_utc_datetime +from ._shared._error import _ERROR_VALUE_TOO_LARGE, _ERROR_TYPE_NOT_SUPPORTED + + + +_SUPPORTED_API_VERSIONS = [ + '2019-02-02', + '2019-07-07' +] + + +def _get_match_headers(kwargs, match_param, etag_param): + if_match = None + if_none_match = None + match_condition = kwargs.pop(match_param, None) + if match_condition == MatchConditions.IfNotModified: + if_match = kwargs.pop(etag_param, None) + if not if_match: + raise ValueError("'{}' specified without '{}'.".format(match_param, etag_param)) + elif match_condition == MatchConditions.IfPresent: + if_match = '*' + elif match_condition == MatchConditions.IfModified: + if_none_match = kwargs.pop(etag_param, None) + if not if_none_match: + raise ValueError("'{}' specified without '{}'.".format(match_param, etag_param)) + elif match_condition == MatchConditions.IfMissing: + if_none_match = '*' + elif match_condition is None: + if kwargs.get(etag_param): + raise ValueError("'{}' specified without '{}'.".format(etag_param, match_param)) + else: + raise TypeError("Invalid match condition: {}".format(match_condition)) + return if_match, if_none_match + + +def get_api_version(kwargs, default): + # type: (Dict[str, Any]) -> str + api_version = kwargs.pop('api_version', None) + if api_version and api_version not in _SUPPORTED_API_VERSIONS: + versions = '\n'.join(_SUPPORTED_API_VERSIONS) + raise ValueError("Unsupported API version '{}'. Please select from:\n{}".format(api_version, versions)) + return api_version or default + + +if sys.version_info < (3,): + def _new_boundary(): + return str(uuid.uuid1()) +else: + def _new_boundary(): + return str(uuid.uuid1()).encode('utf-8') + +_DEFAULT_ACCEPT_HEADER = ('Accept', TablePayloadFormat.JSON_MINIMAL_METADATA) +_DEFAULT_CONTENT_TYPE_HEADER = ('Content-Type', 'application/json') +_DEFAULT_PREFER_HEADER = ('Prefer', 'return-no-content') +_SUB_HEADERS = ['If-Match', 'Prefer', 'Accept', 'Content-Type', 'DataServiceVersion'] + + +def _get_entity_path(table_name, partition_key, row_key): + return '/{0}(PartitionKey=\'{1}\',RowKey=\'{2}\')'.format( + _to_str(table_name), + _to_str(partition_key.replace('\'', '\'\'')), + _to_str(row_key.replace('\'', '\'\''))) + + +def _update_storage_table_header(request): + ''' add additional headers for storage table request. ''' + + # set service version + request.headers['DataServiceVersion'] = '3.0;NetFx' + request.headers['MaxDataServiceVersion'] = '3.0' + + +def _to_entity_binary(value): + return EdmType.BINARY, _encode_base64(value) + + +def _to_entity_bool(value): + return None, value + + +def _to_entity_datetime(value): + return EdmType.DATETIME, _to_utc_datetime(value) + + +def _to_entity_float(value): + if isnan(value): + return EdmType.DOUBLE, 'NaN' + if value == float('inf'): + return EdmType.DOUBLE, 'Infinity' + if value == float('-inf'): + return EdmType.DOUBLE, '-Infinity' + return None, value + + +def _to_entity_guid(value): + return EdmType.GUID, str(value) + + +def _to_entity_int32(value): + if sys.version_info < (3,): + value = int(value) + else: + value = int(value) + if value >= 2 ** 31 or value < -(2 ** 31): + raise TypeError(_ERROR_VALUE_TOO_LARGE.format(str(value), EdmType.INT32)) + return None, value + + +def _to_entity_int64(value): + if sys.version_info < (3,): + ivalue = int(value) + else: + ivalue = int(value) + if ivalue >= 2 ** 63 or ivalue < -(2 ** 63): + raise TypeError(_ERROR_VALUE_TOO_LARGE.format(str(value), EdmType.INT64)) + return EdmType.INT64, str(value) + + +def _to_entity_str(value): + return None, value + + +def _to_entity_none(value): # pylint:disable=W0613 + return None, None + + +# Conversion from Python type to a function which returns a tuple of the +# type string and content string. +_PYTHON_TO_ENTITY_CONVERSIONS = { + int: _to_entity_int64, + bool: _to_entity_bool, + datetime: _to_entity_datetime, + float: _to_entity_float, + str: _to_entity_str, + bytes: _to_entity_binary, + UUID: _to_entity_guid +} + +# Conversion from Edm type to a function which returns a tuple of the +# type string and content string. +_EDM_TO_ENTITY_CONVERSIONS = { + EdmType.BINARY: _to_entity_binary, + EdmType.BOOLEAN: _to_entity_bool, + EdmType.DATETIME: _to_entity_datetime, + EdmType.DOUBLE: _to_entity_float, + EdmType.GUID: _to_entity_guid, + EdmType.INT32: _to_entity_int32, + EdmType.INT64: _to_entity_int64, + EdmType.STRING: _to_entity_str, +} + + +def _add_entity_properties(source): + """ Converts an entity object to json to send. + The entity format is: + { + "Address":"Mountain View", + "Age":23, + "AmountDue":200.23, + "CustomerCode@odata.type":"Edm.Guid", + "CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833", + "CustomerSince@odata.type":"Edm.DateTime", + "CustomerSince":"2008-07-10T00:00:00", + "IsActive":true, + "NumberOfOrders@odata.type":"Edm.Int64", + "NumberOfOrders":"255", + "PartitionKey":"mypartitionkey", + "RowKey":"myrowkey" + } + """ + + properties = {} + + # set properties type for types we know if value has no type info. + # if value has type info, then set the type to value.type + for name, value in source.items(): + mtype = '' + + if isinstance(value, EntityProperty): + conv = _EDM_TO_ENTITY_CONVERSIONS.get(value.type) + if conv is None: + raise TypeError( + _ERROR_TYPE_NOT_SUPPORTED.format(value.type)) + mtype, value = conv(value.value) + else: + conv = _PYTHON_TO_ENTITY_CONVERSIONS.get(type(value)) + if conv is None or value is None: + conv = _to_entity_none # something with this + + mtype, value = conv(value) + + # form the property node + if value is not None: + properties[name] = value + if mtype: + properties[name + '@odata.type'] = mtype.value + + # generate the entity_body + return properties diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/__init__.py new file mode 100644 index 000000000000..160f88223820 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/__init__.py @@ -0,0 +1,56 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import base64 +import hashlib +import hmac + +try: + from urllib.parse import quote, unquote +except ImportError: + from urllib2 import quote, unquote # type: ignore + +import six + + +def url_quote(url): + return quote(url) + + +def url_unquote(url): + return unquote(url) + + +def encode_base64(data): + if isinstance(data, six.text_type): + data = data.encode('utf-8') + encoded = base64.b64encode(data) + return encoded.decode('utf-8') + + +def decode_base64_to_bytes(data): + if isinstance(data, six.text_type): + data = data.encode('utf-8') + return base64.b64decode(data) + + +def decode_base64_to_text(data): + decoded_bytes = decode_base64_to_bytes(data) + return decoded_bytes.decode('utf-8') + + +def sign_string(key, string_to_sign, key_is_base64=True): + if key_is_base64: + key = decode_base64_to_bytes(key) + else: + if isinstance(key, six.text_type): + key = key.encode('utf-8') + if isinstance(string_to_sign, six.text_type): + string_to_sign = string_to_sign.encode('utf-8') + signed_hmac_sha256 = hmac.HMAC(key, string_to_sign, hashlib.sha256) + digest = signed_hmac_sha256.digest() + encoded_digest = encode_base64(digest) + return encoded_digest diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/_common_conversion.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/_common_conversion.py new file mode 100644 index 000000000000..4de22559aba8 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/_common_conversion.py @@ -0,0 +1,107 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import base64 +import hashlib +import hmac +from io import (SEEK_SET) +import six +from azure.data.tables._shared.parser import _str + + +from ._error import ( + _ERROR_VALUE_SHOULD_BE_BYTES_OR_STREAM, + _ERROR_VALUE_SHOULD_BE_SEEKABLE_STREAM, +) + + +def _to_str(value): + return _str(value) if value is not None else None + + +def _int_to_str(value): + return str(int(value)) if value is not None else None + + +def _bool_to_str(value): + if value is None: + return None + + if isinstance(value, bool): + if value: # pylint: disable=R1705 + return 'true' + else: + return 'false' + + return str(value) + + +def _to_utc_datetime(value): + return value.strftime('%Y-%m-%dT%H:%M:%SZ') + + +def _datetime_to_utc_string(value): + # Azure expects the date value passed in to be UTC. + # Azure will always return values as UTC. + # If a date is passed in without timezone info, it is assumed to be UTC. + if value is None: + return None + + return value.strftime('%a, %d %b %Y %H:%M:%S GMT') + + +def _encode_base64(data): + if isinstance(data, six.text_type): + data = data.encode('utf-8') + encoded = base64.b64encode(data) + return encoded.decode('utf-8') + + +def _decode_base64_to_bytes(data): + if isinstance(data, six.text_type): + data = data.encode('utf-8') + return base64.b64decode(data) + + +def _decode_base64_to_text(data): + decoded_bytes = _decode_base64_to_bytes(data) + return decoded_bytes.decode('utf-8') + + +def _sign_string(key, string_to_sign, key_is_base64=True): + if key_is_base64: + key = _decode_base64_to_bytes(key) + else: + if isinstance(key, six.text_type): + key = key.encode('utf-8') + if isinstance(string_to_sign, six.text_type): + string_to_sign = string_to_sign.encode('utf-8') + signed_hmac_sha256 = hmac.HMAC(key, string_to_sign, hashlib.sha256) + digest = signed_hmac_sha256.digest() + encoded_digest = _encode_base64(digest) + return encoded_digest + + +def _get_content_md5(data): + md5 = hashlib.md5() # nosec + if isinstance(data, bytes): + md5.update(data) + elif hasattr(data, 'read'): + pos = 0 + pos = data.tell() + for chunk in iter(lambda: data.read(4096), b""): + md5.update(chunk) + try: + data.seek(pos, SEEK_SET) + except (AttributeError, IOError): + raise ValueError(_ERROR_VALUE_SHOULD_BE_SEEKABLE_STREAM.format('data')) + else: + raise ValueError(_ERROR_VALUE_SHOULD_BE_BYTES_OR_STREAM.format('data')) + + return base64.b64encode(md5.digest()).decode('utf-8') + + +def _lower(text): + return text.lower() diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/_constants.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/_constants.py new file mode 100644 index 000000000000..858875b6af28 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/_constants.py @@ -0,0 +1,51 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import platform +import sys + +__author__ = 'Microsoft Corp. ' +__version__ = '1.4.2' + +# UserAgent string sample: 'Azure-Storage/0.37.0-0.38.0 (Python CPython 3.4.2; Windows 8)' +# First version(0.37.0) is the common package, and the second version(0.38.0) is the service package +USER_AGENT_STRING_PREFIX = 'Azure-Storage/{}-'.format(__version__) +USER_AGENT_STRING_SUFFIX = '(Python {} {}; {} {})'.format(platform.python_implementation(), + platform.python_version(), platform.system(), + platform.release()) + +# default values for common package, in case it is used directly +DEFAULT_X_MS_VERSION = '2018-03-28' +DEFAULT_USER_AGENT_STRING = '{}None {}'.format(USER_AGENT_STRING_PREFIX, USER_AGENT_STRING_SUFFIX) + +# Live ServiceClient URLs +SERVICE_HOST_BASE = 'core.windows.net' +DEFAULT_PROTOCOL = 'https' + +# Development ServiceClient URLs +DEV_BLOB_HOST = '127.0.0.1:10000' +DEV_QUEUE_HOST = '127.0.0.1:10001' + +# Default credentials for Development Storage Service +DEV_ACCOUNT_NAME = 'devstoreaccount1' +DEV_ACCOUNT_SECONDARY_NAME = 'devstoreaccount1-secondary' +DEV_ACCOUNT_KEY = 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==' + +# Socket timeout in seconds +DEFAULT_SOCKET_TIMEOUT = 20 + +# for python 3.5+, there was a change to the definition of the socket timeout (as far as socket.sendall is concerned) +# The socket timeout is now the maximum total duration to send all data. +if sys.version_info >= (3, 5): + # the timeout to connect is 20 seconds, and the read timeout is 2000 seconds + # the 2000 seconds was calculated with: 100MB (max block size)/ 50KB/s (an arbitrarily chosen minimum upload speed) + DEFAULT_SOCKET_TIMEOUT = (20, 2000) + +# Encryption constants +_ENCRYPTION_PROTOCOL_V1 = '1.0' + +_AUTHORIZATION_HEADER_NAME = 'Authorization' +_COPY_SOURCE_HEADER_NAME = 'x-ms-copy-source' +_REDACTED_VALUE = 'REDACTED' diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/_error.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/_error.py new file mode 100644 index 000000000000..32d9e7705378 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/_error.py @@ -0,0 +1,230 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from sys import version_info +from re import match + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError +from azure.data.tables._shared.parser import _str + +from ._constants import ( + _ENCRYPTION_PROTOCOL_V1, +) + +def _to_str(value): + return _str(value) if value is not None else None + + +_ERROR_ATTRIBUTE_MISSING = '\'{0}\' object has no attribute \'{1}\'' +_ERROR_BATCH_COMMIT_FAIL = 'Batch Commit Fail' +_ERROR_CANNOT_FIND_PARTITION_KEY = 'Cannot find partition key in request.' +_ERROR_CANNOT_FIND_ROW_KEY = 'Cannot find row key in request.' +_ERROR_CANNOT_SERIALIZE_VALUE_TO_ENTITY = \ + 'Cannot serialize the specified value ({0}) to an entity. Please use ' + \ + 'an EntityProperty (which can specify custom types), int, str, bool, ' + \ + 'or datetime.' +_ERROR_CANNOT_DESERIALIZE_VALUE_TO_ENTITY = \ + 'Cannot deserialize the specified value ({0}).' +_ERROR_DUPLICATE_ROW_KEY_IN_BATCH = \ + 'Row Keys should not be the same in a batch operations' +_ERROR_INCORRECT_PARTITION_KEY_IN_BATCH = \ + 'Partition Key should be the same in a batch operations' +_ERROR_INVALID_ENTITY_TYPE = 'The entity must be either in dict format or an entity object.' +_ERROR_INVALID_PROPERTY_RESOLVER = \ + 'The specified property resolver returned an invalid type. Name: {0}, Value: {1}, ' + \ + 'EdmType: {2}' +_ERROR_PROPERTY_NAME_TOO_LONG = 'The property name exceeds the maximum allowed length.' +_ERROR_TOO_MANY_ENTITIES_IN_BATCH = \ + 'Batches may only contain 100 operations' +_ERROR_TOO_MANY_PROPERTIES = 'The entity contains more properties than allowed.' +_ERROR_TYPE_NOT_SUPPORTED = 'Type not supported when sending data to the service: {0}.' +_ERROR_VALUE_TOO_LARGE = '{0} is too large to be cast to type {1}.' +_ERROR_UNSUPPORTED_TYPE_FOR_ENCRYPTION = 'Encryption is only supported for not None strings.' +_ERROR_ENTITY_NOT_ENCRYPTED = 'Entity was not encrypted.' +_ERROR_ATTRIBUTE_MISSING = '\'{0}\' object has no attribute \'{1}\'' +_ERROR_CONFLICT = 'Conflict ({0})' +_ERROR_NOT_FOUND = 'Not found ({0})' +_ERROR_UNKNOWN = 'Unknown error ({0})' +_ERROR_STORAGE_MISSING_INFO = \ + 'You need to provide an account name and either an account_key or sas_token when creating a storage service.' +_ERROR_EMULATOR_DOES_NOT_SUPPORT_FILES = \ + 'The emulator does not support the file service.' +_ERROR_ACCESS_POLICY = \ + 'share_access_policy must be either SignedIdentifier or AccessPolicy ' + \ + 'instance' +_ERROR_PARALLEL_NOT_SEEKABLE = 'Parallel operations require a seekable stream.' +_ERROR_VALUE_SHOULD_BE_BYTES = '{0} should be of type bytes.' +_ERROR_VALUE_SHOULD_BE_BYTES_OR_STREAM = '{0} should be of type bytes or a readable file-like/io.IOBase stream object.' +_ERROR_VALUE_SHOULD_BE_SEEKABLE_STREAM = '{0} should be a seekable file-like/io.IOBase type stream object.' +_ERROR_VALUE_SHOULD_BE_STREAM = '{0} should be a file-like/io.IOBase type stream object with a read method.' +_ERROR_VALUE_NONE = '{0} should not be None.' +_ERROR_VALUE_NONE_OR_EMPTY = '{0} should not be None or empty.' +_ERROR_VALUE_NEGATIVE = '{0} should not be negative.' +_ERROR_START_END_NEEDED_FOR_MD5 = \ + 'Both end_range and start_range need to be specified ' + \ + 'for getting content MD5.' +_ERROR_RANGE_TOO_LARGE_FOR_MD5 = \ + 'Getting content MD5 for a range greater than 4MB ' + \ + 'is not supported.' +_ERROR_MD5_MISMATCH = \ + 'MD5 mismatch. Expected value is \'{0}\', computed value is \'{1}\'.' +_ERROR_TOO_MANY_ACCESS_POLICIES = \ + 'Too many access policies provided. ' \ + 'The server does not support setting more than 5 access policies on a single resource.' +_ERROR_OBJECT_INVALID = \ + '{0} does not define a complete interface. Value of {1} is either missing or invalid.' +_ERROR_UNSUPPORTED_ENCRYPTION_VERSION = \ + 'Encryption version is not supported.' +_ERROR_DECRYPTION_FAILURE = \ + 'Decryption failed' +_ERROR_ENCRYPTION_REQUIRED = \ + 'Encryption required but no key was provided.' +_ERROR_DECRYPTION_REQUIRED = \ + 'Decryption required but neither key nor resolver was provided.' + \ + ' If you do not want to decypt, please do not set the require encryption flag.' +_ERROR_INVALID_KID = \ + 'Provided or resolved key-encryption-key does not match the id of key used to encrypt.' +_ERROR_UNSUPPORTED_ENCRYPTION_ALGORITHM = \ + 'Specified encryption algorithm is not supported.' +_ERROR_UNSUPPORTED_METHOD_FOR_ENCRYPTION = 'The require_encryption flag is set, but encryption is not supported' + \ + ' for this method.' +_ERROR_UNKNOWN_KEY_WRAP_ALGORITHM = 'Unknown key wrap algorithm.' +_ERROR_DATA_NOT_ENCRYPTED = 'Encryption required, but received data does not contain appropriate metatadata.' + \ + 'Data was either not encrypted or metadata has been lost.' + + +def _dont_fail_on_exist(error): + """ don't throw exception if the resource exists. + This is called by create_* APIs with fail_on_exist=False""" + if isinstance(error, ResourceExistsError): # pylint: disable=R1705 + return False + else: + raise error + + +def _dont_fail_not_exist(error): + """ don't throw exception if the resource doesn't exist. + This is called by create_* APIs with fail_on_exist=False""" + if isinstance(error, ResourceNotFoundError): # pylint: disable=R1705 + return False + else: + raise error + + +def _http_error_handler(http_error): + """ Simple error handler for azure.""" + message = str(http_error) + error_code = None + + if 'x-ms-error-code' in http_error.respheader: + error_code = http_error.respheader['x-ms-error-code'] + message += ' ErrorCode: ' + error_code + + if http_error.respbody is not None: + message += '\n' + http_error.respbody.decode('utf-8-sig') + + ex = HttpResponseError(message, http_error.status) + ex.error_code = error_code + + raise ex + + +def _validate_type_bytes(param_name, param): + if not isinstance(param, bytes): + raise TypeError(_ERROR_VALUE_SHOULD_BE_BYTES.format(param_name)) + + +def _validate_type_bytes_or_stream(param_name, param): + if not (isinstance(param, bytes) or hasattr(param, 'read')): + raise TypeError(_ERROR_VALUE_SHOULD_BE_BYTES_OR_STREAM.format(param_name)) + + +def _validate_not_none(param_name, param): + if param is None: + raise ValueError(_ERROR_VALUE_NONE.format(param_name)) + + +def _validate_content_match(server_md5, computed_md5): + if server_md5 != computed_md5: + raise Exception(_ERROR_MD5_MISMATCH.format(server_md5, computed_md5)) + + +def _validate_access_policies(identifiers): + if identifiers and len(identifiers) > 5: + raise Exception(_ERROR_TOO_MANY_ACCESS_POLICIES) + + +def _validate_key_encryption_key_wrap(kek): + # Note that None is not callable and so will fail the second clause of each check. + if not hasattr(kek, 'wrap_key') or not callable(kek.wrap_key): + raise AttributeError(_ERROR_OBJECT_INVALID.format('key encryption key', 'wrap_key')) + if not hasattr(kek, 'get_kid') or not callable(kek.get_kid): + raise AttributeError(_ERROR_OBJECT_INVALID.format('key encryption key', 'get_kid')) + if not hasattr(kek, 'get_key_wrap_algorithm') or not callable(kek.get_key_wrap_algorithm): + raise AttributeError(_ERROR_OBJECT_INVALID.format('key encryption key', 'get_key_wrap_algorithm')) + + +def _validate_key_encryption_key_unwrap(kek): + if not hasattr(kek, 'get_kid') or not callable(kek.get_kid): + raise AttributeError(_ERROR_OBJECT_INVALID.format('key encryption key', 'get_kid')) + if not hasattr(kek, 'unwrap_key') or not callable(kek.unwrap_key): + raise AttributeError(_ERROR_OBJECT_INVALID.format('key encryption key', 'unwrap_key')) + + +def _validate_encryption_required(require_encryption, kek): + if require_encryption and (kek is None): + raise ValueError(_ERROR_ENCRYPTION_REQUIRED) + + +def _validate_decryption_required(require_encryption, kek, resolver): + if (require_encryption and (kek is None) and + (resolver is None)): + raise ValueError(_ERROR_DECRYPTION_REQUIRED) + + +def _validate_encryption_protocol_version(encryption_protocol): + if not _ENCRYPTION_PROTOCOL_V1 == encryption_protocol: + raise ValueError(_ERROR_UNSUPPORTED_ENCRYPTION_VERSION) + + +def _validate_kek_id(kid, resolved_id): + if not kid == resolved_id: + raise ValueError(_ERROR_INVALID_KID) + + +def _validate_encryption_unsupported(require_encryption, key_encryption_key): + if require_encryption or (key_encryption_key is not None): + raise ValueError(_ERROR_UNSUPPORTED_METHOD_FOR_ENCRYPTION) + + +# wraps a given exception with the desired exception type +def _wrap_exception(ex, desired_type): + msg = "" + if len(ex.args) > 0: # pylint: disable=C1801 + msg = ex.args[0] + if version_info >= (3,): # pylint: disable=R1705 + # Automatic chaining in Python 3 means we keep the trace + return desired_type(msg) + else: + # There isn't a good solution in 2 for keeping the stack trace + # in general, or that will not result in an error in 3 + # However, we can keep the previous error type and message + # TODO: In the future we will log the trace + return desired_type('{}: {}'.format(ex.__class__.__name__, msg)) + + +def _validate_table_name(table_name): + if match("^[a-zA-Z]{1}[a-zA-Z0-9]{2,62}$", table_name) is None: + raise ValueError( + "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long." + ) + + +class AzureSigningError(Exception): + """ + Represents a fatal error when attempting to sign a request. + In general, the cause of this exception is user error. For example, the given account key is not valid. + Please visit https://docs.microsoft.com/en-us/azure/storage/common/storage-create-storage-account for more info. + """ diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/_table_client_base.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/_table_client_base.py new file mode 100644 index 000000000000..54e0b360fac6 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/_table_client_base.py @@ -0,0 +1,98 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse # type: ignore + +from azure.data.tables._shared._error import _validate_table_name +from azure.data.tables._shared.base_client import parse_query +from .base_client import StorageAccountHostsMixin + + +class TableClientBase(StorageAccountHostsMixin): + """Create TableClientBase from a Credential. + + :param account_url: + A url to an Azure Storage account. + :type account_url: str + :param table_name: The table name. + :type table_name: str + :param credential: + The credentials with which to authenticate. This is optional if the + account URL already has a SAS token, or the connection string already has shared + access key values. The value can be a SAS token string, an account shared access + key. + :type credential: Union[str,TokenCredential] + + :returns: None + """ + + def __init__( + self, account_url, # type: str + table_name, # type: str + credential=None, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + + _validate_table_name(table_name) + + try: + if not account_url.lower().startswith('http'): + account_url = "https://" + account_url + except AttributeError: + raise ValueError("Account URL must be a string.") + parsed_url = urlparse(account_url.rstrip('/')) + if not table_name: + raise ValueError("Please specify a table name.") + if not parsed_url.netloc: + raise ValueError("Invalid URL: {}".format(parsed_url)) + + _, sas_token = parse_query(parsed_url.query) + if not sas_token and not credential: + raise ValueError("You need to provide either a SAS token or an account shared key to authenticate.") + + self.table_name = table_name + self._query_str, credential = self._format_query_string(sas_token, credential) + super(TableClientBase, self).__init__(parsed_url, service='table', credential=credential, **kwargs) + + def _format_url(self, hostname): + """Format the endpoint URL according to the current location + mode hostname. + """ + return "{}://{}{}".format(self.scheme, hostname, self._query_str) + + @classmethod + def _validate_signed_identifiers(cls, signed_identifiers): + # type: (...) -> None + """Validate the number of signed identifiers is less than five + + :param signed_identifiers: + :type signed_identifiers: dict[str,AccessPolicy] + """ + if len(signed_identifiers) > 5: + raise ValueError( + 'Too many access policies provided. The server does not support setting ' + 'more than 5 access policies on a single resource.') + + def _parameter_filter_substitution( # pylint: disable = R0201 + self, + parameters, # type: dict[str,str] + filter # type: str # pylint: disable = W0622 + ): + """Replace user defined parameter in filter + :param parameters: User defined parameters + :param filter: Filter for querying + """ + if parameters: + filter_start = filter.split('@')[0] + selected = filter.split('@')[1] + for key, value in parameters.items(): + if key == selected: + filter = filter_start.replace('@', value) # pylint: disable = W0622 + return filter # pylint: disable = W0622 diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/_table_service_client_base.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/_table_service_client_base.py new file mode 100644 index 000000000000..99967f590e94 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/_table_service_client_base.py @@ -0,0 +1,75 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse # type: ignore + +from azure.data.tables._shared.base_client import parse_query +from .base_client import StorageAccountHostsMixin + + +class TableServiceClientBase(StorageAccountHostsMixin): + """ :ivar str account_name: Name of the storage account (Cosmos or Azure) + Create TableServiceClientBase class for sync and async code. + + :param account_url: + A account_url url to an Azure Storage account. + :type service: str + :param credential: + The credentials with which to authenticate. This is optional if the + account URL already has a SAS token, or the connection string already has shared + access key values. The value can be a SAS token string, an account shared access + key, or an instance of a TokenCredentials class from azure.identity. + :type credential: str + :returns: None + """ + def __init__( + self, account_url, # type: Any + service, # type: str + credential=None, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + + try: + if not account_url.lower().startswith('http'): + account_url = "https://" + account_url + except AttributeError: + raise ValueError("Account URL must be a string.") + parsed_url = urlparse(account_url.rstrip('/')) + if not parsed_url.netloc: + raise ValueError("Invalid URL: {}".format(account_url)) + + _, sas_token = parse_query(parsed_url.query) + if not sas_token and not credential: + raise ValueError("You need to provide either a SAS token or an account shared key to authenticate.") + self._query_str, credential = self._format_query_string(sas_token, credential) + super(TableServiceClientBase, self).__init__(parsed_url, service=service, credential=credential, **kwargs) + + def _format_url(self, hostname): + """Format the endpoint URL according to the current location + mode hostname. + """ + return "{}://{}{}".format(self.scheme, hostname, self._query_str) + + def _parameter_filter_substitution( # pylint: disable = R0201 + self, + parameters, # type: dict[str,str] + filter # type: str # pylint: disable = W0622 + ): + """Replace user defined parameter in filter + :param parameters: User defined parameters + :param filter: Filter for querying + """ + if parameters: + filter_start = filter.split('@')[0] + selected = filter.split('@')[1] + for key, value in parameters.items(): + if key == selected: + filter = filter_start.replace('@', value) # pylint: disable = W0622 + return filter # pylint: disable = W0622 diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/authentication.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/authentication.py new file mode 100644 index 000000000000..c479b6a51963 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/authentication.py @@ -0,0 +1,138 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import logging +import sys +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse # type: ignore + + + +from azure.core.exceptions import ClientAuthenticationError +from azure.core.pipeline.policies import SansIOHTTPPolicy + +from azure.data.tables._shared._constants import ( + DEV_ACCOUNT_NAME, + DEV_ACCOUNT_SECONDARY_NAME +) + +from ._common_conversion import ( + _sign_string, +) + +from ._error import ( + _wrap_exception, +) + +logger = logging.getLogger(__name__) + + +# wraps a given exception with the desired exception type +def _wrap_exception(ex, desired_type): + msg = "" + if ex.args: + msg = ex.args[0] + if sys.version_info >= (3,): + # Automatic chaining in Python 3 means we keep the trace + return desired_type(msg) + # There isn't a good solution in 2 for keeping the stack trace + # in general, or that will not result in an error in 3 + # However, we can keep the previous error type and message + # TODO: In the future we will log the trace + return desired_type('{}: {}'.format(ex.__class__.__name__, msg)) + + +class AzureSigningError(ClientAuthenticationError): + """ + Represents a fatal error when attempting to sign a request. + In general, the cause of this exception is user error. For example, the given account key is not valid. + Please visit https://docs.microsoft.com/en-us/azure/storage/common/storage-create-storage-account for more info. + """ + + +# pylint: disable=no-self-use +class SharedKeyCredentialPolicy(SansIOHTTPPolicy): + + def __init__(self, account_name, account_key, is_emulated=False): + self.account_name = account_name + self.account_key = account_key + self.is_emulated = is_emulated + + def _get_headers(self, request, headers_to_sign): + headers = dict((name.lower(), value) for name, value in request.headers.items() if value) + if 'content-length' in headers and headers['content-length'] == '0': + del headers['content-length'] + return '\n'.join(headers.get(x, '') for x in headers_to_sign) + '\n' + + def _get_verb(self, request): + return request.method + '\n' + + def _get_canonicalized_resource(self, request): + # uri_path = request.path.split('?')[0] + uri_path = urlparse(request.url).path + + # for emulator, use the DEV_ACCOUNT_NAME instead of DEV_ACCOUNT_SECONDARY_NAME + # as this is how the emulator works + if self.is_emulated and uri_path.find(DEV_ACCOUNT_SECONDARY_NAME) == 1: + # only replace the first instance + uri_path = uri_path.replace(DEV_ACCOUNT_SECONDARY_NAME, DEV_ACCOUNT_NAME, 1) + + return '/' + self.account_name + uri_path + + def _get_canonicalized_headers(self, request): + string_to_sign = '' + x_ms_headers = [] + for name, value in request.headers.items(): + if name.startswith('x-ms-'): + x_ms_headers.append((name.lower(), value)) + x_ms_headers.sort() + for name, value in x_ms_headers: + if value is not None: + string_to_sign += ''.join([name, ':', value, '\n']) + return string_to_sign + + def _add_authorization_header(self, request, string_to_sign): + try: + signature = _sign_string(self.account_key, string_to_sign) + auth_string = 'SharedKey ' + self.account_name + ':' + signature + request.headers['Authorization'] = auth_string + except Exception as ex: + # Wrap any error that occurred as signing error + # Doing so will clarify/locate the source of problem + raise _wrap_exception(ex, AzureSigningError) + + def on_request(self, request): # type: (PipelineRequest) -> Union[None, Awaitable[None]] + self.sign_request(request.http_request) + + def sign_request(self, request): + string_to_sign = \ + self._get_verb(request) + \ + self._get_headers( + request, + ['content-md5', 'content-type', 'x-ms-date'], + ) + \ + self._get_canonicalized_resource(request) + \ + self._get_canonicalized_resource_query(request) + self._add_authorization_header(request, string_to_sign) + logger.debug("String_to_sign=%s", string_to_sign) + + def _get_canonicalized_resource_query(self, request): + for name, value in request.query.items(): + if name == 'comp': + return '?comp=' + value + return '' + + # def _get_canonicalized_resource_query(self, request): + # sorted_queries = [(name, value) for name, value in request.query.items()] + # sorted_queries.sort() + # + # string_to_sign = '' + # for name, value in sorted_queries: + # if value is not None: + # string_to_sign += '\n' + name.lower() + ':' + value + # return string_to_sign diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/base_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/base_client.py new file mode 100644 index 000000000000..30007bf7b9b9 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/base_client.py @@ -0,0 +1,434 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from typing import ( # pylint: disable=unused-import + Union, + Optional, + Any, + Iterable, + Dict, + List, + Type, + Tuple, + TYPE_CHECKING, +) +import logging + + + +try: + from urllib.parse import parse_qs, quote +except ImportError: + from urlparse import parse_qs # type: ignore + from urllib2 import quote # type: ignore + +import six +from azure.data.tables._shared.shared_access_signature import QueryStringConstants +from azure.core.configuration import Configuration +from azure.core.exceptions import HttpResponseError +from azure.core.pipeline import Pipeline +from azure.core.pipeline.transport import RequestsTransport, HttpTransport +from azure.core.pipeline.policies import ( + RedirectPolicy, + ContentDecodePolicy, + BearerTokenCredentialPolicy, + ProxyPolicy, + DistributedTracingPolicy, + HttpLoggingPolicy, + UserAgentPolicy +) + +from .constants import STORAGE_OAUTH_SCOPE, SERVICE_HOST_BASE, CONNECTION_TIMEOUT, READ_TIMEOUT +from .models import LocationMode +from .authentication import SharedKeyCredentialPolicy +from .policies import ( + StorageHeadersPolicy, + StorageContentValidation, + StorageRequestHook, + StorageResponseHook, + StorageLoggingPolicy, + StorageHosts, ExponentialRetry, +) +from .._version import VERSION +from .response_handlers import process_table_error, PartialBatchErrorException + + +_LOGGER = logging.getLogger(__name__) +_SERVICE_PARAMS = { + "blob": {"primary": "BlobEndpoint", "secondary": "BlobSecondaryEndpoint"}, + "queue": {"primary": "QueueEndpoint", "secondary": "QueueSecondaryEndpoint"}, + "file": {"primary": "FileEndpoint", "secondary": "FileSecondaryEndpoint"}, + "dfs": {"primary": "BlobEndpoint", "secondary": "BlobEndpoint"}, + "table": {"primary": "TableEndpoint", "secondary": "TableSecondaryEndpoint"}, +} + + +class StorageAccountHostsMixin(object): # pylint: disable=too-many-instance-attributes + def __init__( + self, + parsed_url, # type: Any + service, # type: str + credential=None, # type: Optional[Any] + **kwargs # type: Any + ): + # type: (...) -> None + self._location_mode = kwargs.get("_location_mode", LocationMode.PRIMARY) + self._hosts = kwargs.get("_hosts") + self.scheme = parsed_url.scheme + + if service not in ["blob", "queue", "file-share", "dfs", "table"]: + raise ValueError("Invalid service: {}".format(service)) + service_name = service.split('-')[0] + account = parsed_url.netloc.split(".{}.core.".format(service_name)) + self.account_name = account[0] if len(account) > 1 else None + secondary_hostname = None + + self.credential = format_shared_key_credential(account, credential) + if self.scheme.lower() != "https" and hasattr(self.credential, "get_token"): + raise ValueError("Token credential is only supported with HTTPS.") + if hasattr(self.credential, "account_name"): + self.account_name = self.credential.account_name + secondary_hostname = "{}-secondary.{}.{}".format( + self.credential.account_name, service_name, SERVICE_HOST_BASE) + + if not self._hosts: + if len(account) > 1: + secondary_hostname = parsed_url.netloc.replace(account[0], account[0] + "-secondary") + if kwargs.get("secondary_hostname"): + secondary_hostname = kwargs["secondary_hostname"] + primary_hostname = (parsed_url.netloc + parsed_url.path).rstrip('/') + self._hosts = {LocationMode.PRIMARY: primary_hostname, LocationMode.SECONDARY: secondary_hostname} + + self.require_encryption = kwargs.get("require_encryption", False) + self.key_encryption_key = kwargs.get("key_encryption_key") + self.key_resolver_function = kwargs.get("key_resolver_function") + self._config, self._pipeline = self._create_pipeline(self.credential, storage_sdk=service, **kwargs) + + def __enter__(self): + self._client.__enter__() + return self + + def __exit__(self, *args): + self._client.__exit__(*args) + + def close(self): + """ This method is to close the sockets opened by the client. + It need not be used when using with a context manager. + """ + self._client.close() + + @property + def url(self): + """The full endpoint URL to this entity, including SAS token if used. + + This could be either the primary endpoint, + or the secondary endpoint depending on the current :func:`location_mode`. + """ + return self._format_url(self._hosts[self._location_mode]) + + @property + def _primary_endpoint(self): + """The full primary endpoint URL. + + :type: str + """ + return self._format_url(self._hosts[LocationMode.PRIMARY]) + + @property + def _primary_hostname(self): + """The hostname of the primary endpoint. + + :type: str + """ + return self._hosts[LocationMode.PRIMARY] + + @property + def _secondary_endpoint(self): + """The full secondary endpoint URL if configured. + + If not available a ValueError will be raised. To explicitly specify a secondary hostname, use the optional + `secondary_hostname` keyword argument on instantiation. + + :type: str + :raise ValueError: + """ + if not self._hosts[LocationMode.SECONDARY]: + raise ValueError("No secondary host configured.") + return self._format_url(self._hosts[LocationMode.SECONDARY]) + + @property + def _secondary_hostname(self): + """The hostname of the secondary endpoint. + + If not available this will be None. To explicitly specify a secondary hostname, use the optional + `secondary_hostname` keyword argument on instantiation. + + :type: str or None + """ + return self._hosts[LocationMode.SECONDARY] + + @property + def location_mode(self): + """The location mode that the client is currently using. + + By default this will be "primary". Options include "primary" and "secondary". + + :type: str + """ + + return self._location_mode + + @location_mode.setter + def location_mode(self, value): + if self._hosts.get(value): + self._location_mode = value + self._client._config.url = self.url # pylint: disable=protected-access + else: + raise ValueError("No host URL for location mode: {}".format(value)) + + @property + def api_version(self): + """The version of the Storage API used for requests. + + :type: str + """ + return self._client._config.version # pylint: disable=protected-access + + def _format_query_string(self, sas_token, credential, snapshot=None, share_snapshot=None): + query_str = "?" + if snapshot: + query_str += "snapshot={}&".format(self.snapshot) + if share_snapshot: + query_str += "sharesnapshot={}&".format(self.snapshot) + if sas_token and not credential: + query_str += sas_token + elif is_credential_sastoken(credential): + query_str += credential.lstrip("?") + credential = None + return query_str.rstrip("?&"), credential + + def _create_pipeline(self, credential, **kwargs): + # type: (Any, **Any) -> Tuple[Configuration, Pipeline] + self._credential_policy = None + if hasattr(credential, "get_token"): + self._credential_policy = BearerTokenCredentialPolicy(credential, STORAGE_OAUTH_SCOPE) + elif isinstance(credential, SharedKeyCredentialPolicy): + self._credential_policy = credential + elif credential is not None: + raise TypeError("Unsupported credential: {}".format(credential)) + + config = kwargs.get("_configuration") or create_configuration(**kwargs) + if kwargs.get("_pipeline"): + return config, kwargs["_pipeline"] + config.transport = kwargs.get("transport") # type: ignore + kwargs.setdefault("connection_timeout", CONNECTION_TIMEOUT) + kwargs.setdefault("read_timeout", READ_TIMEOUT) + if not config.transport: + config.transport = RequestsTransport(**kwargs) + policies = [ + config.headers_policy, + config.proxy_policy, + config.user_agent_policy, + StorageContentValidation(), + StorageRequestHook(**kwargs), + self._credential_policy, + ContentDecodePolicy(response_encoding="utf-8"), + RedirectPolicy(**kwargs), + StorageHosts(hosts=self._hosts, **kwargs), + config.retry_policy, + config.logging_policy, + StorageResponseHook(**kwargs), + DistributedTracingPolicy(**kwargs), + HttpLoggingPolicy(**kwargs) + ] + return config, Pipeline(config.transport, policies=policies) + + def _batch_send( + self, *reqs, # type: HttpRequest + **kwargs + ): + """Given a series of request, do a Storage batch call. + """ + # Pop it here, so requests doesn't feel bad about additional kwarg + raise_on_any_failure = kwargs.pop("raise_on_any_failure", True) + request = self._client._client.post( # pylint: disable=protected-access + url='{}://{}/?comp=batch{}{}'.format( + self.scheme, + self._primary_hostname, + kwargs.pop('sas', None), + kwargs.pop('timeout', None) + ), + headers={ + 'x-ms-version': self.api_version + } + ) + + policies = [StorageHeadersPolicy()] + if self._credential_policy: + policies.append(self._credential_policy) + + request.set_multipart_mixed( + *reqs, + policies=policies, + enforce_https=False + ) + + pipeline_response = self._pipeline.run( + request, **kwargs + ) + response = pipeline_response.http_response + + try: + if response.status_code not in [202]: + raise HttpResponseError(response=response) + parts = response.parts() + if raise_on_any_failure: + parts = list(response.parts()) + if any(p for p in parts if not 200 <= p.status_code < 300): + error = PartialBatchErrorException( + message="There is a partial failure in the batch operation.", + response=response, parts=parts + ) + raise error + return iter(parts) + return parts + except HttpResponseError as error: + process_table_error(error) + +class TransportWrapper(HttpTransport): + """Wrapper class that ensures that an inner client created + by a `get_client` method does not close the outer transport for the parent + when used in a context manager. + """ + def __init__(self, transport): + self._transport = transport + + def send(self, request, **kwargs): + return self._transport.send(request, **kwargs) + + def open(self): + pass + + def close(self): + pass + + def __enter__(self): + pass + + def __exit__(self, *args): # pylint: disable=arguments-differ + pass + + +def format_shared_key_credential(account, credential): + if isinstance(credential, six.string_types): + if len(account) < 2: + raise ValueError("Unable to determine account name for shared key credential.") + credential = {"account_name": account[0], "account_key": credential} + if isinstance(credential, dict): + if "account_name" not in credential: + raise ValueError("Shared key credential missing 'account_name") + if "account_key" not in credential: + raise ValueError("Shared key credential missing 'account_key") + return SharedKeyCredentialPolicy(**credential) + return credential + + +def parse_connection_str(conn_str, credential, service): + conn_str = conn_str.rstrip(";") + conn_settings = [s.split("=", 1) for s in conn_str.split(";")] + if any(len(tup) != 2 for tup in conn_settings): + raise ValueError("Connection string is either blank or malformed.") + conn_settings = dict(conn_settings) + endpoints = _SERVICE_PARAMS[service] + primary = None + secondary = None + if not credential: + try: + credential = {"account_name": conn_settings["AccountName"], "account_key": conn_settings["AccountKey"]} + except KeyError: + credential = conn_settings.get("SharedAccessSignature") + if endpoints["primary"] in conn_settings: + primary = conn_settings[endpoints["primary"]] + if endpoints["secondary"] in conn_settings: + secondary = conn_settings[endpoints["secondary"]] + else: + if endpoints["secondary"] in conn_settings: + raise ValueError("Connection string specifies only secondary endpoint.") + try: + primary = "{}://{}.{}.{}".format( + conn_settings["DefaultEndpointsProtocol"], + conn_settings["AccountName"], + service, + conn_settings["EndpointSuffix"], + ) + secondary = "{}-secondary.{}.{}".format( + conn_settings["AccountName"], service, conn_settings["EndpointSuffix"] + ) + except KeyError: + pass + + if not primary: + try: + primary = "https://{}.{}.{}".format( + conn_settings["AccountName"], service, conn_settings.get("EndpointSuffix", SERVICE_HOST_BASE) + ) + except KeyError: + raise ValueError("Connection string missing required connection details.") + return primary, secondary, credential + + +def create_configuration(**kwargs): + # type: (**Any) -> Configuration + config = Configuration(**kwargs) + config.headers_policy = StorageHeadersPolicy(**kwargs) + config.user_agent_policy = UserAgentPolicy( + sdk_moniker="storage-{}/{}".format(kwargs.pop('storage_sdk'), VERSION), **kwargs) + config.retry_policy = kwargs.get("retry_policy") or ExponentialRetry(**kwargs) + config.logging_policy = StorageLoggingPolicy(**kwargs) + config.proxy_policy = ProxyPolicy(**kwargs) + + # Storage settings + config.max_single_put_size = kwargs.get("max_single_put_size", 64 * 1024 * 1024) + config.copy_polling_interval = 15 + + # Block blob uploads + config.max_block_size = kwargs.get("max_block_size", 4 * 1024 * 1024) + config.min_large_block_upload_threshold = kwargs.get("min_large_block_upload_threshold", 4 * 1024 * 1024 + 1) + config.use_byte_buffer = kwargs.get("use_byte_buffer", False) + + # Page blob uploads + config.max_page_size = kwargs.get("max_page_size", 4 * 1024 * 1024) + + # Blob downloads + config.max_single_get_size = kwargs.get("max_single_get_size", 32 * 1024 * 1024) + config.max_chunk_get_size = kwargs.get("max_chunk_get_size", 4 * 1024 * 1024) + + # File uploads + config.max_range_size = kwargs.get("max_range_size", 4 * 1024 * 1024) + return config + + +def parse_query(query_str): + sas_values = QueryStringConstants.to_list() + parsed_query = {k: v[0] for k, v in parse_qs(query_str).items()} + sas_params = ["{}={}".format(k, quote(v, safe='')) for k, v in parsed_query.items() if k in sas_values] + sas_token = None + if sas_params: + sas_token = "&".join(sas_params) + + snapshot = parsed_query.get("snapshot") or parsed_query.get("sharesnapshot") + return snapshot, sas_token + + +def is_credential_sastoken(credential): + if not credential or not isinstance(credential, six.string_types): + return False + + sas_values = QueryStringConstants.to_list() + parsed_query = parse_qs(credential.lstrip("?")) + if parsed_query and all([k in sas_values for k in parsed_query.keys()]): + return True + return False diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/base_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/base_client_async.py new file mode 100644 index 000000000000..18597c9a5a29 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/base_client_async.py @@ -0,0 +1,174 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from typing import ( # pylint: disable=unused-import + Union, Optional, Any, Iterable, Dict, List, Type, Tuple, + TYPE_CHECKING +) +import logging +from azure.core.pipeline import AsyncPipeline +from azure.core.async_paging import AsyncList +from azure.core.exceptions import HttpResponseError +from azure.core.pipeline.policies import ( + ContentDecodePolicy, + AsyncBearerTokenCredentialPolicy, + AsyncRedirectPolicy, + DistributedTracingPolicy, + HttpLoggingPolicy, +) +from azure.core.pipeline.transport import AsyncHttpTransport + +from .constants import STORAGE_OAUTH_SCOPE, CONNECTION_TIMEOUT, READ_TIMEOUT +from .authentication import SharedKeyCredentialPolicy +from .base_client import create_configuration +from .policies import ( + StorageContentValidation, + StorageRequestHook, + StorageHosts, + StorageHeadersPolicy +) +from .policies_async import AsyncStorageResponseHook + +from .response_handlers import process_table_error, PartialBatchErrorException + +if TYPE_CHECKING: + from azure.core.pipeline import Pipeline + from azure.core.pipeline.transport import HttpRequest + from azure.core.configuration import Configuration +_LOGGER = logging.getLogger(__name__) + + +class AsyncStorageAccountHostsMixin(object): + + def __enter__(self): + raise TypeError("Async client only supports 'async with'.") + + def __exit__(self, *args): + pass + + async def __aenter__(self): + await self._client.__aenter__() + return self + + async def __aexit__(self, *args): + await self._client.__aexit__(*args) + + async def close(self): + """ This method is to close the sockets opened by the client. + It need not be used when using with a context manager. + """ + await self._client.close() + + def _create_pipeline(self, credential, **kwargs): + # type: (Any, **Any) -> Tuple[Configuration, Pipeline] + self._credential_policy = None + if hasattr(credential, 'get_token'): + self._credential_policy = AsyncBearerTokenCredentialPolicy(credential, STORAGE_OAUTH_SCOPE) + elif isinstance(credential, SharedKeyCredentialPolicy): + self._credential_policy = credential + elif credential is not None: + raise TypeError("Unsupported credential: {}".format(credential)) + config = kwargs.get('_configuration') or create_configuration(**kwargs) + if kwargs.get('_pipeline'): + return config, kwargs['_pipeline'] + config.transport = kwargs.get('transport') # type: ignore + kwargs.setdefault("connection_timeout", CONNECTION_TIMEOUT) + kwargs.setdefault("read_timeout", READ_TIMEOUT) + if not config.transport: + try: + from azure.core.pipeline.transport import AioHttpTransport + except ImportError: + raise ImportError("Unable to create async transport. Please check aiohttp is installed.") + config.transport = AioHttpTransport(**kwargs) + policies = [ + config.headers_policy, + config.proxy_policy, + config.user_agent_policy, + StorageContentValidation(), + StorageRequestHook(**kwargs), + self._credential_policy, + ContentDecodePolicy(response_encoding="utf-8"), + AsyncRedirectPolicy(**kwargs), + StorageHosts(hosts=self._hosts, **kwargs), # type: ignore + config.retry_policy, + config.logging_policy, + AsyncStorageResponseHook(**kwargs), + DistributedTracingPolicy(**kwargs), + HttpLoggingPolicy(**kwargs), + ] + return config, AsyncPipeline(config.transport, policies=policies) + + async def _batch_send( + self, *reqs: 'HttpRequest', + **kwargs + ): + """Given a series of request, do a Storage batch call. + """ + # Pop it here, so requests doesn't feel bad about additional kwarg + raise_on_any_failure = kwargs.pop("raise_on_any_failure", True) + request = self._client._client.post( # pylint: disable=protected-access + url='https://{}/?comp=batch'.format(self.primary_hostname), + headers={ + 'x-ms-version': self.api_version + } + ) + + request.set_multipart_mixed( + *reqs, + policies=[ + StorageHeadersPolicy(), + self._credential_policy + ], + enforce_https=False + ) + + pipeline_response = await self._pipeline.run( + request, **kwargs + ) + response = pipeline_response.http_response + + try: + if response.status_code not in [202]: + raise HttpResponseError(response=response) + parts = response.parts() # Return an AsyncIterator + if raise_on_any_failure: + parts_list = [] + async for part in parts: + parts_list.append(part) + if any(p for p in parts_list if not 200 <= p.status_code < 300): + error = PartialBatchErrorException( + message="There is a partial failure in the batch operation.", + response=response, parts=parts_list + ) + raise error + return AsyncList(parts_list) + return parts + except HttpResponseError as error: + process_table_error(error) + + +class AsyncTransportWrapper(AsyncHttpTransport): + """Wrapper class that ensures that an inner client created + by a `get_client` method does not close the outer transport for the parent + when used in a context manager. + """ + def __init__(self, async_transport): + self._transport = async_transport + + async def send(self, request, **kwargs): + return await self._transport.send(request, **kwargs) + + async def open(self): + pass + + async def close(self): + pass + + async def __aenter__(self): + pass + + async def __aexit__(self, *args): # pylint: disable=arguments-differ + pass diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/constants.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/constants.py new file mode 100644 index 000000000000..7fb05b559850 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/constants.py @@ -0,0 +1,26 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import sys +from .._generated.version import VERSION + + +X_MS_VERSION = VERSION + +# Socket timeout in seconds +CONNECTION_TIMEOUT = 20 +READ_TIMEOUT = 20 + +# for python 3.5+, there was a change to the definition of the socket timeout (as far as socket.sendall is concerned) +# The socket timeout is now the maximum total duration to send all data. +if sys.version_info >= (3, 5): + # the timeout to connect is 20 seconds, and the read timeout is 2000 seconds + # the 2000 seconds was calculated with: 100MB (max block size)/ 50KB/s (an arbitrarily chosen minimum upload speed) + READ_TIMEOUT = 2000 + +STORAGE_OAUTH_SCOPE = "https://storage.azure.com/.default" + +SERVICE_HOST_BASE = 'core.windows.net' diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/models.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/models.py new file mode 100644 index 000000000000..c7ff9db66035 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/models.py @@ -0,0 +1,350 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from enum import Enum + + +def get_enum_value(value): + if value is None or value in ["None", ""]: + return None + try: + return value.value + except AttributeError: + return value + + +class TableErrorCode(str, Enum): + # Generic storage values + account_already_exists = "AccountAlreadyExists" + account_being_created = "AccountBeingCreated" + account_is_disabled = "AccountIsDisabled" + authentication_failed = "AuthenticationFailed" + authorization_failure = "AuthorizationFailure" + no_authentication_information = "NoAuthenticationInformation" + condition_headers_not_supported = "ConditionHeadersNotSupported" + condition_not_met = "ConditionNotMet" + empty_metadata_key = "EmptyMetadataKey" + insufficient_account_permissions = "InsufficientAccountPermissions" + internal_error = "InternalError" + invalid_authentication_info = "InvalidAuthenticationInfo" + invalid_header_value = "InvalidHeaderValue" + invalid_http_verb = "InvalidHttpVerb" + invalid_input = "InvalidInput" + invalid_md5 = "InvalidMd5" + invalid_metadata = "InvalidMetadata" + invalid_query_parameter_value = "InvalidQueryParameterValue" + invalid_range = "InvalidRange" + invalid_resource_name = "InvalidResourceName" + invalid_uri = "InvalidUri" + invalid_xml_document = "InvalidXmlDocument" + invalid_xml_node_value = "InvalidXmlNodeValue" + md5_mismatch = "Md5Mismatch" + metadata_too_large = "MetadataTooLarge" + missing_content_length_header = "MissingContentLengthHeader" + missing_required_query_parameter = "MissingRequiredQueryParameter" + missing_required_header = "MissingRequiredHeader" + missing_required_xml_node = "MissingRequiredXmlNode" + multiple_condition_headers_not_supported = "MultipleConditionHeadersNotSupported" + operation_timed_out = "OperationTimedOut" + out_of_range_input = "OutOfRangeInput" + out_of_range_query_parameter_value = "OutOfRangeQueryParameterValue" + request_body_too_large = "RequestBodyTooLarge" + resource_type_mismatch = "ResourceTypeMismatch" + request_url_failed_to_parse = "RequestUrlFailedToParse" + resource_already_exists = "ResourceAlreadyExists" + resource_not_found = "ResourceNotFound" + server_busy = "ServerBusy" + unsupported_header = "UnsupportedHeader" + unsupported_xml_node = "UnsupportedXmlNode" + unsupported_query_parameter = "UnsupportedQueryParameter" + unsupported_http_verb = "UnsupportedHttpVerb" + + # table error codes + duplicate_properties_specified = "DuplicatePropertiesSpecified" + entity_not_found = "EntityNotFound" + entity_already_exists = "EntityAlreadyExists" + entity_too_large = "EntityTooLarge" + host_information_not_present = "HostInformationNotPresent" + invalid_duplicate_row = "InvalidDuplicateRow" + invalid_value_type = "InvalidValueType" + json_format_not_supported = "JsonFormatNotSupported" + method_not_allowed = "MethodNotAllowed" + not_implemented = "NotImplemented" + properties_need_value = "PropertiesNeedValue" + property_name_invalid = "PropertyNameInvalid" + property_name_too_long = "PropertyNameTooLong" + property_value_too_large = "PropertyValueTooLarge" + table_already_exists = "TableAlreadyExists" + table_being_deleted = "TableBeingDeleted" + table_not_found = "TableNotFound" + too_many_properties = "TooManyProperties" + update_condition_not_satisfied = "UpdateConditionNotSatisfied" + x_method_incorrect_count = "XMethodIncorrectCount" + x_method_incorrect_value = "XMethodIncorrectValue" + x_method_not_using_post = "XMethodNotUsingPost" + + +class DictMixin(object): + + def __setitem__(self, key, item): + self.__dict__[key] = item + + def __getitem__(self, key): + return self.__dict__[key] + + def __repr__(self): + return str(self) + + def __len__(self): + return len(self.keys()) + + def __delitem__(self, key): + self.__dict__[key] = None + + def __eq__(self, other): + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other): + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self): + return str({k: v for k, v in self.__dict__.items() if not k.startswith('_')}) + + def has_key(self, k): + return k in self.__dict__ + + def update(self, *args, **kwargs): + return self.__dict__.update(*args, **kwargs) + + def keys(self): + return [k for k in self.__dict__ if not k.startswith('_')] + + def values(self): + return [v for k, v in self.__dict__.items() if not k.startswith('_')] + + def items(self): + return [(k, v) for k, v in self.__dict__.items() if not k.startswith('_')] + + def get(self, key, default=None): + if key in self.__dict__: + return self.__dict__[key] + return default + + +class LocationMode(object): + """ + Specifies the location the request should be sent to. This mode only applies + for RA-GRS accounts which allow secondary read access. All other account types + must use PRIMARY. + """ + + PRIMARY = 'primary' #: Requests should be sent to the primary location. + SECONDARY = 'secondary' #: Requests should be sent to the secondary location, if possible. + + +class ResourceTypes(object): + """ + Specifies the resource types that are accessible with the account SAS. + + :param bool service: + Access to service-level APIs (e.g., Get/Set Service Properties, + Get Service Stats, List Containers/Queues/Shares) + :param bool object: + Access to object-level APIs for blobs, queue messages, and + files(e.g. Put Blob, Query Entity, Get Messages, Create File, etc.) + """ + + def __init__(self, service=False, object=False): # pylint: disable=redefined-builtin + self.service = service + self.object = object + self._str = (('s' if self.service else '') + + ('o' if self.object else '')) + + def __str__(self): + return self._str + + @classmethod + def from_string(cls, string): + """Create a ResourceTypes from a string. + + To specify service, container, or object you need only to + include the first letter of the word in the string. E.g. service and container, + you would provide a string "sc". + + :param str string: Specify service, container, or object in + in the string with the first letter of the word. + :return: A ResourceTypes object + :rtype: ~azure.data.tables.ResourceTypes + """ + res_service = 's' in string + res_object = 'o' in string + + parsed = cls(res_service, res_object) + parsed._str = string # pylint: disable = protected-access + return parsed + + +class AccountSasPermissions(object): + """ + :class:`~ResourceTypes` class to be used with generate_account_sas + function and for the AccessPolicies used with set_*_acl. There are two types of + SAS which may be used to grant resource access. One is to grant access to a + specific resource (resource-specific). Another is to grant access to the + entire service for a specific account and allow certain operations based on + perms found here. + + :ivar bool read: + Valid for all signed resources types (Service, Container, and Object). + Permits read permissions to the specified resource type. + :ivar bool write: + Valid for all signed resources types (Service, Container, and Object). + Permits write permissions to the specified resource type. + :ivar bool delete: + Valid for Container and Object resource types, except for queue messages. + :ivar bool list: + Valid for Service and Container resource types only. + :ivar bool add: + Valid for the following Object resource types only: queue messages, and append blobs. + :ivar bool create: + Valid for the following Object resource types only: blobs and files. + Users can create new blobs or files, but may not overwrite existing + blobs or files. + :ivar bool update: + Valid for the following Object resource types only: queue messages. + :ivar bool process: + Valid for the following Object resource type only: queue messages. + """ + + def __init__(self, **kwargs): # pylint: disable=redefined-builtin + self.read = kwargs.pop('read', None) + self.write = kwargs.pop('write', None) + self.delete = kwargs.pop('delete', None) + self.list = kwargs.pop('list', None) + self.add = kwargs.pop('add', None) + self.create = kwargs.pop('create', None) + self.update = kwargs.pop('update', None) + self.process = kwargs.pop('process', None) + self._str = (('r' if self.read else '') + + ('w' if self.write else '') + + ('d' if self.delete else '') + + ('l' if self.list else '') + + ('a' if self.add else '') + + ('c' if self.create else '') + + ('u' if self.update else '') + + ('p' if self.process else '')) + + def __str__(self): + return self._str + + @classmethod + def from_string(cls, permission, **kwargs): # pylint:disable=W0613 + """Create AccountSasPermissions from a string. + + To specify read, write, delete, etc. permissions you need only to + include the first letter of the word in the string. E.g. for read and write + permissions you would provide a string "rw". + + :param str permission: Specify permissions in + the string with the first letter of the word. + :keyword callable cls: A custom type or function that will be passed the direct response + :return: A AccountSasPermissions object + :rtype: ~azure.data.tables.AccountSasPermissions + """ + p_read = 'r' in permission + p_write = 'w' in permission + p_delete = 'd' in permission + p_list = 'l' in permission + p_add = 'a' in permission + p_create = 'c' in permission + p_update = 'u' in permission + p_process = 'p' in permission + + parsed = cls( + **dict(kwargs, read=p_read, write=p_write, delete=p_delete, list=p_list, add=p_add, create=p_create, + update=p_update, process=p_process)) + parsed._str = permission # pylint: disable = protected-access + return parsed + + +class Services(object): + """Specifies the services accessible with the account SAS. + + :param bool blob: + Access for the `~azure.storage.blob.BlobServiceClient` + :param bool queue: + Access for the `~azure.data.tables.QueueServiceClient` + :param bool fileshare: + Access for the `~azure.storage.fileshare.ShareServiceClient` + """ + + def __init__(self, blob=False, queue=False, fileshare=False): + self.blob = blob + self.queue = queue + self.fileshare = fileshare + self._str = (('b' if self.blob else '') + + ('q' if self.queue else '') + + ('f' if self.fileshare else '')) + + def __str__(self): + return self._str + + @classmethod + def from_string(cls, string): + """Create Services from a string. + + To specify blob, queue, or file you need only to + include the first letter of the word in the string. E.g. for blob and queue + you would provide a string "bq". + + :param str string: Specify blob, queue, or file in + in the string with the first letter of the word. + :return: A Services object + :rtype: ~azure.data.tables.Services + """ + res_blob = 'b' in string + res_queue = 'q' in string + res_file = 'f' in string + + parsed = cls(res_blob, res_queue, res_file) + parsed._str = string # pylint: disable = protected-access + return parsed + + +class UserDelegationKey(object): + """ + Represents a user delegation key, provided to the user by Azure Storage + based on their Azure Active Directory access token. + + The fields are saved as simple strings since the user does not have to interact with this object; + to generate an identify SAS, the user can simply pass it to the right API. + + :ivar str signed_oid: + Object ID of this token. + :ivar str signed_tid: + Tenant ID of the tenant that issued this token. + :ivar str signed_start: + The datetime this token becomes valid. + :ivar str signed_expiry: + The datetime this token expires. + :ivar str signed_service: + What service this key is valid for. + :ivar str signed_version: + The version identifier of the REST service that created this token. + :ivar str value: + The user delegation key. + """ + + def __init__(self): + self.signed_oid = None + self.signed_tid = None + self.signed_start = None + self.signed_expiry = None + self.signed_service = None + self.signed_version = None + self.value = None diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/parser.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/parser.py new file mode 100644 index 000000000000..c6feba8a6393 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/parser.py @@ -0,0 +1,20 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import sys + +if sys.version_info < (3,): + def _str(value): + if isinstance(value, unicode): # pylint: disable=undefined-variable + return value.encode('utf-8') + + return str(value) +else: + _str = str + + +def _to_utc_datetime(value): + return value.strftime('%Y-%m-%dT%H:%M:%SZ') diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/policies.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/policies.py new file mode 100644 index 000000000000..adc84c59dded --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/policies.py @@ -0,0 +1,628 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import base64 +import hashlib +import re +import random +from time import time +from io import SEEK_SET, UnsupportedOperation +import logging +import uuid +import types +from typing import Any, TYPE_CHECKING +from wsgiref.handlers import format_date_time + +try: + from urllib.parse import ( + urlparse, + parse_qsl, + urlunparse, + urlencode, + ) +except ImportError: + from urllib import urlencode # type: ignore + from urlparse import ( # type: ignore + urlparse, + parse_qsl, + urlunparse, + ) + +from azure.core.pipeline.policies import ( + HeadersPolicy, + SansIOHTTPPolicy, + NetworkTraceLoggingPolicy, + HTTPPolicy, + RequestHistory +) +from azure.core.exceptions import AzureError, ServiceRequestError, ServiceResponseError + +from .models import LocationMode + +try: + _unicode_type = unicode # type: ignore +except NameError: + _unicode_type = str + +if TYPE_CHECKING: + from azure.core.pipeline import PipelineRequest, PipelineResponse + +_LOGGER = logging.getLogger(__name__) + + +def encode_base64(data): + if isinstance(data, _unicode_type): + data = data.encode('utf-8') + encoded = base64.b64encode(data) + return encoded.decode('utf-8') + + +def is_exhausted(settings): + """Are we out of retries?""" + retry_counts = (settings['total'], settings['connect'], settings['read'], settings['status']) + retry_counts = list(filter(None, retry_counts)) + if not retry_counts: + return False + return min(retry_counts) < 0 + + +def retry_hook(settings, **kwargs): + if settings['hook']: + settings['hook'](retry_count=settings['count'] - 1, location_mode=settings['mode'], **kwargs) + + +def is_retry(response, mode): + """Is this method/status code retryable? (Based on whitelists and control + variables such as the number of total retries to allow, whether to + respect the Retry-After header, whether this header is present, and + whether the returned status code is on the list of status codes to + be retried upon on the presence of the aforementioned header) + """ + status = response.http_response.status_code + if 300 <= status < 500: + # An exception occured, but in most cases it was expected. Examples could + # include a 309 Conflict or 412 Precondition Failed. + if status == 404 and mode == LocationMode.SECONDARY: + # Response code 404 should be retried if secondary was used. + return True + if status == 408: + # Response code 408 is a timeout and should be retried. + return True + return False + if status >= 500: + # Response codes above 500 with the exception of 501 Not Implemented and + # 505 Version Not Supported indicate a server issue and should be retried. + if status in [501, 505]: + return False + return True + return False + + +def urljoin(base_url, stub_url): + parsed = urlparse(base_url) + parsed = parsed._replace(path=parsed.path + '/' + stub_url) + return parsed.geturl() + + +class StorageHeadersPolicy(HeadersPolicy): + request_id_header_name = 'x-ms-client-request-id' + + def on_request(self, request): + # type: (PipelineRequest, Any) -> None + super(StorageHeadersPolicy, self).on_request(request) + current_time = format_date_time(time()) + request.http_request.headers['x-ms-date'] = current_time + request.http_request.headers['Date'] = current_time + custom_id = request.context.options.pop('client_request_id', None) + request.http_request.headers['x-ms-client-request-id'] = custom_id or str(uuid.uuid1()) + + def on_response(self, request, response): + # raise exception if the echoed client request id from the service is not identical to the one we sent + if self.request_id_header_name in response.http_response.headers: + + client_request_id = request.http_request.headers.get(self.request_id_header_name) + + if response.http_response.headers[self.request_id_header_name] != client_request_id: + raise AzureError( + "Echoed client request ID: {} does not match sent client request ID: {}. " + "Service request ID: {}".format( + response.http_response.headers[self.request_id_header_name], client_request_id, + response.http_response.headers['x-ms-request-id']), + response=response.http_response + ) + + +class StorageHosts(SansIOHTTPPolicy): + + def __init__(self, hosts=None, **kwargs): # pylint: disable=unused-argument + self.hosts = hosts + super(StorageHosts, self).__init__() + + def on_request(self, request): + # type: (PipelineRequest, Any) -> None + request.context.options['hosts'] = self.hosts + parsed_url = urlparse(request.http_request.url) + + # Detect what location mode we're currently requesting with + location_mode = LocationMode.PRIMARY + for key, value in self.hosts.items(): + if parsed_url.netloc == value: + location_mode = key + + # See if a specific location mode has been specified, and if so, redirect + use_location = request.context.options.pop('use_location', None) + if use_location: + # Lock retries to the specific location + request.context.options['retry_to_secondary'] = False + if use_location not in self.hosts: + raise ValueError("Attempting to use undefined host location {}".format(use_location)) + if use_location != location_mode: + # Update request URL to use the specified location + updated = parsed_url._replace(netloc=self.hosts[use_location]) + request.http_request.url = updated.geturl() + location_mode = use_location + + request.context.options['location_mode'] = location_mode + + +class StorageLoggingPolicy(NetworkTraceLoggingPolicy): + """A policy that logs HTTP request and response to the DEBUG logger. + + This accepts both global configuration, and per-request level with "enable_http_logger" + """ + + def on_request(self, request): + # type: (PipelineRequest, Any) -> None + http_request = request.http_request + options = request.context.options + if options.pop("logging_enable", self.enable_http_logger): + request.context["logging_enable"] = True + if not _LOGGER.isEnabledFor(logging.DEBUG): + return + + try: + log_url = http_request.url + query_params = http_request.query + if 'sig' in query_params: + log_url = log_url.replace(query_params['sig'], "sig=*****") + _LOGGER.debug("Request URL: %r", log_url) + _LOGGER.debug("Request method: %r", http_request.method) + _LOGGER.debug("Request headers:") + for header, value in http_request.headers.items(): + if header.lower() == 'authorization': + value = '*****' + elif header.lower() == 'x-ms-copy-source' and 'sig' in value: + # take the url apart and scrub away the signed signature + scheme, netloc, path, params, query, fragment = urlparse(value) + parsed_qs = dict(parse_qsl(query)) + parsed_qs['sig'] = '*****' + + # the SAS needs to be put back together + value = urlunparse((scheme, netloc, path, params, urlencode(parsed_qs), fragment)) + + _LOGGER.debug(" %r: %r", header, value) + _LOGGER.debug("Request body:") + + # We don't want to log the binary data of a file upload. + if isinstance(http_request.body, types.GeneratorType): + _LOGGER.debug("File upload") + else: + _LOGGER.debug(str(http_request.body)) + except Exception as err: # pylint: disable=broad-except + _LOGGER.debug("Failed to log request: %r", err) + + def on_response(self, request, response): + # type: (PipelineRequest, PipelineResponse, Any) -> None + if response.context.pop("logging_enable", self.enable_http_logger): + if not _LOGGER.isEnabledFor(logging.DEBUG): + return + + try: + _LOGGER.debug("Response status: %r", response.http_response.status_code) + _LOGGER.debug("Response headers:") + for res_header, value in response.http_response.headers.items(): + _LOGGER.debug(" %r: %r", res_header, value) + + # We don't want to log binary data if the response is a file. + _LOGGER.debug("Response content:") + pattern = re.compile(r'attachment; ?filename=["\w.]+', re.IGNORECASE) + header = response.http_response.headers.get('content-disposition') + + if header and pattern.match(header): + filename = header.partition('=')[2] + _LOGGER.debug("File attachments: %s", filename) + elif response.http_response.headers.get("content-type", "").endswith("octet-stream"): + _LOGGER.debug("Body contains binary data.") + elif response.http_response.headers.get("content-type", "").startswith("image"): + _LOGGER.debug("Body contains image data.") + else: + if response.context.options.get('stream', False): + _LOGGER.debug("Body is streamable") + else: + _LOGGER.debug(response.http_response.text()) + except Exception as err: # pylint: disable=broad-except + _LOGGER.debug("Failed to log response: %s", repr(err)) + + +class StorageRequestHook(SansIOHTTPPolicy): + + def __init__(self, **kwargs): # pylint: disable=unused-argument + self._request_callback = kwargs.get('raw_request_hook') + super(StorageRequestHook, self).__init__() + + def on_request(self, request): + # type: (PipelineRequest, **Any) -> PipelineResponse + request_callback = request.context.options.pop('raw_request_hook', self._request_callback) + if request_callback: + request_callback(request) + + +class StorageResponseHook(HTTPPolicy): + + def __init__(self, **kwargs): # pylint: disable=unused-argument + self._response_callback = kwargs.get('raw_response_hook') + super(StorageResponseHook, self).__init__() + + def send(self, request): + # type: (PipelineRequest) -> PipelineResponse + data_stream_total = request.context.get('data_stream_total') or \ + request.context.options.pop('data_stream_total', None) + download_stream_current = request.context.get('download_stream_current') or \ + request.context.options.pop('download_stream_current', None) + upload_stream_current = request.context.get('upload_stream_current') or \ + request.context.options.pop('upload_stream_current', None) + response_callback = request.context.get('response_callback') or \ + request.context.options.pop('raw_response_hook', self._response_callback) + + response = self.next.send(request) + will_retry = is_retry(response, request.context.options.get('mode')) + if not will_retry and download_stream_current is not None: + download_stream_current += int(response.http_response.headers.get('Content-Length', 0)) + if data_stream_total is None: + content_range = response.http_response.headers.get('Content-Range') + if content_range: + data_stream_total = int(content_range.split(' ', 1)[1].split('/', 1)[1]) + else: + data_stream_total = download_stream_current + elif not will_retry and upload_stream_current is not None: + upload_stream_current += int(response.http_request.headers.get('Content-Length', 0)) + for pipeline_obj in [request, response]: + pipeline_obj.context['data_stream_total'] = data_stream_total + pipeline_obj.context['download_stream_current'] = download_stream_current + pipeline_obj.context['upload_stream_current'] = upload_stream_current + if response_callback: + response_callback(response) + request.context['response_callback'] = response_callback + return response + + +class StorageContentValidation(SansIOHTTPPolicy): + """A simple policy that sends the given headers + with the request. + + This will overwrite any headers already defined in the request. + """ + header_name = 'Content-MD5' + + def __init__(self, **kwargs): # pylint: disable=unused-argument + super(StorageContentValidation, self).__init__() + + @staticmethod + def get_content_md5(data): + md5 = hashlib.md5() # nosec + if isinstance(data, bytes): + md5.update(data) + elif hasattr(data, 'read'): + pos = 0 + try: + pos = data.tell() + except: # pylint: disable=bare-except + pass + for chunk in iter(lambda: data.read(4096), b""): + md5.update(chunk) + try: + data.seek(pos, SEEK_SET) + except (AttributeError, IOError): + raise ValueError("Data should be bytes or a seekable file-like object.") + else: + raise ValueError("Data should be bytes or a seekable file-like object.") + + return md5.digest() + + def on_request(self, request): + # type: (PipelineRequest, Any) -> None + validate_content = request.context.options.pop('validate_content', False) + if validate_content and request.http_request.method != 'GET': + computed_md5 = encode_base64(StorageContentValidation.get_content_md5(request.http_request.data)) + request.http_request.headers[self.header_name] = computed_md5 + request.context['validate_content_md5'] = computed_md5 + request.context['validate_content'] = validate_content + + def on_response(self, request, response): + if response.context.get('validate_content', False) and response.http_response.headers.get('content-md5'): + computed_md5 = request.context.get('validate_content_md5') or \ + encode_base64(StorageContentValidation.get_content_md5(response.http_response.body())) + if response.http_response.headers['content-md5'] != computed_md5: + raise AzureError( + 'MD5 mismatch. Expected value is \'{0}\', computed value is \'{1}\'.'.format( + response.http_response.headers['content-md5'], computed_md5), + response=response.http_response + ) + + +class StorageRetryPolicy(HTTPPolicy): + """ + The base class for Exponential and Linear retries containing shared code. + """ + + def __init__(self, **kwargs): + self.total_retries = kwargs.pop('retry_total', 10) + self.connect_retries = kwargs.pop('retry_connect', 3) + self.read_retries = kwargs.pop('retry_read', 3) + self.status_retries = kwargs.pop('retry_status', 3) + self.retry_to_secondary = kwargs.pop('retry_to_secondary', False) + super(StorageRetryPolicy, self).__init__() + + def _set_next_host_location(self, settings, request): # pylint: disable=no-self-use + """ + A function which sets the next host location on the request, if applicable. + + :param ~azure.storage.models.RetryContext context: + The retry context containing the previous host location and the request + to evaluate and possibly modify. + """ + if settings['hosts'] and all(settings['hosts'].values()): + url = urlparse(request.url) + # If there's more than one possible location, retry to the alternative + if settings['mode'] == LocationMode.PRIMARY: + settings['mode'] = LocationMode.SECONDARY + else: + settings['mode'] = LocationMode.PRIMARY + updated = url._replace(netloc=settings['hosts'].get(settings['mode'])) + request.url = updated.geturl() + + def configure_retries(self, request): # pylint: disable=no-self-use + # type: (...)-> dict + """ + :param Any request: + :param kwargs: + :return: + :rtype:dict + """ + body_position = None + if hasattr(request.http_request.body, 'read'): + try: + body_position = request.http_request.body.tell() + except (AttributeError, UnsupportedOperation): + # if body position cannot be obtained, then retries will not work + pass + options = request.context.options + return { + 'total': options.pop("retry_total", self.total_retries), + 'connect': options.pop("retry_connect", self.connect_retries), + 'read': options.pop("retry_read", self.read_retries), + 'status': options.pop("retry_status", self.status_retries), + 'retry_secondary': options.pop("retry_to_secondary", self.retry_to_secondary), + 'mode': options.pop("location_mode", LocationMode.PRIMARY), + 'hosts': options.pop("hosts", None), + 'hook': options.pop("retry_hook", None), + 'body_position': body_position, + 'count': 0, + 'history': [] + } + + def get_backoff_time(self, settings, **kwargs): # pylint: disable=unused-argument,no-self-use + """ Formula for computing the current backoff. + Should be calculated by child class. + :param Any settings: + :keyword callable cls: A custom type or function that will be passed the direct response + :rtype: float + """ + return 0 + + def sleep(self, settings, transport): + # type: (...)->None + """ + :param Any settings: + :param Any transport: + :return:None + """ + backoff = self.get_backoff_time(settings, ) + if not backoff or backoff < 0: + return + transport.sleep(backoff) + + def increment(self, settings, request, response=None, error=None, **kwargs): # pylint:disable=W0613 + # type: (...)->None + """Increment the retry counters. + + :param Any request: + :param dict settings: + :param Any response: A pipeline response object. + :param Any error: An error encountered during the request, or + None if the response was received successfully. + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Whether the retry attempts are exhausted. + :rtype: None + """ + settings['total'] -= 1 + + if error and isinstance(error, ServiceRequestError): + # Errors when we're fairly sure that the server did not receive the + # request, so it should be safe to retry. + settings['connect'] -= 1 + settings['history'].append(RequestHistory(request, error=error)) + + elif error and isinstance(error, ServiceResponseError): + # Errors that occur after the request has been started, so we should + # assume that the server began processing it. + settings['read'] -= 1 + settings['history'].append(RequestHistory(request, error=error)) + + else: + # Incrementing because of a server error like a 500 in + # status_forcelist and a the given method is in the whitelist + if response: + settings['status'] -= 1 + settings['history'].append(RequestHistory(request, http_response=response)) + + if not is_exhausted(settings): + if request.method not in ['PUT'] and settings['retry_secondary']: + self._set_next_host_location(settings, request) + + # rewind the request body if it is a stream + if request.body and hasattr(request.body, 'read'): + # no position was saved, then retry would not work + if settings['body_position'] is None: + return False + try: + # attempt to rewind the body to the initial position + request.body.seek(settings['body_position'], SEEK_SET) + except (UnsupportedOperation, ValueError): + # if body is not seekable, then retry would not work + return False + settings['count'] += 1 + return True + return False + + def send(self, request): + """ + :param Any request: + :return: None + """ + retries_remaining = True + response = None + retry_settings = self.configure_retries(request) + while retries_remaining: + try: + response = self.next.send(request) + if is_retry(response, retry_settings['mode']): + retries_remaining = self.increment( + retry_settings, + request=request.http_request, + response=response.http_response) + if retries_remaining: + retry_hook( + retry_settings, + request=request.http_request, + response=response.http_response, + error=None) + self.sleep(retry_settings, request.context.transport) + continue + break + except AzureError as err: + retries_remaining = self.increment( + retry_settings, request=request.http_request, error=err) + if retries_remaining: + retry_hook( + retry_settings, + request=request.http_request, + response=None, + error=err) + self.sleep(retry_settings, request.context.transport) + continue + raise err + if retry_settings['history']: + response.context['history'] = retry_settings['history'] + response.http_response.location_mode = retry_settings['mode'] + return response + + +class ExponentialRetry(StorageRetryPolicy): + """Exponential retry.""" + + def __init__(self, initial_backoff=15, increment_base=3, retry_total=3, + retry_to_secondary=False, random_jitter_range=3, **kwargs): + """ + Constructs an Exponential retry object. The initial_backoff is used for + the first retry. Subsequent retries are retried after initial_backoff + + increment_power^retry_count seconds. For example, by default the first retry + occurs after 15 seconds, the second after (15+3^1) = 18 seconds, and the + third after (15+3^2) = 24 seconds. + + :param int initial_backoff: + The initial backoff interval, in seconds, for the first retry. + :param int increment_base: + The base, in seconds, to increment the initial_backoff by after the + first retry. + :param int max_attempts: + The maximum number of retry attempts. + :param int retry_total: total number of retries + :param bool retry_to_secondary: + Whether the request should be retried to secondary, if able. This should + only be enabled of RA-GRS accounts are used and potentially stale data + can be handled. + :param int random_jitter_range: + A number in seconds which indicates a range to jitter/randomize for the back-off interval. + For example, a random_jitter_range of 3 results in the back-off interval x to vary between x+3 and x-3. + """ + self.initial_backoff = initial_backoff + self.increment_base = increment_base + self.random_jitter_range = random_jitter_range + super(ExponentialRetry, self).__init__( + retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) + + def get_backoff_time(self, settings, **kwargs): + """ + Calculates how long to sleep before retrying. + :param **kwargs: + :param dict settings: + :keyword callable cls: A custom type or function that will be passed the direct response + :return: + An integer indicating how long to wait before retrying the request, + or None to indicate no retry should be performed. + :rtype: int or None + """ + random_generator = random.Random() + backoff = self.initial_backoff + (0 if settings['count'] == 0 else pow(self.increment_base, settings['count'])) + random_range_start = backoff - self.random_jitter_range if backoff > self.random_jitter_range else 0 + random_range_end = backoff + self.random_jitter_range + return random_generator.uniform(random_range_start, random_range_end) + + +class LinearRetry(StorageRetryPolicy): + """Linear retry.""" + + def __init__(self, backoff=15, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): + """ + Constructs a Linear retry object. + + :param int backoff: + The backoff interval, in seconds, between retries. + :param int max_attempts: + The maximum number of retry attempts. + :param bool retry_to_secondary: + Whether the request should be retried to secondary, if able. This should + only be enabled of RA-GRS accounts are used and potentially stale data + can be handled. + :param int retry_total: total number of retries + :param int random_jitter_range: + A number in seconds which indicates a range to jitter/randomize for the back-off interval. + For example, a random_jitter_range of 3 results in the back-off interval x to vary between x+3 and x-3. + """ + self.backoff = backoff + self.random_jitter_range = random_jitter_range + super(LinearRetry, self).__init__( + retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) + + def get_backoff_time(self, settings, **kwargs): + """ + Calculates how long to sleep before retrying. + + :param dict settings: + :keyword callable cls: A custom type or function that will be passed the direct response + :return: + An integer indicating how long to wait before retrying the request, + or None to indicate no retry should be performed. + :rtype: int or None + """ + random_generator = random.Random() + # the backoff interval normally does not change, however there is the possibility + # that it was modified by accessing the property directly after initializing the object + random_range_start = self.backoff - self.random_jitter_range \ + if self.backoff > self.random_jitter_range else 0 + random_range_end = self.backoff + self.random_jitter_range + return random_generator.uniform(random_range_start, random_range_end) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/policies_async.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/policies_async.py new file mode 100644 index 000000000000..f627df43f9e4 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/policies_async.py @@ -0,0 +1,221 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import asyncio +import random +import logging +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline.policies import AsyncHTTPPolicy +from azure.core.exceptions import AzureError + +from .policies import is_retry, StorageRetryPolicy + +if TYPE_CHECKING: + from azure.core.pipeline import PipelineRequest, PipelineResponse + + +_LOGGER = logging.getLogger(__name__) + + +async def retry_hook(settings, **kwargs): + if settings['hook']: + if asyncio.iscoroutine(settings['hook']): + await settings['hook']( + retry_count=settings['count'] - 1, + location_mode=settings['mode'], + **kwargs) + else: + settings['hook']( + retry_count=settings['count'] - 1, + location_mode=settings['mode'], + **kwargs) + + +class AsyncStorageResponseHook(AsyncHTTPPolicy): + + def __init__(self, **kwargs): # pylint: disable=unused-argument + self._response_callback = kwargs.get('raw_response_hook') + super(AsyncStorageResponseHook, self).__init__() + + async def send(self, request): + # type: (PipelineRequest) -> PipelineResponse + data_stream_total = request.context.get('data_stream_total') or \ + request.context.options.pop('data_stream_total', None) + download_stream_current = request.context.get('download_stream_current') or \ + request.context.options.pop('download_stream_current', None) + upload_stream_current = request.context.get('upload_stream_current') or \ + request.context.options.pop('upload_stream_current', None) + response_callback = request.context.get('response_callback') or \ + request.context.options.pop('raw_response_hook', self._response_callback) + + response = await self.next.send(request) + await response.http_response.load_body() + + will_retry = is_retry(response, request.context.options.get('mode')) + if not will_retry and download_stream_current is not None: + download_stream_current += int(response.http_response.headers.get('Content-Length', 0)) + if data_stream_total is None: + content_range = response.http_response.headers.get('Content-Range') + if content_range: + data_stream_total = int(content_range.split(' ', 1)[1].split('/', 1)[1]) + else: + data_stream_total = download_stream_current + elif not will_retry and upload_stream_current is not None: + upload_stream_current += int(response.http_request.headers.get('Content-Length', 0)) + for pipeline_obj in [request, response]: + pipeline_obj.context['data_stream_total'] = data_stream_total + pipeline_obj.context['download_stream_current'] = download_stream_current + pipeline_obj.context['upload_stream_current'] = upload_stream_current + if response_callback: + if asyncio.iscoroutine(response_callback): + await response_callback(response) + else: + response_callback(response) + request.context['response_callback'] = response_callback + return response + +class AsyncStorageRetryPolicy(StorageRetryPolicy): + """ + The base class for Exponential and Linear retries containing shared code. + """ + + async def sleep(self, settings, transport): # pylint: disable =W0236 + backoff = self.get_backoff_time(settings) + if not backoff or backoff < 0: + return + await transport.sleep(backoff) + + async def send(self, request): # pylint: disable =W0236 + retries_remaining = True + response = None + retry_settings = self.configure_retries(request) + while retries_remaining: + try: + response = await self.next.send(request) + if is_retry(response, retry_settings['mode']): + retries_remaining = self.increment( + retry_settings, + request=request.http_request, + response=response.http_response) + if retries_remaining: + await retry_hook( + retry_settings, + request=request.http_request, + response=response.http_response, + error=None) + await self.sleep(retry_settings, request.context.transport) + continue + break + except AzureError as err: + retries_remaining = self.increment( + retry_settings, request=request.http_request, error=err) + if retries_remaining: + await retry_hook( + retry_settings, + request=request.http_request, + response=None, + error=err) + await self.sleep(retry_settings, request.context.transport) + continue + raise err + if retry_settings['history']: + response.context['history'] = retry_settings['history'] + response.http_response.location_mode = retry_settings['mode'] + return response + + +class ExponentialRetry(AsyncStorageRetryPolicy): + """Exponential retry.""" + + def __init__(self, initial_backoff=15, increment_base=3, retry_total=3, + retry_to_secondary=False, random_jitter_range=3, **kwargs): + ''' + Constructs an Exponential retry object. The initial_backoff is used for + the first retry. Subsequent retries are retried after initial_backoff + + increment_power^retry_count seconds. For example, by default the first retry + occurs after 15 seconds, the second after (15+3^1) = 18 seconds, and the + third after (15+3^2) = 24 seconds. + + :param int initial_backoff: + The initial backoff interval, in seconds, for the first retry. + :param int increment_base: + The base, in seconds, to increment the initial_backoff by after the + first retry. + :param int max_attempts: + The maximum number of retry attempts. + :param bool retry_to_secondary: + Whether the request should be retried to secondary, if able. This should + only be enabled of RA-GRS accounts are used and potentially stale data + can be handled. + :param int random_jitter_range: + A number in seconds which indicates a range to jitter/randomize for the back-off interval. + For example, a random_jitter_range of 3 results in the back-off interval x to vary between x+3 and x-3. + ''' + self.initial_backoff = initial_backoff + self.increment_base = increment_base + self.random_jitter_range = random_jitter_range + super(ExponentialRetry, self).__init__( + retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) + + def get_backoff_time(self, settings, **kwargs): + """ + Calculates how long to sleep before retrying. + + :param **kwargs: + :return: + An integer indicating how long to wait before retrying the request, + or None to indicate no retry should be performed. + :rtype: int or None + """ + random_generator = random.Random() + backoff = self.initial_backoff + (0 if settings['count'] == 0 else pow(self.increment_base, settings['count'])) + random_range_start = backoff - self.random_jitter_range if backoff > self.random_jitter_range else 0 + random_range_end = backoff + self.random_jitter_range + return random_generator.uniform(random_range_start, random_range_end) + + +class LinearRetry(AsyncStorageRetryPolicy): + """Linear retry.""" + + def __init__(self, backoff=15, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): + """ + Constructs a Linear retry object. + + :param int backoff: + The backoff interval, in seconds, between retries. + :param int max_attempts: + The maximum number of retry attempts. + :param bool retry_to_secondary: + Whether the request should be retried to secondary, if able. This should + only be enabled of RA-GRS accounts are used and potentially stale data + can be handled. + :param int random_jitter_range: + A number in seconds which indicates a range to jitter/randomize for the back-off interval. + For example, a random_jitter_range of 3 results in the back-off interval x to vary between x+3 and x-3. + """ + self.backoff = backoff + self.random_jitter_range = random_jitter_range + super(LinearRetry, self).__init__( + retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) + + def get_backoff_time(self, settings, **kwargs): + """ + Calculates how long to sleep before retrying. + + :param **kwargs: + :return: + An integer indicating how long to wait before retrying the request, + or None to indicate no retry should be performed. + :rtype: int or None + """ + random_generator = random.Random() + # the backoff interval normally does not change, however there is the possibility + # that it was modified by accessing the property directly after initializing the object + random_range_start = self.backoff - self.random_jitter_range \ + if self.backoff > self.random_jitter_range else 0 + random_range_end = self.backoff + self.random_jitter_range + return random_generator.uniform(random_range_start, random_range_end) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/request_handlers.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/request_handlers.py new file mode 100644 index 000000000000..2ce74d43db21 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/request_handlers.py @@ -0,0 +1,147 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from typing import ( # pylint: disable=unused-import + Union, Optional, Any, Iterable, Dict, List, Type, Tuple, + TYPE_CHECKING +) + +import logging +from os import fstat +from io import (SEEK_END, SEEK_SET, UnsupportedOperation) + +import isodate + +from azure.core.exceptions import raise_with_traceback + + +_LOGGER = logging.getLogger(__name__) + + +def serialize_iso(attr): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: ValueError if format invalid. + """ + if not attr: + return None + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, + utc.tm_hour, utc.tm_min, utc.tm_sec) + return date + 'Z' + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(ValueError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + +def get_length(data): + length = None + # Check if object implements the __len__ method, covers most input cases such as bytearray. + try: + length = len(data) + except: # pylint: disable=bare-except + pass + + if not length: + # Check if the stream is a file-like stream object. + # If so, calculate the size using the file descriptor. + try: + fileno = data.fileno() + except (AttributeError, UnsupportedOperation): + pass + else: + try: + return fstat(fileno).st_size + except OSError: + # Not a valid fileno, may be possible requests returned + # a socket number? + pass + + # If the stream is seekable and tell() is implemented, calculate the stream size. + try: + current_position = data.tell() + data.seek(0, SEEK_END) + length = data.tell() - current_position + data.seek(current_position, SEEK_SET) + except (AttributeError, UnsupportedOperation): + pass + + return length + + +def read_length(data): + try: + if hasattr(data, 'read'): + read_data = b'' + for chunk in iter(lambda: data.read(4096), b""): + read_data += chunk + return len(read_data), read_data + if hasattr(data, '__iter__'): + read_data = b'' + for chunk in data: + read_data += chunk + return len(read_data), read_data + except: # pylint: disable=bare-except + pass + raise ValueError("Unable to calculate content length, please specify.") + + +def validate_and_format_range_headers( + start_range, end_range, start_range_required=True, + end_range_required=True, check_content_md5=False, align_to_page=False): + # If end range is provided, start range must be provided + if (start_range_required or end_range is not None) and start_range is None: + raise ValueError("start_range value cannot be None.") + if end_range_required and end_range is None: + raise ValueError("end_range value cannot be None.") + + # Page ranges must be 512 aligned + if align_to_page: + if start_range is not None and start_range % 512 != 0: + raise ValueError("Invalid page blob start_range: {0}. " + "The size must be aligned to a 512-byte boundary.".format(start_range)) + if end_range is not None and end_range % 512 != 511: + raise ValueError("Invalid page blob end_range: {0}. " + "The size must be aligned to a 512-byte boundary.".format(end_range)) + + # Format based on whether end_range is present + range_header = None + if end_range is not None: + range_header = 'bytes={0}-{1}'.format(start_range, end_range) + elif start_range is not None: + range_header = "bytes={0}-".format(start_range) + + # Content MD5 can only be provided for a complete range less than 4MB in size + range_validation = None + if check_content_md5: + if start_range is None or end_range is None: + raise ValueError("Both start and end range requied for MD5 content validation.") + if end_range - start_range > 4 * 1024 * 1024: + raise ValueError("Getting content MD5 for a range greater than 4MB is not supported.") + range_validation = 'true' + + return range_header, range_validation + + +def add_metadata_headers(metadata=None): + # type: (Optional[Dict[str, str]]) -> Dict[str, str] + headers = {} + if metadata: + for key, value in metadata.items(): + headers['x-ms-meta-{}'.format(key)] = value + return headers diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/response_handlers.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/response_handlers.py new file mode 100644 index 000000000000..2c542ac3c7a7 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/response_handlers.py @@ -0,0 +1,159 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from typing import ( # pylint: disable=unused-import + Union, Optional, Any, Iterable, Dict, List, Type, Tuple, + TYPE_CHECKING +) +import logging + +from azure.core.pipeline.policies import ContentDecodePolicy +from azure.core.exceptions import ( + HttpResponseError, + ResourceNotFoundError, + ResourceModifiedError, + ResourceExistsError, + ClientAuthenticationError, + DecodeError) + +from .parser import _to_utc_datetime +from .models import TableErrorCode, UserDelegationKey, get_enum_value + + +if TYPE_CHECKING: + from datetime import datetime + from azure.core.exceptions import AzureError + + +_LOGGER = logging.getLogger(__name__) + + +class PartialBatchErrorException(HttpResponseError): + """There is a partial failure in batch operations. + + :param str message: The message of the exception. + :param response: Server response to be deserialized. + :param list parts: A list of the parts in multipart response. + """ + + def __init__(self, message, response, parts): + self.parts = parts + super(PartialBatchErrorException, self).__init__(message=message, response=response) + + +def parse_length_from_content_range(content_range): + ''' + Parses the blob length from the content range header: bytes 1-3/65537 + ''' + if content_range is None: + return None + + # First, split in space and take the second half: '1-3/65537' + # Next, split on slash and take the second half: '65537' + # Finally, convert to an int: 65537 + return int(content_range.split(' ', 1)[1].split('/', 1)[1]) + + +def normalize_headers(headers): + normalized = {} + for key, value in headers.items(): + if key.startswith('x-ms-'): + key = key[5:] + normalized[key.lower().replace('-', '_')] = get_enum_value(value) + return normalized + + +def deserialize_metadata(response, obj, headers): # pylint: disable=unused-argument + raw_metadata = {k: v for k, v in response.headers.items() if k.startswith("x-ms-meta-")} + return {k[10:]: v for k, v in raw_metadata.items()} + + +def return_response_headers(response, deserialized, response_headers): # pylint: disable=unused-argument + return normalize_headers(response_headers) + + +def return_headers_and_deserialized(response, deserialized, response_headers): # pylint: disable=unused-argument + return normalize_headers(response_headers), deserialized + + +def return_context_and_deserialized(response, deserialized, response_headers): # pylint: disable=unused-argument + return response.http_response.location_mode, deserialized, response_headers + + +def process_table_error(storage_error): + raise_error = HttpResponseError + error_code = storage_error.response.headers.get('x-ms-error-code') + error_message = storage_error.message + additional_data = {} + try: + error_body = ContentDecodePolicy.deserialize_from_http_generics(storage_error.response) + if isinstance(error_body, dict): + for info in error_body['odata.error']: + if info == 'code': + error_code = error_body['odata.error'][info] + elif info == 'message': + error_message = error_body['odata.error'][info]['value'] + else: + additional_data[info.tag] = info.text + else: + if error_body: + for info in error_body.iter(): + if info.tag.lower().find('code') != -1: + error_code = info.text + elif info.tag.lower().find('message') != -1: + error_message = info.text + else: + additional_data[info.tag] = info.text + except DecodeError: + pass + + try: + if error_code: + error_code = TableErrorCode(error_code) + if error_code in [TableErrorCode.condition_not_met]: + raise_error = ResourceModifiedError + if error_code in [TableErrorCode.invalid_authentication_info, + TableErrorCode.authentication_failed]: + raise_error = ClientAuthenticationError + if error_code in [TableErrorCode.resource_not_found, + TableErrorCode.table_not_found, + TableErrorCode.entity_not_found, + ResourceNotFoundError]: + raise_error = ResourceNotFoundError + if error_code in [TableErrorCode.resource_already_exists, + TableErrorCode.table_already_exists, + TableErrorCode.account_already_exists, + TableErrorCode.entity_already_exists, + ResourceExistsError]: + raise_error = ResourceExistsError + except ValueError: + # Got an unknown error code + pass + + try: + + error_message += "\nErrorCode:{}".format(error_code.value) + except AttributeError: + error_message += "\nErrorCode:{}".format(error_code) + for name, info in additional_data.items(): + error_message += "\n{}:{}".format(name, info) + + error = raise_error(message=error_message, response=storage_error.response) + error.error_code = error_code + error.additional_info = additional_data + raise error + + +def parse_to_internal_user_delegation_key(service_user_delegation_key): + internal_user_delegation_key = UserDelegationKey() + internal_user_delegation_key.signed_oid = service_user_delegation_key.signed_oid + internal_user_delegation_key.signed_tid = service_user_delegation_key.signed_tid + internal_user_delegation_key.signed_start = _to_utc_datetime(service_user_delegation_key.signed_start) + internal_user_delegation_key.signed_expiry = _to_utc_datetime(service_user_delegation_key.signed_expiry) + internal_user_delegation_key.signed_service = service_user_delegation_key.signed_service + internal_user_delegation_key.signed_version = service_user_delegation_key.signed_version + internal_user_delegation_key.value = service_user_delegation_key.value + return internal_user_delegation_key diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/shared_access_signature.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/shared_access_signature.py new file mode 100644 index 000000000000..9ce7a0cf9f1a --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/shared_access_signature.py @@ -0,0 +1,243 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from datetime import date + +from azure.data.tables._shared import url_quote + + +from ._common_conversion import ( + _sign_string, + _to_str, _to_utc_datetime, +) +from ._constants import DEFAULT_X_MS_VERSION + + +class SharedAccessSignature(object): + """ + Provides a factory for creating account access + signature tokens with an account name and account key. Users can either + use the factory or can construct the appropriate service and use the + generate_*_shared_access_signature method directly. + """ + + def __init__(self, account_name, account_key, x_ms_version=DEFAULT_X_MS_VERSION): + """ + :param str account_name: + The storage account name used to generate the shared access signatures. + :param str account_key: + The access key to generate the shares access signatures. + :param str x_ms_version: + The service version used to generate the shared access signatures. + """ + self.account_name = account_name + self.account_key = account_key + self.x_ms_version = x_ms_version + + def generate_account(self, services, resource_types, permission, expiry, start=None, + ip_address_or_range=None, protocol=None): + ''' + Generates a shared access signature for the account. + Use the returned signature with the sas_token parameter of the service + or to create a new account object. + + :param Services services: + Specifies the services accessible with the account SAS. You can + combine values to provide access to more than one service. + :param ResourceTypes resource_types: + Specifies the resource types that are accessible with the account + SAS. You can combine values to provide access to more than one + resource type. + :param AccountPermissions permission: + The permissions associated with the shared access signature. The + user is restricted to operations allowed by the permissions. + Required unless an id is given referencing a stored access policy + which contains this field. This field must be omitted if it has been + specified in an associated stored access policy. You can combine + values to provide more than one permission. + :param expiry: + The time at which the shared access signature becomes invalid. + Required unless an id is given referencing a stored access policy + which contains this field. This field must be omitted if it has + been specified in an associated stored access policy. Azure will always + convert values to UTC. If a date is passed in without timezone info, it + is assumed to be UTC. + :type expiry: datetime or str + :param start: + The time at which the shared access signature becomes valid. If + omitted, start time for this call is assumed to be the time when the + storage service receives the request. Azure will always convert values + to UTC. If a date is passed in without timezone info, it is assumed to + be UTC. + :type start: datetime or str + :param str ip_address_or_range: + Specifies an IP address or a range of IP addresses from which to accept requests. + If the IP address from which the request originates does not match the IP address + or address range specified on the SAS token, the request is not authenticated. + For example, specifying sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70 on the SAS + restricts the request to those IP addresses. + :param Union[str, SASProtocol] protocol: + Specifies the protocol permitted for a request made. The default value + is https,http. See :class:`~azure.cosmosdb.table.common.models.Protocol` for possible values. + ''' + sas = _SharedAccessHelper() + sas.add_base(permission, expiry, start, ip_address_or_range, protocol, self.x_ms_version) + sas.add_account(services, resource_types) + sas.add_account_signature(self.account_name, self.account_key) + + return sas.get_token() + + +class QueryStringConstants(object): + SIGNED_SIGNATURE = 'sig' + SIGNED_PERMISSION = 'sp' + SIGNED_START = 'st' + SIGNED_EXPIRY = 'se' + SIGNED_RESOURCE = 'sr' + SIGNED_IDENTIFIER = 'si' + SIGNED_IP = 'sip' + SIGNED_PROTOCOL = 'spr' + SIGNED_VERSION = 'sv' + SIGNED_CACHE_CONTROL = 'rscc' + SIGNED_CONTENT_DISPOSITION = 'rscd' + SIGNED_CONTENT_ENCODING = 'rsce' + SIGNED_CONTENT_LANGUAGE = 'rscl' + SIGNED_CONTENT_TYPE = 'rsct' + START_PK = 'spk' + START_RK = 'srk' + END_PK = 'epk' + END_RK = 'erk' + SIGNED_RESOURCE_TYPES = 'srt' + SIGNED_SERVICES = 'ss' + TABLE_NAME = 'tn' + + @staticmethod + def to_list(): + return [ + QueryStringConstants.SIGNED_SIGNATURE, + QueryStringConstants.SIGNED_PERMISSION, + QueryStringConstants.SIGNED_START, + QueryStringConstants.SIGNED_EXPIRY, + QueryStringConstants.SIGNED_RESOURCE, + QueryStringConstants.SIGNED_IDENTIFIER, + QueryStringConstants.SIGNED_IP, + QueryStringConstants.SIGNED_PROTOCOL, + QueryStringConstants.SIGNED_VERSION, + QueryStringConstants.SIGNED_CACHE_CONTROL, + QueryStringConstants.SIGNED_CONTENT_DISPOSITION, + QueryStringConstants.SIGNED_CONTENT_ENCODING, + QueryStringConstants.SIGNED_CONTENT_LANGUAGE, + QueryStringConstants.SIGNED_CONTENT_TYPE, + QueryStringConstants.START_PK, + QueryStringConstants.START_RK, + QueryStringConstants.END_PK, + QueryStringConstants.END_RK, + QueryStringConstants.SIGNED_RESOURCE_TYPES, + QueryStringConstants.SIGNED_SERVICES, + QueryStringConstants.TABLE_NAME + ] + + +class _SharedAccessHelper(object): + def __init__(self): + self.query_dict = {} + + def _add_query(self, name, val): + if val: + self.query_dict[name] = _to_str(val) + + def add_base(self, permission, expiry, start, ip, protocol, x_ms_version): + if isinstance(start, date): + start = _to_utc_datetime(start) + + if isinstance(expiry, date): + expiry = _to_utc_datetime(expiry) + + self._add_query(QueryStringConstants.SIGNED_START, start) + self._add_query(QueryStringConstants.SIGNED_EXPIRY, expiry) + self._add_query(QueryStringConstants.SIGNED_PERMISSION, permission) + self._add_query(QueryStringConstants.SIGNED_IP, ip) + self._add_query(QueryStringConstants.SIGNED_PROTOCOL, protocol) + self._add_query(QueryStringConstants.SIGNED_VERSION, x_ms_version) + + def add_resource(self, resource): + self._add_query(QueryStringConstants.SIGNED_RESOURCE, resource) + + def add_id(self, id): # pylint:disable=W0622 + self._add_query(QueryStringConstants.SIGNED_IDENTIFIER, id) + + def add_account(self, services, resource_types): + self._add_query(QueryStringConstants.SIGNED_SERVICES, services) + self._add_query(QueryStringConstants.SIGNED_RESOURCE_TYPES, resource_types) + + def add_override_response_headers(self, cache_control, + content_disposition, + content_encoding, + content_language, + content_type): + self._add_query(QueryStringConstants.SIGNED_CACHE_CONTROL, cache_control) + self._add_query(QueryStringConstants.SIGNED_CONTENT_DISPOSITION, content_disposition) + self._add_query(QueryStringConstants.SIGNED_CONTENT_ENCODING, content_encoding) + self._add_query(QueryStringConstants.SIGNED_CONTENT_LANGUAGE, content_language) + self._add_query(QueryStringConstants.SIGNED_CONTENT_TYPE, content_type) + + def add_resource_signature(self, account_name, account_key, service, path): + def get_value_to_append(query): + return_value = self.query_dict.get(query) or '' + return return_value + '\n' + + if path[0] != '/': + path = '/' + path + + canonicalized_resource = '/' + service + '/' + account_name + path + '\n' + + # Form the string to sign from shared_access_policy and canonicalized + # resource. The order of values is important. + string_to_sign = \ + (get_value_to_append(QueryStringConstants.SIGNED_PERMISSION) + + get_value_to_append(QueryStringConstants.SIGNED_START) + + get_value_to_append(QueryStringConstants.SIGNED_EXPIRY) + + canonicalized_resource + + get_value_to_append(QueryStringConstants.SIGNED_IDENTIFIER) + + get_value_to_append(QueryStringConstants.SIGNED_IP) + + get_value_to_append(QueryStringConstants.SIGNED_PROTOCOL) + + get_value_to_append(QueryStringConstants.SIGNED_VERSION)) + + if service == 'blob' or service == 'file': # pylint:disable=R1714 + string_to_sign += \ + (get_value_to_append(QueryStringConstants.SIGNED_CACHE_CONTROL) + + get_value_to_append(QueryStringConstants.SIGNED_CONTENT_DISPOSITION) + + get_value_to_append(QueryStringConstants.SIGNED_CONTENT_ENCODING) + + get_value_to_append(QueryStringConstants.SIGNED_CONTENT_LANGUAGE) + + get_value_to_append(QueryStringConstants.SIGNED_CONTENT_TYPE)) + + # remove the trailing newline + if string_to_sign[-1] == '\n': + string_to_sign = string_to_sign[:-1] + + self._add_query(QueryStringConstants.SIGNED_SIGNATURE, + _sign_string(account_key, string_to_sign)) + + def add_account_signature(self, account_name, account_key): + def get_value_to_append(query): + return_value = self.query_dict.get(query) or '' + return return_value + '\n' + + string_to_sign = \ + (account_name + '\n' + + get_value_to_append(QueryStringConstants.SIGNED_PERMISSION) + + get_value_to_append(QueryStringConstants.SIGNED_SERVICES) + + get_value_to_append(QueryStringConstants.SIGNED_RESOURCE_TYPES) + + get_value_to_append(QueryStringConstants.SIGNED_START) + + get_value_to_append(QueryStringConstants.SIGNED_EXPIRY) + + get_value_to_append(QueryStringConstants.SIGNED_IP) + + get_value_to_append(QueryStringConstants.SIGNED_PROTOCOL) + + get_value_to_append(QueryStringConstants.SIGNED_VERSION)) + + self._add_query(QueryStringConstants.SIGNED_SIGNATURE, + _sign_string(account_key, string_to_sign)) + + def get_token(self): + return '&'.join(['{0}={1}'.format(n, url_quote(v)) for n, v in self.query_dict.items() if v is not None]) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared/table_shared_access_signature.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared/table_shared_access_signature.py new file mode 100644 index 000000000000..02e392faf8c3 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared/table_shared_access_signature.py @@ -0,0 +1,298 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from typing import Union + +from azure.data.tables._shared.models import AccountSasPermissions +from azure.data.tables._models import TableServices +from azure.data.tables._shared._common_conversion import _sign_string +from azure.data.tables._shared._error import _validate_not_none +from azure.data.tables._shared.constants import X_MS_VERSION +from azure.data.tables._shared.shared_access_signature import _SharedAccessHelper,\ + SharedAccessSignature, QueryStringConstants + + +def generate_account_sas( + account_name, # type:str + account_key, # type:str + resource_types, # type:ResourceTypes + permission, # type:Union[str,AccountSasPermissions] + expiry, # type:Union[datetime,str] + **kwargs # type:Any +): + # type: (...) -> str + """ + Generates a shared access signature for the table service. + Use the returned signature with the sas_token parameter of TableService. + + :param account_name: Account name + :type account_name:str + :param account_key: Account key + :type account_key:str + :param resource_types: + Specifies the resource types that are accessible with the account SAS. + :type resource_types: ResourceTypes + :param permission: + The permissions associated with the shared access signature. The + user is restricted to operations allowed by the permissions. + Required unless an id is given referencing a stored access policy + which contains this field. This field must be omitted if it has been + specified in an associated stored access policy. + :type permission: Union[str, AccountSasPermissions] + :param expiry: + The time at which the shared access signature becomes invalid. + Required unless an id is given referencing a stored access policy + which contains this field. This field must be omitted if it has + been specified in an associated stored access policy. Azure will always + convert values to UTC. If a date is passed in without timezone info, it + is assumed to be UTC. + :type expiry: Union[datetime,str] + :keyword Union[datetime,str] start: + The time at which the shared access signature becomes valid. If + omitted, start time for this call is assumed to be the time when the + storage service receives the request. Azure will always convert values + to UTC. If a date is passed in without timezone info, it is assumed to + be UTC. + :keyword str ip_address_or_range: + Specifies an IP address or a range of IP addresses from which to accept requests. + If the IP address from which the request originates does not match the IP address + or address range specified on the SAS token, the request is not authenticated. + For example, specifying sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70 on the SAS + restricts the request to those IP addresses. + :keyword Union[str, SASProtocol] protocol: + Specifies the protocol permitted for a request made. + :return: A Shared Access Signature (sas) token. + :rtype: str + """ + _validate_not_none('account_name', account_name) + _validate_not_none('account_key', account_key) + if permission is str: + permission = AccountSasPermissions.from_string(permission=permission) + sas = TableSharedAccessSignature(account_name, account_key) + return sas.generate_account(TableServices(), resource_types, permission, + expiry, start=kwargs.pop('start', None), + ip_address_or_range=kwargs.pop('ip_address_or_range', None), + protocol=kwargs.pop('protocol', None)) + + +def generate_table_sas( + account_name, # type: str + account_key, # type: str + table_name, # type: str + **kwargs # type: Any +): # type: (...) -> str + + """ + Generates a shared access signature for the table service. + Use the returned signature with the sas_token parameter of TableService. + + + :param account_key: Account key + :type account_key: str + :param account_name: Account name + :type account_name: str + :param table_name: Table name + :type table_name: str + :keyword TableSasPermissions permission: + The permissions associated with the shared access signature. The + user is restricted to operations allowed by the permissions. + Required unless an id is given referencing a stored access policy + which contains this field. This field must be omitted if it has been + specified in an associated stored access policy. + :keyword Union[datetime,str] expiry: + The time at which the shared access signature becomes invalid. + Required unless an id is given referencing a stored access policy + which contains this field. This field must be omitted if it has + been specified in an associated stored access policy. Azure will always + convert values to UTC. If a date is passed in without timezone info, it + is assumed to be UTC. + :keyword Union[datetime,str] start: + The time at which the shared access signature becomes valid. If + omitted, start time for this call is assumed to be the time when the + storage service receives the request. Azure will always convert values + to UTC. If a date is passed in without timezone info, it is assumed to + be UTC. + :keyword str ip_address_or_range: + Specifies an IP address or a range of IP addresses from which to accept requests. + If the IP address from which the request originates does not match the IP address + or address range specified on the SAS token, the request is not authenticated. + For example, specifying sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70 on the SAS + restricts the request to those IP addresses. + :keyword str policy_id: Access policy ID. + :keyword Union[str, SASProtocol] protocol: + Specifies the protocol permitted for a request made. + :keyword str end_rk: End row key + :keyword str end_pk: End partition key + :keyword str start_rk: Starting row key + :keyword str start_pk: Starting partition key + :return: A Shared Access Signature (sas) token. + :rtype: str + """ + + sas = TableSharedAccessSignature(account_name, account_key) + return sas.generate_table( + table_name=table_name, + permission=kwargs.pop('permission', None), + expiry=kwargs.pop('expiry', None), + start=kwargs.pop('start', None), + policy_id=kwargs.pop('policy_id', None), + ip=kwargs.pop('ip_address_or_range', None), + protocol=kwargs.pop('protocol', None), + start_pk=kwargs.pop('start_pk', None), + start_rk=kwargs.pop('start_rk', None), + end_pk=kwargs.pop('end_pk', None), + end_rk=kwargs.pop('end_rk', None), + **kwargs + ) # type: ignore + + +class TableSharedAccessSignature(SharedAccessSignature): + """ + Provides a factory for creating file and share access + signature tokens with a common account name and account key. Users can either + use the factory or can construct the appropriate service and use the + generate_*_shared_access_signature method directly. + """ + + def __init__(self, account_name, account_key): + """ + :param account_name: + The storage account name used to generate the shared access signatures. + :type account_name: str + :param account_key: + The access key to generate the shares access signatures. + :type account_key: str + """ + super(TableSharedAccessSignature, self).__init__(account_name, account_key, x_ms_version=X_MS_VERSION) + + def generate_table(self, table_name, permission=None, # pylint: disable = W0613 + expiry=None, start=None, policy_id=None, + ip_address_or_range=None, protocol=None, + start_pk=None, start_rk=None, + end_pk=None, end_rk=None, **kwargs): + """ + Generates a shared access signature for the table. + Use the returned signature with the sas_token parameter of TableService. + + :param str table_name: + Name of table. + :param TablePermissions permission: + The permissions associated with the shared access signature. The + user is restricted to operations allowed by the permissions. + Required unless an id is given referencing a stored access policy + which contains this field. This field must be omitted if it has been + specified in an associated stored access policy. + :param expiry: + The time at which the shared access signature becomes invalid. + Required unless an id is given referencing a stored access policy + which contains this field. This field must be omitted if it has + been specified in an associated stored access policy. Azure will always + convert values to UTC. If a date is passed in without timezone info, it + is assumed to be UTC. + :type expiry: datetime or str + :param start: + The time at which the shared access signature becomes valid. If + omitted, start time for this call is assumed to be the time when the + storage service receives the request. Azure will always convert values + to UTC. If a date is passed in without timezone info, it is assumed to + be UTC. + :type start: datetime or str + :param str policy_id: + A unique value up to 64 characters in length that correlates to a + stored access policy. To create a stored access policy, use + set_table_service_properties. + :param str ip_address_or_range: + Specifies an IP address or a range of IP addresses from which to accept requests. + If the IP address from which the request originates does not match the IP address + or address range specified on the SAS token, the request is not authenticated. + For example, specifying sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70 on the SAS + restricts the request to those IP addresses. + :param str protocol: + Specifies the protocol permitted for a request made. The default value + is https,http. See :class:`~azure.cosmosdb.table.common.models.Protocol` for possible values. + :param str start_pk: + The minimum partition key accessible with this shared access + signature. startpk must accompany startrk. Key values are inclusive. + If omitted, there is no lower bound on the table entities that can + be accessed. + :param str start_rk: + The minimum row key accessible with this shared access signature. + startpk must accompany startrk. Key values are inclusive. If + omitted, there is no lower bound on the table entities that can be + accessed. + :param str end_pk: + The maximum partition key accessible with this shared access + signature. endpk must accompany endrk. Key values are inclusive. If + omitted, there is no upper bound on the table entities that can be + accessed. + :param str end_rk: + The maximum row key accessible with this shared access signature. + endpk must accompany endrk. Key values are inclusive. If omitted, + there is no upper bound on the table entities that can be accessed. + """ + sas = _TableSharedAccessHelper() + sas.add_base(permission, expiry, start, ip_address_or_range, protocol, X_MS_VERSION) + sas.add_id(policy_id) + sas.add_table_access_ranges(table_name, start_pk, start_rk, end_pk, end_rk) + + # Table names must be signed lower case + resource_path = table_name.lower() + sas.add_resource_signature(self.account_name, self.account_key, 'table', resource_path) + + return sas.get_token() + + +class _TableQueryStringConstants(QueryStringConstants): + TABLE_NAME = 'tn' + + +class _TableSharedAccessHelper(_SharedAccessHelper): + + def __init__(self): + super().__init__() + self.query_dict = {} + + def add_table_access_ranges(self, table_name, start_pk, start_rk, + end_pk, end_rk): + self._add_query(_TableQueryStringConstants.TABLE_NAME, table_name) + self._add_query(_TableQueryStringConstants.START_PK, start_pk) + self._add_query(_TableQueryStringConstants.START_RK, start_rk) + self._add_query(_TableQueryStringConstants.END_PK, end_pk) + self._add_query(_TableQueryStringConstants.END_RK, end_rk) + + def add_resource_signature(self, account_name, account_key, service, path): + def get_value_to_append(query): + return_value = self.query_dict.get(query) or '' + return return_value + '\n' + + if path[0] != '/': + path = '/' + path + + canonicalized_resource = '/' + service + '/' + account_name + path + '\n' + + # Form the string to sign from shared_access_policy and canonicalized + # resource. The order of values is important. + string_to_sign = \ + (get_value_to_append(QueryStringConstants.SIGNED_PERMISSION) + + get_value_to_append(QueryStringConstants.SIGNED_START) + + get_value_to_append(QueryStringConstants.SIGNED_EXPIRY) + + canonicalized_resource + + get_value_to_append(QueryStringConstants.SIGNED_IDENTIFIER) + + get_value_to_append(QueryStringConstants.SIGNED_IP) + + get_value_to_append(QueryStringConstants.SIGNED_PROTOCOL) + + get_value_to_append(QueryStringConstants.SIGNED_VERSION)) + + string_to_sign += \ + (get_value_to_append(QueryStringConstants.START_PK) + + get_value_to_append(QueryStringConstants.START_RK) + + get_value_to_append(QueryStringConstants.END_PK) + + get_value_to_append(QueryStringConstants.END_RK)) + + # remove the trailing newline + if string_to_sign[-1] == '\n': + string_to_sign = string_to_sign[:-1] + + self._add_query(QueryStringConstants.SIGNED_SIGNATURE, + _sign_string(account_key, string_to_sign)) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py new file mode 100644 index 000000000000..ff0918cfd051 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py @@ -0,0 +1,471 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import functools +from typing import Optional, Any, Union # pylint: disable = W0611 + +try: + from urllib.parse import urlparse, unquote +except ImportError: + from urlparse import urlparse # type: ignore + from urllib2 import unquote # type: ignore + +from azure.core.paging import ItemPaged +from azure.core.exceptions import HttpResponseError, ResourceNotFoundError +from azure.core.tracing.decorator import distributed_trace +from ._deserialize import _convert_to_entity +from ._entity import TableEntity +from ._generated import AzureTable +from ._generated.models import AccessPolicy, SignedIdentifier, TableProperties, QueryOptions +from ._serialize import _get_match_headers, _add_entity_properties +from ._shared.base_client import parse_connection_str +from ._shared._table_client_base import TableClientBase + +from ._shared.request_handlers import serialize_iso +from ._shared.response_handlers import process_table_error + +from ._version import VERSION + +from ._models import TableEntityPropertiesPaged, UpdateMode, Table + +from ._shared.response_handlers import return_headers_and_deserialized + + +class TableClient(TableClientBase): + """ :ivar str account_name: Name of the storage account (Cosmos or Azure)""" + + def __init__( + self, account_url, # type: str + table_name, # type: str + credential=None, # type: Union[str,TokenCredential] + **kwargs # type: Any + ): + # type: (...) -> None + """Create TableClient from a Credential. + + :param account_url: + A url to an Azure Storage account. + :type account_url: str + :param table_name: The table name. + :type table_name: str + :param credential: + The credentials with which to authenticate. This is optional if the + account URL already has a SAS token, or the connection string already has shared + access key values. The value can be a SAS token string, an account shared access + key, or an instance of a TokenCredentials class from azure.identity. + :type credential: Union[str,TokenCredential] + + :returns: None + """ + super(TableClient, self).__init__(account_url, table_name, credential=credential, **kwargs) + self._client = AzureTable(self.url, pipeline=self._pipeline) + self._client._config.version = kwargs.get('api_version', VERSION) # pylint: disable=protected-access + + @classmethod + def from_connection_string( + cls, conn_str, # type: str + table_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> TableClient + """Create TableClient from a Connection String. + + :param conn_str: + A connection string to an Azure Storage or Cosmos account. + :type conn_str: str + :param table_name: The table name. + :type table_name: str + :returns: A table client. + :rtype: ~azure.data.tables.TableClient + """ + account_url, secondary, credential = parse_connection_str( + conn_str=conn_str, credential=None, service='table') + if 'secondary_hostname' not in kwargs: + kwargs['secondary_hostname'] = secondary + return cls(account_url, table_name=table_name, credential=credential, **kwargs) # type: ignore + + @classmethod + def from_table_url(cls, table_url, credential=None, **kwargs): + # type: (str, Optional[Any], Any) -> TableClient + """A client to interact with a specific Table. + + :param table_url: The full URI to the table, including SAS token if used. + :type table_url: str + :param credential: + The credentials with which to authenticate. This is optional if the + account URL already has a SAS token. The value can be a SAS token string, an account + shared access key. + :type credential: str + :returns: A table client. + :rtype: ~azure.data.tables.TableClient + """ + try: + if not table_url.lower().startswith('http'): + table_url = "https://" + table_url + except AttributeError: + raise ValueError("Table URL must be a string.") + parsed_url = urlparse(table_url.rstrip('/')) + + if not parsed_url.netloc: + raise ValueError("Invalid URL: {}".format(table_url)) + + table_path = parsed_url.path.lstrip('/').split('/') + account_path = "" + if len(table_path) > 1: + account_path = "/" + "/".join(table_path[:-1]) + account_url = "{}://{}{}?{}".format( + parsed_url.scheme, + parsed_url.netloc.rstrip('/'), + account_path, + parsed_url.query) + table_name = unquote(table_path[-1]) + if not table_name: + raise ValueError("Invalid URL. Please provide a URL with a valid table name") + return cls(account_url, table_name=table_name, credential=credential, **kwargs) + + @distributed_trace + def get_table_access_policy( + self, + **kwargs # type: Any + ): + # type: (...) -> dict[str,AccessPolicy] + """Retrieves details about any stored access policies specified on the table that may be + used with Shared Access Signatures. + + :return: Dictionary of SignedIdentifiers + :rtype: dict[str,AccessPolicy] + :raises: ~azure.core.exceptions.HttpResponseError + """ + timeout = kwargs.pop('timeout', None) + try: + _, identifiers = self._client.table.get_access_policy( + table=self.table_name, + timeout=timeout, + cls=return_headers_and_deserialized, + **kwargs) + except HttpResponseError as error: + process_table_error(error) + return {s.id: s.access_policy or AccessPolicy() for s in identifiers} # pylint: disable=E1125 + + @distributed_trace + def set_table_access_policy( + self, + signed_identifiers, # type: dict[str,AccessPolicy] + **kwargs): + # type: (...) -> None + """Sets stored access policies for the table that may be used with Shared Access Signatures. + + :param signed_identifiers: + :type signed_identifiers: dict[str,AccessPolicy] + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + self._validate_signed_identifiers(signed_identifiers) + identifiers = [] + for key, value in signed_identifiers.items(): + if value: + value.start = serialize_iso(value.start) + value.expiry = serialize_iso(value.expiry) + identifiers.append(SignedIdentifier(id=key, access_policy=value)) + signed_identifiers = identifiers # type: ignore + try: + self._client.table.set_access_policy( + table=self.table_name, + table_acl=signed_identifiers or None, + **kwargs) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace + def create_table( + self, + **kwargs # type: Any + ): + # type: (...) -> Table + """Creates a new table under the current account. + + :return: Table created + :rtype: Table + :raises: ~azure.core.exceptions.HttpResponseError + """ + table_properties = TableProperties(table_name=self.table_name, **kwargs) + try: + table = self._client.table.create(table_properties) + return Table(table=table) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace + def delete_table( + self, + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the table under the current account. + + :return: None + :rtype: None + """ + try: + self._client.table.delete(table=self.table_name, **kwargs) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace + def delete_entity( + self, + partition_key, # type: str + row_key, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the specified entity in a table. + + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :keyword str etag: Etag of the entity + :keyword ~azure.core.MatchConditions match_condition: MatchCondition + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + + if_match, if_not_match = _get_match_headers(kwargs=dict(kwargs, etag=kwargs.pop('etag', None), + match_condition=kwargs.pop('match_condition', None)), + etag_param='etag', match_param='match_condition') + try: + self._client.table.delete_entity( + table=self.table_name, + partition_key=partition_key, + row_key=row_key, + if_match=if_match or if_not_match or '*', + **kwargs) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace + def create_entity( + self, + entity, # type: Union[TableEntity, dict[str,str]] + **kwargs # type: Any + ): + # type: (...) -> TableEntity + """Insert entity in a table. + + :param entity: The properties for the table entity. + :type entity: Union[TableEntity, dict[str,str]] + :return: TableEntity mapping str to azure.data.tables.EntityProperty + :rtype: ~azure.data.tables.TableEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + + if "PartitionKey" in entity and "RowKey" in entity: + entity = _add_entity_properties(entity) + # TODO: Remove - and run test to see what happens with the service + else: + raise ValueError('PartitionKey and RowKey were not provided in entity') + try: + inserted_entity = self._client.table.insert_entity( + table=self.table_name, + table_entity_properties=entity, + **kwargs + ) + properties = _convert_to_entity(inserted_entity) + return properties + except ResourceNotFoundError as error: + process_table_error(error) + + @distributed_trace + def update_entity( # pylint:disable=R1710 + self, + entity, # type: Union[TableEntity, dict[str,str]] + mode=UpdateMode.MERGE, # type: UpdateMode + **kwargs # type: Any + ): + # type: (...) -> None + """Update entity in a table. + + :param entity: The properties for the table entity. + :type entity: Union[TableEntity, dict[str,str]] + :param mode: Merge or Replace entity + :type mode: ~azure.data.tables.UpdateMode + :keyword str partition_key: The partition key of the entity. + :keyword str row_key: The row key of the entity. + :keyword str etag: Etag of the entity + :keyword ~azure.core.MatchConditions match_condition: MatchCondition + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + + if_match, if_not_match = _get_match_headers(kwargs=dict(kwargs, etag=kwargs.pop('etag', None), + match_condition=kwargs.pop('match_condition', None)), + etag_param='etag', match_param='match_condition') + + partition_key = entity['PartitionKey'] + row_key = entity['RowKey'] + entity = _add_entity_properties(entity) + try: + if mode is UpdateMode.REPLACE: + self._client.table.update_entity( + table=self.table_name, + partition_key=partition_key, + row_key=row_key, + table_entity_properties=entity, + if_match=if_match or if_not_match or "*", + **kwargs) + elif mode is UpdateMode.MERGE: + self._client.table.merge_entity(table=self.table_name, partition_key=partition_key, + row_key=row_key, if_match=if_match or if_not_match or "*", + table_entity_properties=entity, **kwargs) + else: + raise ValueError('Mode type is not supported') + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace + def list_entities( + self, + **kwargs # type: Any + ): + # type: (...) -> ItemPaged[TableEntity] + """Lists entities in a table. + + :keyword int results_per_page: Number of entities per page in return ItemPaged + :keyword Union[str, list(str)] select: Specify desired properties of an entity to return certain entities + :return: Query of table entities + :rtype: ItemPaged[TableEntity] + :raises: ~azure.core.exceptions.HttpResponseError + """ + user_select = kwargs.pop('select', None) + if user_select and not isinstance(user_select, str): + user_select = ", ".join(user_select) + + query_options = QueryOptions(top=kwargs.pop('results_per_page', None), select=user_select) + + command = functools.partial( + self._client.table.query_entities, + **kwargs) + return ItemPaged( + command, results_per_page=query_options, table=self.table_name, + page_iterator_class=TableEntityPropertiesPaged + ) + + @distributed_trace + def query_entities( + self, + filter, # type: str # pylint: disable = W0622 + **kwargs + ): + # type: (...) -> ItemPaged[TableEntity] + """Lists entities in a table. + + :param str filter: Specify a filter to return certain entities + :keyword int results_per_page: Number of entities per page in return ItemPaged + :keyword Union[str, list[str]] select: Specify desired properties of an entity to return certain entities + :keyword dict parameters: Dictionary for formatting query with additional, user defined parameters + :return: Query of table entities + :rtype: ItemPaged[TableEntity] + :raises: ~azure.core.exceptions.HttpResponseError + """ + parameters = kwargs.pop('parameters', None) + filter = self._parameter_filter_substitution(parameters, filter) # pylint: disable = W0622 + + user_select = kwargs.pop('select', None) + if user_select and not isinstance(user_select, str): + user_select = ", ".join(user_select) + + query_options = QueryOptions(top=kwargs.pop('results_per_page', None), select=user_select, + filter=filter) + + command = functools.partial( + self._client.table.query_entities, + query_options=query_options, + **kwargs) + return ItemPaged( + command, table=self.table_name, + page_iterator_class=TableEntityPropertiesPaged + ) + + @distributed_trace + def get_entity( + self, + partition_key, # type: str + row_key, # type: str + **kwargs # type: Any + ): + # type: (...) -> TableEntity + """Queries entities in a table. + + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :return: Entity mapping str to azure.data.tables.EntityProperty + :rtype: ~azure.data.tables.TableEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + try: + entity = self._client.table.query_entities_with_partition_and_row_key(table=self.table_name, + partition_key=partition_key, + row_key=row_key, + **kwargs) + properties = _convert_to_entity(entity.additional_properties) + return properties + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace + def upsert_entity( # pylint:disable=R1710 + self, + entity, # type: Union[TableEntity, dict[str,str]] + mode=UpdateMode.MERGE, # type: UpdateMode + **kwargs # type: Any + ): + # type: (...) -> None + """Update/Merge or Insert entity into table. + + :param entity: The properties for the table entity. + :type entity: Union[TableEntity, dict[str,str]] + :param mode: Merge or Replace and Insert on fail + :type mode: ~azure.data.tables.UpdateMode + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + + partition_key = entity['PartitionKey'] + row_key = entity['RowKey'] + entity = _add_entity_properties(entity) + + try: + if mode is UpdateMode.MERGE: + self._client.table.merge_entity( + table=self.table_name, + partition_key=partition_key, + row_key=row_key, + table_entity_properties=entity, + **kwargs + ) + elif mode is UpdateMode.REPLACE: + self._client.table.update_entity( + table=self.table_name, + partition_key=partition_key, + row_key=row_key, + table_entity_properties=entity, + **kwargs) + else: + raise ValueError('Mode type is not supported') + except ResourceNotFoundError: + self.create_entity( + partition_key=partition_key, + row_key=row_key, + table_entity_properties=entity, + **kwargs + ) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py new file mode 100644 index 000000000000..ce9e97c88a88 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py @@ -0,0 +1,264 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import functools +from typing import Any, Union +from azure.core.exceptions import HttpResponseError +from azure.core.paging import ItemPaged +from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline import Pipeline +from ._models import Table + +from ._generated import AzureTable +from ._generated.models import TableProperties, TableServiceProperties, QueryOptions +from ._models import TablePropertiesPaged, service_stats_deserialize, service_properties_deserialize +from ._shared.base_client import parse_connection_str, TransportWrapper +from ._shared.models import LocationMode +from ._shared.response_handlers import process_table_error +from ._version import VERSION + +from ._table_client import TableClient +from ._shared._table_service_client_base import TableServiceClientBase + + +class TableServiceClient(TableServiceClientBase): + """ :ivar str account_name: Name of the storage account (Cosmos or Azure)""" + def __init__( + self, account_url, # type: str + credential=None, # type: Union[str,TokenCredential] + **kwargs # type: Any + ): + # type: (...) -> None + """Create TableServiceClient from a Credential. + + :param account_url: + A url to an Azure Storage account. + :type account_url: str + :param credential: + The credentials with which to authenticate. This is optional if the + account URL already has a SAS token, or the connection string already has shared + access key values. The value can be a SAS token string, an account shared access + key. + :type credential: str + :returns: None + """ + + super(TableServiceClient, self).__init__(account_url, service='table', credential=credential, **kwargs) + self._client = AzureTable(self.url, pipeline=self._pipeline) + self._client._config.version = kwargs.get('api_version', VERSION) # pylint: disable=protected-access + + @classmethod + def from_connection_string( + cls, conn_str, # type: str + **kwargs # type: Any + ): # type: (...) -> TableServiceClient + """Create TableServiceClient from a Connection String. + + :param conn_str: + A connection string to an Azure Storage or Cosmos account. + :type conn_str: str + :returns: A Table service client. + :rtype: ~azure.data.tables.TableServiceClient + """ + account_url, secondary, credential = parse_connection_str( + conn_str=conn_str, credential=None, service='table') + if 'secondary_hostname' not in kwargs: + kwargs['secondary_hostname'] = secondary + return cls(account_url, credential=credential, **kwargs) + + @distributed_trace + def get_service_stats(self, **kwargs): + # type: (...) -> dict[str,object] + """Retrieves statistics related to replication for the Table service. It is only available on the secondary + location endpoint when read-access geo-redundant replication is enabled for the account. + + :return: Dictionary of Service Stats + :rtype:dict[str, object] + :raises: ~azure.core.exceptions.HttpResponseError + """ + try: + timeout = kwargs.pop('timeout', None) + stats = self._client.service.get_statistics( # type: ignore + timeout=timeout, use_location=LocationMode.SECONDARY, **kwargs) + return service_stats_deserialize(stats) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace + def get_service_properties(self, **kwargs): + # type: (...) -> dict[str,Any] + """Gets the properties of an account's Table service, + including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :return: Dictionary of service properties + :rtype:dict[str, Any] + :raises: ~azure.core.exceptions.HttpResponseError + """ + timeout = kwargs.pop('timeout', None) + try: + service_props = self._client.service.get_properties(timeout=timeout, **kwargs) # type: ignore + return service_properties_deserialize(service_props) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace + def set_service_properties( + self, + analytics_logging=None, # type: Optional[TableAnalyticsLogging] + hour_metrics=None, # type: Optional[Metrics] + minute_metrics=None, # type: Optional[Metrics] + cors=None, # type: Optional[CorsRule] + **kwargs # type: Any + ): + # type: (...) -> None + """Sets properties for an account's Table service endpoint, + including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param analytics_logging: Properties for analytics + :type analytics_logging: ~azure.data.tables.TableAnalyticsLogging + :param hour_metrics: Hour level metrics + :type hour_metrics: ~azure.data.tables.Metrics + :param minute_metrics: Minute level metrics + :type minute_metrics: ~azure.data.tables.Metrics + :param cors: Cross-origin resource sharing rules + :type cors: ~azure.data.tables.CorsRule + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + props = TableServiceProperties( + logging=analytics_logging, + hour_metrics=hour_metrics, + minute_metrics=minute_metrics, + cors=cors + ) + try: + return self._client.service.set_properties(props, **kwargs) # type: ignore + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace + def create_table( + self, + table_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> TableClient + """Creates a new table under the current account. + + :param table_name: The Table name. + :type table_name: str + :return: TableClient + :rtype: ~azure.data.tables.TableClient + :raises: ~azure.core.exceptions.HttpResponseError + """ + table = self.get_table_client(table_name=table_name) + table.create_table(**kwargs) + return table + + @distributed_trace + def delete_table( + self, + table_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the table under the current account + + :param table_name: The Table name. + :type table_name: str + :return: None + :rtype: None + """ + table = self.get_table_client(table_name=table_name) + table.delete_table(**kwargs) + + @distributed_trace + def query_tables( + self, + filter, # pylint: disable=W0622 + **kwargs # type: Any + ): + # type: (...) -> ItemPaged[Table] + """Queries tables under the given account. + :param filter: Specify a filter to return certain tables + :type filter: str + :keyword int results_per_page: Number of tables per page in return ItemPaged + :keyword Union[str, list(str)] select: Specify desired properties of a table to return certain tables + :keyword dict parameters: Dictionary for formatting query with additional, user defined parameters + :return: A query of tables + :rtype: ItemPaged[Table] + :raises: ~azure.core.exceptions.HttpResponseError + """ + parameters = kwargs.pop('parameters', None) + filter = self._parameter_filter_substitution(parameters, filter) # pylint: disable=W0622 + + user_select = kwargs.pop('select', None) + if user_select and not isinstance(user_select, str): + user_select = ", ".join(user_select) + + query_options = QueryOptions(top=kwargs.pop('results_per_page', None), select=user_select, + filter=filter) + command = functools.partial(self._client.table.query, query_options=query_options, + **kwargs) + return ItemPaged( + command, + page_iterator_class=TablePropertiesPaged + ) + + @distributed_trace + def list_tables( + self, + **kwargs # type: Any + ): + # type: (...) -> ItemPaged[Table] + """Queries tables under the given account. + + :keyword int results_per_page: Number of tables per page in return ItemPaged + :keyword Union[str, list(str)] select: Specify desired properties of a table to return certain tables + :return: A query of tables + :rtype: ItemPaged[Table] + :raises: ~azure.core.exceptions.HttpResponseError + """ + user_select = kwargs.pop('select', None) + if user_select and not isinstance(user_select, str): + user_select = ", ".join(user_select) + + query_options = QueryOptions(top=kwargs.pop('results_per_page', None), select=user_select) + + command = functools.partial( + self._client.table.query, + query_options=query_options, + **kwargs) + return ItemPaged( + command, + page_iterator_class=TablePropertiesPaged + ) + + def get_table_client(self, table_name, **kwargs): + # type: (Union[TableProperties, str], Optional[Any]) -> TableClient + """Get a client to interact with the specified table. + + The table need not already exist. + + :param table_name: + The table name + :type table_name: str + :returns: A :class:`~azure.data.tables.TableClient` object. + :rtype: ~azure.data.tables.TableClient + + """ + + _pipeline = Pipeline( + transport=TransportWrapper(self._pipeline._transport), # pylint: disable = protected-access + policies=self._pipeline._impl_policies # pylint: disable = protected-access + ) + + return TableClient( + self.url, table_name=table_name, credential=self.credential, + key_resolver_function=self.key_resolver_function, require_encryption=self.require_encryption, + key_encryption_key=self.key_encryption_key, api_version=self.api_version, _pipeline=_pipeline, + _configuration=self._config, _location_mode=self._location_mode, _hosts=self._hosts, **kwargs) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_version.py b/sdk/tables/azure-data-tables/azure/data/tables/_version.py new file mode 100644 index 000000000000..71af5012673a --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_version.py @@ -0,0 +1,7 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +VERSION = '12.0.0b1' diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/__init__.py new file mode 100644 index 000000000000..5ff784b46591 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/__init__.py @@ -0,0 +1,13 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from azure.data.tables.aio._table_client_async import TableClient +from azure.data.tables.aio._table_service_client_async import TableServiceClient + +__all__ = [ + 'TableClient', + 'TableServiceClient', +] diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py new file mode 100644 index 000000000000..d41bfa187b06 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py @@ -0,0 +1,104 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from azure.data.tables._models import Table +from azure.data.tables._deserialize import _convert_to_entity +from azure.data.tables._shared.response_handlers import return_context_and_deserialized, process_table_error +from azure.core.exceptions import HttpResponseError +from azure.core.async_paging import AsyncPageIterator + + +class TablePropertiesPaged(AsyncPageIterator): + """An iterable of Table properties. + + :ivar: str location_mode: The location mode being used to list results. The available + options include "primary" and "secondary". + :ivar: callable command: Function to retrieve the next page of items. + call. + :vartype: str continuation_token: An opaque continuation token. + """ + + def __init__(self, command, continuation_token=None, **kwargs): + super(TablePropertiesPaged, self).__init__( + self._get_next_cb, + self._extract_data_cb, + continuation_token=continuation_token or "", + **kwargs + ) + self._command = command + self.next_table_name = None + self._headers = None + self.location_mode = None + + async def _get_next_cb(self, continuation_token, **kwargs): + try: + return await self._command( + next_table_name=continuation_token or None, + cls=kwargs.pop('cls', return_context_and_deserialized), + use_location=self.location_mode + ) + except HttpResponseError as error: + process_table_error(error) + + async def _extract_data_cb(self, get_next_return): + self.location_mode, self._response, self._headers = get_next_return + props_list = [Table(t) for t in self._response.value] + return self._headers['x-ms-continuation-NextTableName'] or None, props_list + + +class TableEntityPropertiesPaged(AsyncPageIterator): + """An iterable of TableEntity properties. + + :ivar: callable command: Function to retrieve the next page of items. + call. + :ivar: int results_per_page: The maximum number of results retrieved per API call. + :ivar: Table table: The table that contains the entities + :ivar: callable command: Function to retrieve the next page of items. + :param int results_per_page: The maximum number of queue names to retrieve per + call. + :param str continuation_token: An opaque continuation token. + """ + + def __init__(self, command, results_per_page=None, table=None, + continuation_token=None): + super(TableEntityPropertiesPaged, self).__init__( + self._get_next_cb, + self._extract_data_cb, + continuation_token=continuation_token or {} + ) + self._command = command + self._headers = None + self.results_per_page = results_per_page + self.table = table + self.location_mode = None + + async def _get_next_cb(self, continuation_token): + row_key = "" + partition_key = "" + for key, value in continuation_token.items(): + if key == "RowKey": + row_key = value + if key == "PartitionKey": + partition_key = value + try: + return await self._command( + query_options=self.results_per_page or None, + next_row_key=row_key or None, + next_partition_key=partition_key or None, + table=self.table, + cls=return_context_and_deserialized, + use_location=self.location_mode + ) + except HttpResponseError as error: + process_table_error(error) + + async def _extract_data_cb(self, get_next_return): + self.location_mode, self._response, self._headers = get_next_return + props_list = [_convert_to_entity(t) for t in self._response.value] + next_entity = {} + if self._headers['x-ms-continuation-NextPartitionKey'] or self._headers['x-ms-continuation-NextRowKey']: + next_entity = {'PartitionKey': self._headers['x-ms-continuation-NextPartitionKey'], + 'RowKey': self._headers['x-ms-continuation-NextRowKey']} + return next_entity or None, props_list diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py new file mode 100644 index 000000000000..00c3acd2c5ec --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py @@ -0,0 +1,407 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import functools +from typing import ( + Union, + Any, +) + +from azure.core.async_paging import AsyncItemPaged +from azure.core.exceptions import ResourceNotFoundError, HttpResponseError +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.data.tables import VERSION +from azure.data.tables._entity import TableEntity +from azure.data.tables._generated.aio._azure_table_async import AzureTable +from azure.data.tables._generated.models import SignedIdentifier, TableProperties, QueryOptions +from azure.data.tables._models import AccessPolicy, Table +from azure.data.tables._shared.base_client_async import AsyncStorageAccountHostsMixin +from azure.data.tables._shared.policies_async import ExponentialRetry +from azure.data.tables._shared.request_handlers import serialize_iso +from azure.data.tables._shared.response_handlers import return_headers_and_deserialized, process_table_error + +from .._models import UpdateMode +from ._models import TableEntityPropertiesPaged +from .._deserialize import _convert_to_entity +from .._serialize import _add_entity_properties, _get_match_headers +from .._shared._table_client_base import TableClientBase + + +class TableClient(AsyncStorageAccountHostsMixin, TableClientBase): + """ :ivar str account_name: Name of the storage account (Cosmos or Azure)""" + + def __init__( + self, + account_url, # type: str + table_name, # type: str + credential, # type : Optional[Any]=None + **kwargs # type: Any + ): + # type: (...) -> None + """Create TableClient from a Credential. + + :param account_url: + A url to an Azure Storage account. + :type account_url: str + :param table_name: The table name. + :type table_name: str + :param credential: + The credentials with which to authenticate. This is optional if the + account URL already has a SAS token, or the connection string already has shared + access key values. The value can be a SAS token string, an account shared access + key. + :type credential: str + + :returns: None + """ + kwargs["retry_policy"] = kwargs.get("retry_policy") or ExponentialRetry(**kwargs) + loop = kwargs.pop('loop', None) + super(TableClient, self).__init__( + account_url, table_name=table_name, credential=credential, loop=loop, **kwargs + ) + self._client = AzureTable(self.url, pipeline=self._pipeline, loop=loop) + self._client._config.version = kwargs.get('api_version', VERSION) # pylint: disable = W0212 + self._loop = loop + + @distributed_trace_async + async def get_table_access_policy( + self, + **kwargs # type: Any + ): + # type: (...) -> dict[str,AccessPolicy] + """ + Retrieves details about any stored access policies specified on the table that may be + used with Shared Access Signatures. + :return: Dictionary of SignedIdentifiers + :rtype: dict[str,~azure.data.tables.AccessPolicy] + :raises: ~azure.core.exceptions.HttpResponseError + """ + timeout = kwargs.pop('timeout', None) + try: + _, identifiers = await self._client.table.get_access_policy( + table=self.table_name, + timeout=timeout, + cls=return_headers_and_deserialized, + **kwargs) + except HttpResponseError as error: + process_table_error(error) + return {s.id: s.access_policy or AccessPolicy() for s in identifiers} + + @distributed_trace_async + async def set_table_access_policy( + self, + signed_identifiers, # type: dict[str,AccessPolicy] + **kwargs): + # type: (...) -> None + """Sets stored access policies for the table that may be used with Shared Access Signatures. + + :param signed_identifiers: + :type signed_identifiers: dict[str,AccessPolicy] + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + self._validate_signed_identifiers(signed_identifiers) + identifiers = [] + for key, value in signed_identifiers.items(): + if value: + value.start = serialize_iso(value.start) + value.expiry = serialize_iso(value.expiry) + identifiers.append(SignedIdentifier(id=key, access_policy=value)) + signed_identifiers = identifiers # type: ignore + try: + await self._client.table.set_access_policy( + table=self.table_name, + table_acl=signed_identifiers or None, + **kwargs) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace_async + async def create_table( + self, + **kwargs # type: Any + ): + # type: (...) -> Table + """Creates a new table under the given account. + :return: Table created + :rtype: Table + :raises: ~azure.core.exceptions.HttpResponseError + """ + table_properties = TableProperties(table_name=self.table_name, **kwargs) + try: + table = await self._client.table.create(table_properties) + return Table(table) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace_async + async def delete_table( + self, + **kwargs # type: Any + ): + # type: (...) -> None + """Creates a new table under the given account. + :return: None + :rtype: None + """ + try: + await self._client.table.delete(table=self.table_name, **kwargs) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace_async + async def delete_entity( + self, + partition_key, # type: str + row_key, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the specified entity in a table. + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :keyword str etag: Etag of the entity + :keyword ~azure.core.MatchConditions match_condition: MatchCondition + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + if_match, if_not_match = _get_match_headers(kwargs=dict(kwargs, etag=kwargs.pop('etag', None), + match_condition=kwargs.pop('match_condition', None)), + etag_param='etag', match_param='match_condition') + try: + await self._client.table.delete_entity( + table=self.table_name, + partition_key=partition_key, + row_key=row_key, + if_match=if_match or if_not_match or '*', + **kwargs) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace_async + async def create_entity( + self, + entity, # type: Union[TableEntity, dict[str,str]] + **kwargs # type: Any + ): + # type: (...) -> TableEntity + """Insert entity in a table. + :param entity: The properties for the table entity. + :type entity: dict[str, str] + :return: TableEntity mapping str to azure.data.tables.EntityProperty + :rtype: ~azure.data.tables.TableEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + + if entity: + if "PartitionKey" in entity and "RowKey" in entity: + entity = _add_entity_properties(entity) + else: + raise ValueError('PartitionKey and RowKey were not provided in entity') + try: + inserted_entity = await self._client.table.insert_entity( + table=self.table_name, + table_entity_properties=entity, + **kwargs + ) + properties = _convert_to_entity(inserted_entity) + return properties + except ResourceNotFoundError as error: + process_table_error(error) + + @distributed_trace_async + async def update_entity( + self, + entity, # type: Union[TableEntity, dict[str,str]] + mode=UpdateMode.MERGE, # type: UpdateMode + **kwargs # type: Any + ): + # type: (...) -> None + """Update entity in a table. + :param mode: Merge or Replace entity + :type mode: ~azure.data.tables.UpdateMode + :param entity: The properties for the table entity. + :type entity: dict[str, str] + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :param etag: Etag of the entity + :type etag: str + :param match_condition: MatchCondition + :type match_condition: ~azure.core.MatchConditions + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + if_match, if_not_match = _get_match_headers(kwargs=dict(kwargs, etag=kwargs.pop('etag', None), + match_condition=kwargs.pop('match_condition', None)), + etag_param='etag', match_param='match_condition') + + partition_key = entity['PartitionKey'] + row_key = entity['RowKey'] + entity = _add_entity_properties(entity) + try: + if mode is UpdateMode.REPLACE: + await self._client.table.update_entity( + table=self.table_name, + partition_key=partition_key, + row_key=row_key, + table_entity_properties=entity, + if_match=if_match or if_not_match or "*", + **kwargs) + elif mode is UpdateMode.MERGE: + await self._client.table.merge_entity(table=self.table_name, partition_key=partition_key, + row_key=row_key, if_match=if_match or if_not_match or "*", + table_entity_properties=entity, **kwargs) + else: + raise ValueError('Mode type is not supported') + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace + def list_entities( + self, + **kwargs # type: Any + ): + # type: (...) -> AsyncItemPaged[TableEntity] + """Lists entities in a table. + + :keyword int results_per_page: Number of entities per page in return ItemPaged + :keyword Union[str, list(str)] select: Specify desired properties of an entity to return certain entities + :return: Query of table entities + :rtype: AsyncItemPaged[TableEntity] + :raises: ~azure.core.exceptions.HttpResponseError + """ + user_select = kwargs.pop('select', None) + if user_select and not isinstance(user_select, str): + user_select = ", ".join(user_select) + + query_options = QueryOptions(top=kwargs.pop('results_per_page', None), select=user_select) + + command = functools.partial( + self._client.table.query_entities, + **kwargs) + return AsyncItemPaged( + command, results_per_page=query_options, table=self.table_name, + page_iterator_class=TableEntityPropertiesPaged + ) + + @distributed_trace + def query_entities( + self, + filter, # type: str # pylint: disable = W0622 + **kwargs + ): + # type: (...) -> AsyncItemPaged[TableEntity] + """Lists entities in a table. + + :param str filter: Specify a filter to return certain entities + :keyword int results_per_page: Number of entities per page in return ItemPaged + :keyword Union[str, list[str]] select: Specify desired properties of an entity to return certain entities + :keyword dict parameters: Dictionary for formatting query with additional, user defined parameters + :return: Query of table entities + :rtype: ItemPaged[TableEntity] + :raises: ~azure.core.exceptions.HttpResponseError + """ + parameters = kwargs.pop('parameters', None) + filter = self._parameter_filter_substitution(parameters, filter) # pylint: disable = W0622 + + user_select = kwargs.pop('select', None) + if user_select and not isinstance(user_select, str): + user_select = ", ".join(user_select) + + query_options = QueryOptions(top=kwargs.pop('results_per_page', None), select=user_select, + filter=filter) + + command = functools.partial( + self._client.table.query_entities, + query_options=query_options, + **kwargs) + return AsyncItemPaged( + command, table=self.table_name, + page_iterator_class=TableEntityPropertiesPaged + ) + + @distributed_trace_async + async def get_entity( + self, + partition_key, # type: str + row_key, # type: str + **kwargs # type: Any + ): + # type: (...) -> TableEntity + """Queries entities in a table. + :param partition_key: The partition key of the entity. + :type partition_key: str + :param row_key: The row key of the entity. + :type row_key: str + :return: TableEntity mapping str to azure.data.tables.EntityProperty + :rtype: ~azure.data.tables.TableEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + try: + entity = await self._client.table.query_entities_with_partition_and_row_key(table=self.table_name, + partition_key=partition_key, + row_key=row_key, + **kwargs) + properties = _convert_to_entity(entity.additional_properties) + return properties + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace_async + async def upsert_entity( + self, + entity, # type: Union[TableEntity, dict[str,str]] + mode=UpdateMode.MERGE, # type: UpdateMode + **kwargs # type: Any + ): + # type: (...) -> None + + """Update/Merge or Insert entity into table. + :param mode: Merge or Replace and Insert on fail + :type mode: ~azure.data.tables.UpdateMode + :param entity: The properties for the table entity. + :type entity: dict[str, str] + :return: Entity mapping str to azure.data.tables.EntityProperty or None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + + partition_key = entity['PartitionKey'] + row_key = entity['RowKey'] + entity = _add_entity_properties(entity) + + try: + if mode is UpdateMode.MERGE: + await self._client.table.merge_entity( + table=self.table_name, + partition_key=partition_key, + row_key=row_key, + table_entity_properties=entity, + **kwargs + ) + elif mode is UpdateMode.REPLACE: + await self._client.table.update_entity( + table=self.table_name, + partition_key=partition_key, + row_key=row_key, + table_entity_properties=entity, + **kwargs) + else: + raise ValueError('Mode type is not supported') + except ResourceNotFoundError: + await self.create_entity( + partition_key=partition_key, + row_key=row_key, + table_entity_properties=entity, + **kwargs + ) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py new file mode 100644 index 000000000000..7c58d21a8a94 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py @@ -0,0 +1,293 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import functools +from typing import ( + Union, + Optional, + Any, +) + +from azure.core.async_paging import AsyncItemPaged +from azure.core.exceptions import HttpResponseError +from azure.core.pipeline import AsyncPipeline +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.data.tables import VERSION, LocationMode +from azure.data.tables._generated.aio._azure_table_async import AzureTable +from azure.data.tables._generated.models import TableServiceProperties, TableProperties, QueryOptions +from azure.data.tables._models import service_stats_deserialize, service_properties_deserialize +from azure.data.tables._shared.base_client_async import AsyncStorageAccountHostsMixin, AsyncTransportWrapper +from azure.data.tables._shared.policies_async import ExponentialRetry +from azure.data.tables._shared.response_handlers import process_table_error +from azure.data.tables.aio._table_client_async import TableClient +from ._models import TablePropertiesPaged +from .._shared._error import _validate_table_name +from .._shared._table_service_client_base import TableServiceClientBase +from .._models import Table + + +class TableServiceClient(AsyncStorageAccountHostsMixin, TableServiceClientBase): + """A client to interact with the Table Service at the account level. + + This client provides operations to retrieve and configure the account properties + as well as list, create and delete tables within the account. + For operations relating to a specific queue, a client for this entity + can be retrieved using the :func:`~get_table_client` function. + + :param str account_url: + The URL to the table service endpoint. Any other entities included + in the URL path (e.g. queue) will be discarded. This URL can be optionally + authenticated with a SAS token. + :param str credential: + The credentials with which to authenticate. This is optional if the + account URL already has a SAS token. The value can be a SAS token string, an account + shared access key. + :keyword str api_version: + The Storage API version to use for requests. Default value is '2019-07-07'. + Setting to an older version may result in reduced feature compatibility. + :keyword str secondary_hostname: + The hostname of the secondary endpoint. + + .. admonition:: Example: + + .. literalinclude:: ../samples/table_samples_authentication_async.py + :start-after: [START async_create_table_service_client] + :end-before: [END async_create_table_service_client] + :language: python + :dedent: 8 + :caption: Creating the tableServiceClient with an account url and credential. + + .. literalinclude:: ../samples/table_samples_authentication_async.py + :start-after: [START async_create_table_service_client_token] + :end-before: [END async_create_table_service_client_token] + :language: python + :dedent: 8 + :caption: Creating the tableServiceClient with Azure Identity credentials. + """ + + def __init__( + self, account_url, # type: str + credential=None, # type: Union[str,TokenCredential] + **kwargs # type: Any + ): + # type: (...) -> None + kwargs['retry_policy'] = kwargs.get('retry_policy') or ExponentialRetry(**kwargs) + loop = kwargs.pop('loop', None) + super(TableServiceClient, self).__init__( # type: ignore + account_url, + service='table', + credential=credential, + loop=loop, + **kwargs) + self._client = AzureTable(url=self.url, pipeline=self._pipeline, loop=loop) # type: ignore + self._client._config.version = kwargs.get('api_version', VERSION) # pylint: disable=protected-access + self._loop = loop + + @distributed_trace_async + async def get_service_stats(self, **kwargs): + # type: (...) -> dict[str,object] + """Retrieves statistics related to replication for the Table service. It is only available on the secondary + location endpoint when read-access geo-redundant replication is enabled for the account. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableServiceStats, or the result of cls(response) + :rtype: ~azure.data.tables.models.TableServiceStats + :raises: ~azure.core.exceptions.HttpResponseError + """ + try: + timeout = kwargs.pop('timeout', None) + stats = await self._client.service.get_statistics( # type: ignore + timeout=timeout, use_location=LocationMode.SECONDARY, **kwargs) + return service_stats_deserialize(stats) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace_async + async def get_service_properties(self, **kwargs): + # type: (...) -> dict[str,Any] + """Gets the properties of an account's Table service, + including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableServiceProperties, or the result of cls(response) + :rtype: ~azure.data.tables.models.TableServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + timeout = kwargs.pop('timeout', None) + try: + service_props = await self._client.service.get_properties(timeout=timeout, **kwargs) # type: ignore + return service_properties_deserialize(service_props) + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace_async + async def set_service_properties( + self, + analytics_logging=None, # type: Optional[TableAnalyticsLogging] + hour_metrics=None, # type: Optional[Metrics] + minute_metrics=None, # type: Optional[Metrics] + cors=None, # type: Optional[CorsRule] + **kwargs # type: Any + ): + # type: (...) -> None + """Sets properties for an account's Table service endpoint, + including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param analytics_logging: Properties for analytics + :type analytics_logging: ~azure.data.tables.TableAnalyticsLogging + :param hour_metrics: Hour level metrics + :type hour_metrics: ~azure.data.tables.Metrics + :param minute_metrics: Minute level metrics + :type minute_metrics: ~azure.data.tables.Metrics + :param cors: Cross-origin resource sharing rules + :type cors: ~azure.data.tables.CorsRule + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + props = TableServiceProperties( + logging=analytics_logging, + hour_metrics=hour_metrics, + minute_metrics=minute_metrics, + cors=cors + ) + try: + return await self._client.service.set_properties(props, **kwargs) # type: ignore + except HttpResponseError as error: + process_table_error(error) + + @distributed_trace_async + async def create_table( + self, + table_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> TableClient + """Creates a new table under the given account. + + :param headers: + :param table_name: The Table name. + :type table_name: ~azure.data.tables._models.Table + :return: TableClient, or the result of cls(response) + :rtype: ~azure.data.tables.TableClient or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + _validate_table_name(table_name) + + table_properties = TableProperties(table_name=table_name, **kwargs) + await self._client.table.create(table_properties=table_properties, **kwargs) + table = self.get_table_client(table=table_name) + return table + + @distributed_trace_async + async def delete_table( + self, + table_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Creates a new table under the given account. + + :param table_name: The Table name. + :type table_name: str + :return: None + :rtype: ~None + """ + _validate_table_name(table_name) + + await self._client.table.delete(table=table_name, **kwargs) + + @distributed_trace + def list_tables( + self, + **kwargs # type: Any + ): + # type: (...) -> AsyncItemPaged[Table] + """Queries tables under the given account. + + :keyword int results_per_page: Number of tables per page in return ItemPaged + :keyword Union[str, list(str)] select: Specify desired properties of a table to return certain tables + :return: AsyncItemPaged + :rtype: ~AsyncItemPaged[Table] + :raises: ~azure.core.exceptions.HttpResponseError + """ + user_select = kwargs.pop('select', None) + if user_select and not isinstance(user_select, str): + user_select = ", ".join(user_select) + + query_options = QueryOptions(top=kwargs.pop('results_per_page', None), select=user_select) + + command = functools.partial( + self._client.table.query, + query_options=query_options, + **kwargs) + return AsyncItemPaged( + command, + page_iterator_class=TablePropertiesPaged + ) + + @distributed_trace + def query_tables( + self, + filter, # pylint: disable=W0622 + **kwargs # type: Any + ): + # type: (...) -> AsyncItemPaged[Table] + """Queries tables under the given account. + :param filter: Specify a filter to return certain tables + :type filter: str + :keyword int results_per_page: Number of tables per page in return ItemPaged + :keyword Union[str, list(str)] select: Specify desired properties of a table to return certain tables + :keyword dict parameters: Dictionary for formatting query with additional, user defined parameters + :return: A query of tables + :rtype: AsyncItemPaged[Table] + :raises: ~azure.core.exceptions.HttpResponseError + """ + parameters = kwargs.pop('parameters', None) + filter = self._parameter_filter_substitution(parameters, filter) # pylint: disable=W0622 + + user_select = kwargs.pop('select', None) + if user_select and not isinstance(user_select, str): + user_select = ", ".join(user_select) + + query_options = QueryOptions(top=kwargs.pop('results_per_page', None), select=user_select, + filter=filter) + command = functools.partial(self._client.table.query, query_options=query_options, + **kwargs) + return AsyncItemPaged( + command, + page_iterator_class=TablePropertiesPaged + ) + + def get_table_client(self, table, **kwargs): + # type: (Union[TableProperties, str], Optional[Any]) -> TableClient + """Get a client to interact with the specified table. + + The table need not already exist. + + :param table: + The queue. This can either be the name of the queue, + or an instance of QueueProperties. + :type table: str or ~azure.storage.table.TableProperties + :returns: A :class:`~azure.data.tables.TableClient` object. + :rtype: ~azure.data.tables.TableClient + + """ + try: + table_name = table.name + except AttributeError: + table_name = table + + _pipeline = AsyncPipeline( + transport=AsyncTransportWrapper(self._pipeline._transport), # pylint: disable = protected-access + policies=self._pipeline._impl_policies # pylint: disable = protected-access + ) + + return TableClient( + self.url, table_name=table_name, credential=self.credential, + key_resolver_function=self.key_resolver_function, require_encryption=self.require_encryption, + key_encryption_key=self.key_encryption_key, api_version=self.api_version, _pipeline=self._pipeline, + _configuration=self._config, _location_mode=self._location_mode, _hosts=self._hosts, **kwargs) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/py.typed b/sdk/tables/azure-data-tables/azure/data/tables/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/dev_requirements.txt b/sdk/tables/azure-data-tables/dev_requirements.txt new file mode 100644 index 000000000000..5547db3c87f7 --- /dev/null +++ b/sdk/tables/azure-data-tables/dev_requirements.txt @@ -0,0 +1,6 @@ +-e ../../../tools/azure-devtools +-e ../../../tools/azure-sdk-tools +../../core/azure-core +cryptography>=2.1.4 +aiohttp>=3.0; python_version >= '3.5' + diff --git a/sdk/tables/azure-data-tables/mypy.ini b/sdk/tables/azure-data-tables/mypy.ini new file mode 100644 index 000000000000..46246be1772d --- /dev/null +++ b/sdk/tables/azure-data-tables/mypy.ini @@ -0,0 +1,13 @@ +[mypy] +python_version = 3.8 +warn_return_any = True +warn_unused_configs = True +ignore_missing_imports = True + +# Per-module options: + +[mypy-azure-table.azure.data.tables._generated.*] +ignore_errors = True + +[mypy-azure.core.*] +ignore_errors = True diff --git a/sdk/tables/azure-data-tables/samples/create_query_entities.py b/sdk/tables/azure-data-tables/samples/create_query_entities.py new file mode 100644 index 000000000000..7277f7c9e067 --- /dev/null +++ b/sdk/tables/azure-data-tables/samples/create_query_entities.py @@ -0,0 +1,30 @@ +class CreateODataQuery(object): + connection_string = "DefaultEndpointsProtocol=https;AccountName=example;AccountKey" \ + "=fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==;EndpointSuffix=core.windows.net " + account_url = "https://example.table.core.windows.net/" + account_name = "example" + access_key = "fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==" + + partition_key = "color" + row_key = "brand" + # Creating query filter for that table + table_name = "Office Supplies" + entity_name = "marker" + name_filter = "EntityName eq '{}'".format(entity_name) + + def sample_query_entities(self): + + from azure.data.tables import TableClient + from azure.core.exceptions import HttpResponseError + + table_client = TableClient(account_url=self.account_url, credential=self.access_key, table_name=self.table_name) + try: + queried_entities = table_client.query_entities(filter=self.name_filter, select="brand,color") + + # queried_entities type is ItemPaged + for entity_chosen in queried_entities: + # create a list of the entities and iterate through them to print each one out + # calls to the service to get more entities are made without user knowledge + print(entity_chosen) + except HttpResponseError as e: + print(e.message) diff --git a/sdk/tables/azure-data-tables/samples/creation_deletion_of_table.py b/sdk/tables/azure-data-tables/samples/creation_deletion_of_table.py new file mode 100644 index 000000000000..e9a614968af4 --- /dev/null +++ b/sdk/tables/azure-data-tables/samples/creation_deletion_of_table.py @@ -0,0 +1,61 @@ +class CreateDeleteTable(object): + connection_string = "DefaultEndpointsProtocol=https;AccountName=example;AccountKey=fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==;EndpointSuffix=core.windows.net" + table_name = "OfficeSupplies" + account_url = "https://example.table.core.windows.net/" + account_name = "example" + access_key = "fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==" + + def shared_key_credential(self): + from azure.data.tables import TableServiceClient + + table_service_client = TableServiceClient(account_url=self.account_url, credential=self.access_key) + + def connection_string_auth(self): + from azure.data.tables import TableServiceClient + + table_service_client = TableServiceClient.from_connection_string(conn_str=self.connection_string) + + def sas_token_auth(self): + from azure.data.tables import TableServiceClient + from azure.data.tables._shared.table_shared_access_signature import generate_account_sas + from azure.data.tables import ResourceTypes + from azure.data.tables import AccountSasPermissions + import datetime + import timedelta + + token = generate_account_sas( + account_name=self.account_name, + account_key=self.account_key, + resource_types=ResourceTypes(object=True), + permission=AccountSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start=datetime.utcnow() - timedelta(minutes=1), + ) + table_service_client = TableServiceClient(account_url=self.account_url,credential=token) + + def create_table(self): + from azure.data.tables import TableServiceClient + from azure.core.exceptions import ResourceExistsError + + table_service_client = TableServiceClient(account_url=self.account_url, credential=self.access_key) + try: + table_created = table_service_client.create_table(table_name=self.table_name) + print(table_created.table_name) + except ResourceExistsError: + print("TableExists") + + def delete_table(self): + from azure.data.tables import TableServiceClient + from azure.core.exceptions import ResourceNotFoundError + + table_service_client = TableServiceClient(account_url=self.account_url, credential=self.access_key) + try: + table_service_client.delete_table(table_name=self.table_name) + except ResourceNotFoundError: + print("TableNotFound") + + +if __name__ == '__main__': + sample = CreateDeleteTable() + sample.create_table() + sample.delete_table() diff --git a/sdk/tables/azure-data-tables/samples/inserting_deleting_entities.py b/sdk/tables/azure-data-tables/samples/inserting_deleting_entities.py new file mode 100644 index 000000000000..10c6a35f1453 --- /dev/null +++ b/sdk/tables/azure-data-tables/samples/inserting_deleting_entities.py @@ -0,0 +1,58 @@ +class InsertDeleteEntity(object): + connection_string = "DefaultEndpointsProtocol=https;AccountName=example;AccountKey=fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==;EndpointSuffix=core.windows.net" + table_name = "NAME" + account_url = "https://example.table.core.windows.net/" + account_name = "example" + access_key = "fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==" + + # Assuming there is a created table + entity = { + 'PartitionKey': 'color', + 'RowKey': 'brand', + 'text': 'Marker', + 'color': 'Purple', + 'price': '5' + } + + def create_entity(self): + + from azure.data.tables import TableClient + from azure.core.exceptions import ResourceExistsError + + table_client = TableClient(account_url=self.account_url, credential=self.access_key, table_name=self.table_name) + try: + inserted_entity = table_client.create_entity(entity=self.entity) + # inserted_entity type is dict[str,object] + print(inserted_entity.items()) # print out key-value pair of entity + except ResourceExistsError: + print("EntityExists") + + def delete_entity(self): + + from azure.data.tables import TableClient + from azure.core.exceptions import ResourceNotFoundError + from azure.core import MatchConditions + + table_client = TableClient(account_url=self.account_url, credential=self.access_key, table_name=self.table_name) + + # Create entity to delete (to showcase etag) + entity_created = table_client.create_entity(entity=self.entity) + + # show without calling metadata, cannot access etag + try: + entity_created.etag + except AttributeError: + print("Need to get metadata of entity") + + # In order to access etag as a part of the entity, need to call metadata on the entity + metadata = entity_created.metadata() + + # Can now get etag + etag = metadata['etag'] + + try: + # will delete if match_condition and etag are satisfied + table_client.delete_entity(entity=self.entity, etag=etag, match_condition=MatchConditions.IfNotModified) + + except ResourceNotFoundError: + print("EntityDoesNotExists") diff --git a/sdk/tables/azure-data-tables/samples/querying_table.py b/sdk/tables/azure-data-tables/samples/querying_table.py new file mode 100644 index 000000000000..2dd69452b6ec --- /dev/null +++ b/sdk/tables/azure-data-tables/samples/querying_table.py @@ -0,0 +1,25 @@ +class QueryTable(object): + connection_string = "DefaultEndpointsProtocol=https;AccountName=example;AccountKey=fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==;EndpointSuffix=core.windows.net" + table_name = "NAME" + account_url = "https://example.table.core.windows.net/" + account_name = "example" + access_key = "fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==" + + # Creating query filter for that table + table_name = "Office Supplies" + name_filter = "TableName eq '{}'".format(table_name) + + def query_tables(self): + from azure.data.tables import TableServiceClient + + table_service_client = TableServiceClient(account_url=self.account_url, credential=self.access_key) + # Create Tables to query + my_table = table_service_client.create_table(table_name=self.table_name) + print(my_table) + # Query tables + queried_tables = table_service_client.query_tables(filter=self.name_filter, results_per_page=10) + # table_client.query_tables() returns an itemPaged + # queried_tables is a list of filtered tables + + for table in queried_tables: + print(table) diff --git a/sdk/tables/azure-data-tables/samples/table_exists_error_handling.py b/sdk/tables/azure-data-tables/samples/table_exists_error_handling.py new file mode 100644 index 000000000000..bad368724447 --- /dev/null +++ b/sdk/tables/azure-data-tables/samples/table_exists_error_handling.py @@ -0,0 +1,24 @@ +class TableErrorHandling: + connection_string = "DefaultEndpointsProtocol=https;AccountName=example;AccountKey=fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==;EndpointSuffix=core.windows.net" + table_name = "OfficeSupplies" + account_url = "https://example.table.core.windows.net/" + account_name = "example" + access_key = "fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==" + + def create_table_if_exists(self): + from azure.data.tables import TableServiceClient + from azure.core.exceptions import ResourceExistsError + + # create table + table_service_client = TableServiceClient(account_url=self.account_url, credential=self.access_key) + table_service_client.create_table(table_name=self.table_name) + try: + # try to create existing table, ResourceExistsError will be thrown + table_service_client.create_table(table_name=self.table_name) + except ResourceExistsError: + print("TableExists") + + +if __name__ == '__main__': + sample = TableErrorHandling() + sample.create_table_if_exists() \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/samples/table_samples_authentication.py b/sdk/tables/azure-data-tables/samples/table_samples_authentication.py new file mode 100644 index 000000000000..8896918b1f59 --- /dev/null +++ b/sdk/tables/azure-data-tables/samples/table_samples_authentication.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: table_samples_authentication.py + +DESCRIPTION: + These samples demonstrate authenticating a client via: + * connection string + * shared access key + * generating a sas token with which the returned signature can be used with + the credential parameter of any TableServiceClient or TableClient + +USAGE: + python table_samples_authentication.py + + Set the environment variables with your own values before running the sample: + 1) AZURE_STORAGE_CONNECTION_STRING - the connection string to your storage account + 2) AZURE_STORAGE_ACCOUNT_URL - the Table service account URL + 3) AZURE_STORAGE_ACCOUNT_NAME - the name of the storage account + 4) AZURE_STORAGE_ACCESS_KEY - the storage account access key +""" + + +from datetime import datetime, timedelta +import os + + +class TableAuthSamples(object): + + connection_string = os.getenv("AZURE_STORAGE_CONNECTION_STRING") + + account_url = os.getenv("AZURE_STORAGE_ACCOUNT_URL") + account_name = os.getenv("AZURE_STORAGE_ACCOUNT_NAME") + access_key = os.getenv("AZURE_STORAGE_ACCESS_KEY") + + def authentication_by_connection_string(self): + # Instantiate a TableServiceClient using a connection string + # [START auth_from_connection_string] + from azure.data.tables import TableServiceClient + table_service = TableServiceClient.from_connection_string(conn_str=self.connection_string) + # [END auth_from_connection_string] + + # Get information for the Table Service + properties = table_service.get_service_properties() + + def authentication_by_shared_key(self): + # Instantiate a TableServiceClient using a shared access key + # [START create_Table_service_client] + from azure.data.tables import TableServiceClient + table_service = TableServiceClient(account_url=self.account_url, credential=self.access_key) + # [END create_table_service_client] + + # Get information for the Table Service + properties = table_service.get_service_properties() + + def authentication_by_shared_access_signature(self): + # Instantiate a TableServiceClient using a connection string + from azure.data.tables import TableServiceClient + table_service = TableServiceClient.from_connection_string(conn_str=self.connection_string) + + # Create a SAS token to use for authentication of a client + from azure.data.tables import generate_account_sas, ResourceTypes, AccountSasPermissions + + sas_token = generate_account_sas( + self.account_name, + self.access_key, + resource_types=ResourceTypes(service=True), + permission=AccountSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1) + ) + + token_auth_table_service = TableServiceClient(account_url=self.account_url, credential=sas_token) + + # Get information for the Table Service + properties = token_auth_table_service.get_service_properties() + + +if __name__ == '__main__': + sample = TableAuthSamples() + sample.authentication_by_connection_string() + sample.authentication_by_shared_key() + sample.authentication_by_shared_access_signature() diff --git a/sdk/tables/azure-data-tables/samples/table_samples_client.py b/sdk/tables/azure-data-tables/samples/table_samples_client.py new file mode 100644 index 000000000000..cb32c94196d0 --- /dev/null +++ b/sdk/tables/azure-data-tables/samples/table_samples_client.py @@ -0,0 +1,212 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: table_samples_client.py + +DESCRIPTION: + These samples demonstrate the following: creating and setting an access policy to generate a + sas token, getting a table client from a table URL, setting and getting table + metadata, sending messages and receiving them individually, deleting and + clearing all messages, and peeking and updating messages. + +USAGE: + python table_samples_client.py + + Set the environment variables with your own values before running the sample: + 1) AZURE_STORAGE_CONNECTION_STRING - the connection string to your storage account +""" + +from datetime import datetime, timedelta +import os + + +class TableEntitySamples(object): + connection_string = os.getenv("AZURE_STORAGE_CONNECTION_STRING") + + def set_access_policy(self): + # [START create_table_client_from_connection_string] + from azure.data.tables import TableClient + table = TableClient.from_connection_string(self.connection_string, table_name="mytable1") + # [END create_table_client_from_connection_string] + + # Create the Table + table.create_table() + + try: + # [START set_access_policy] + # Create an access policy + from azure.data.tables import AccessPolicy, TableSasPermissions + access_policy = AccessPolicy() + access_policy.start = datetime.utcnow() - timedelta(hours=1) + access_policy.expiry = datetime.utcnow() + timedelta(hours=1) + access_policy.permission = TableSasPermissions(add=True) + identifiers = {'my-access-policy-id': access_policy} + + # Set the access policy + table.set_table_access_policy(identifiers) + # [END set_access_policy] + + # Use the access policy to generate a SAS token + # [START table_client_sas_token] + from azure.data.tables import generate_table_sas + sas_token = generate_table_sas( + table.account_name, + table.table_name, + table.credential.account_key, + policy_id='my-access-policy-id' + ) + # [END table_client_sas_token] + + # Authenticate with the sas token + # [START create_table_client] + # token_auth_table = table.from_table_url( + # table_url=table.url, + # credential=sas_token + # ) + # [END create_table_client] + + finally: + # Delete the table + table.delete_table() + + def create_and_get_entities(self): + # Instantiate a table service client + from azure.data.tables import TableClient + table = TableClient.from_connection_string(self.connection_string, table_name="mytable3") + + # Create the Table + table.create_table() + + my_entity = { + 'PartitionKey': 'color', + 'RowKey': 'crayola', + 'text': 'Marker', + 'color': 'Purple', + 'price': '5' + } + try: + # [START create_entity] + created_entity = table.create_entity(table_entity_properties=my_entity) + print(created_entity) + # [END create_entity] + + # [START get_entity] + # Get Entity by partition and row key + got_entity = table.get_entity(partition_key=my_entity['PartitionKey'], + row_key=my_entity['RowKey']) + print(got_entity) + # [END get_entity] + + finally: + # Delete the table + table.delete_table() + + def query_entities(self): + # Instantiate a table service client + from azure.data.tables import TableClient + table = TableClient.from_connection_string(self.connection_string, table_name="mytable4") + + # Create the table + table.create_table() + + entity = {'PartitionKey': 'color2', 'RowKey': 'sharpie', 'text': 'Marker', 'color': 'Purple', 'price': '5'} + entity1 = {'PartitionKey': 'color2', 'RowKey': 'crayola', 'text': 'Marker', 'color': 'Red', 'price': '3'} + + try: + # Create entities + table.create_entity(table_entity_properties=entity) + table.create_entity(table_entity_properties=entity1) + # [START query_entities] + # Query the entities in the table + entities = list(table.query_entities()) + + for e in entities: + print(e) + # [END query_entities] + + finally: + # Delete the table + table.delete_table() + + def upsert_entities(self): + # Instantiate a table service client + from azure.data.tables import TableClient, UpdateMode + table = TableClient.from_connection_string(self.connection_string, table_name="mytable5") + + # Create the table + table.create_table() + + entity = {'PartitionKey': 'color', 'RowKey': 'sharpie', 'text': 'Marker', 'color': 'Purple', 'price': '5'} + entity1 = {'PartitionKey': 'color', 'RowKey': 'crayola', 'text': 'Marker', 'color': 'Red', 'price': '3'} + + try: + # Create entities + created = table.create_entity(table_entity_properties=entity) + + # [START upsert_entity] + # Try Replace and then Insert on Fail + insert_entity = table.upsert_entity(mode=UpdateMode.replace, table_entity_properties=entity1) + print(insert_entity) + + # Try merge, and merge since already in table + created.text = "NewMarker" + merged_entity = table.upsert_entity(mode=UpdateMode.MERGE, table_entity_properties=entity) + print(merged_entity) + # [END upsert_entity] + + finally: + # Delete the table + table.delete_table() + + def update_entities(self): + # Instantiate a table service client + from azure.data.tables import TableClient, UpdateMode + table = TableClient.from_connection_string(self.connection_string, table_name="mytable6") + + # Create the table and Table Client + table.create_table() + + entity = {'PartitionKey': 'color', 'RowKey': 'sharpie', 'text': 'Marker', 'color': 'Purple', 'price': '5'} + + try: + # Create entity + created = table.create_entity(table_entity_properties=entity) + + # [START update_entity] + # Update the entity + created.text = "NewMarker" + table.update_entity(mode=UpdateMode.replace, table_entity_properties=created) + + # Get the replaced entity + replaced = table.get_entity( + partition_key=created.PartitionKey, row_key=created.RowKey) + print(replaced) + + # Merge the entity + replaced.color = "Blue" + table.update_entity(mode=UpdateMode.MERGE, table_entity_properties=replaced) + + # Get the merged entity + merged = table.get_entity( + partition_key=replaced.PartitionKey, row_key=replaced.RowKey) + print(merged) + # [END update_entity] + + finally: + # Delete the table + table.delete_table() + + +if __name__ == '__main__': + sample = TableEntitySamples() + sample.set_access_policy() + sample.create_and_get_entities() + sample.query_entities() + sample.upsert_entities() + sample.update_entities() diff --git a/sdk/tables/azure-data-tables/samples/table_samples_service.py b/sdk/tables/azure-data-tables/samples/table_samples_service.py new file mode 100644 index 000000000000..eaf2bae86d9d --- /dev/null +++ b/sdk/tables/azure-data-tables/samples/table_samples_service.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: table_samples_service.py + +DESCRIPTION: + These samples demonstrate the following: setting and getting table service properties, + listing the tables in the service, and getting a TableClient from a TableServiceClient. + +USAGE: + python table_samples_service.py + + Set the environment variables with your own values before running the sample: + 1) AZURE_STORAGE_CONNECTION_STRING - the connection string to your storage account +""" + +import os + + +class TableServiceSamples(object): + connection_string = os.getenv("AZURE_STORAGE_CONNECTION_STRING") + + def table_service_properties(self): + # Instantiate the TableServiceClient from a connection string + from azure.data.tables import TableServiceClient + table_service = TableServiceClient.from_connection_string(conn_str=self.connection_string) + + # [START set_table_service_properties] + # Create service properties + from azure.data.tables import TableAnalyticsLogging, Metrics, CorsRule, RetentionPolicy + + # Create logging settings + logging = TableAnalyticsLogging(read=True, write=True, delete=True, + retention_policy=RetentionPolicy(enabled=True, days=5)) + + # Create metrics for requests statistics + hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) + minute_metrics = Metrics(enabled=True, include_apis=True, + retention_policy=RetentionPolicy(enabled=True, days=5)) + + # Create CORS rules + cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) + allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] + allowed_methods = ['GET', 'PUT'] + max_age_in_seconds = 500 + exposed_headers = ["x-ms-meta-data*", "x-ms-meta-source*", "x-ms-meta-abc", "x-ms-meta-bcd"] + allowed_headers = ["x-ms-meta-data*", "x-ms-meta-target*", "x-ms-meta-xyz", "x-ms-meta-foo"] + cors_rule2 = CorsRule( + allowed_origins, + allowed_methods, + max_age_in_seconds=max_age_in_seconds, + exposed_headers=exposed_headers, + allowed_headers=allowed_headers + ) + + cors = [cors_rule1, cors_rule2] + + # Set the service properties + table_service.set_service_properties(logging, hour_metrics, minute_metrics, cors) + # [END set_table_service_properties] + + # [START get_table_service_properties] + properties = table_service.get_service_properties() + # [END get_table_service_properties] + + def tables_in_account(self): + # Instantiate the TableServiceClient from a connection string + from azure.data.tables import TableServiceClient + table_service = TableServiceClient.from_connection_string(conn_str=self.connection_string) + + # [START tsc_create_table] + table_service.create_table("mytable1") + # [END tsc_create_table] + + try: + # [START tsc_list_tables] + # List all the tables in the service + list_tables = table_service.query_tables() + for table in list_tables: + print(table) + + # List the tables in the service that start with the name "my" + list_my_tables = table_service.query_tables(select="my") + for table in list_my_tables: + print(table) + # [END tsc_list_tables] + + finally: + # [START tsc_delete_table] + table_service.delete_table(table_name="mytable1") + # [END tsc_delete_table] + + def get_table_client(self): + # Instantiate the TableServiceClient from a connection string + from azure.data.tables import TableServiceClient, TableClient + table_service = TableServiceClient.from_connection_string(conn_str=self.connection_string) + + # [START get_table_client] + # Get the table client to interact with a specific table + table = table_service.get_table_client(table="mytable2") + # [END get_table_client] + + +if __name__ == '__main__': + sample = TableServiceSamples() + sample.table_service_properties() + sample.tables_in_account() + sample.get_table_client() diff --git a/sdk/tables/azure-data-tables/samples/update_entity.py b/sdk/tables/azure-data-tables/samples/update_entity.py new file mode 100644 index 000000000000..75af124aab9b --- /dev/null +++ b/sdk/tables/azure-data-tables/samples/update_entity.py @@ -0,0 +1,36 @@ +class UpdateEntity(object): + connection_string = "DefaultEndpointsProtocol=https;AccountName=example;AccountKey" \ + "=fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==;EndpointSuffix=core.windows.net " + table_name = "OfficeSupplies" + account_url = "https://example.table.core.windows.net/" + account_name = "example" + access_key = "fasgfbhBDFAShjDQ4jkvbnaBFHJOWS6gkjngdakeKFNLK==" + + # making keys not able to change - SEPARATE + entity = { + 'PartitionKey': 'color', + 'RowKey': 'brand', + 'text': 'Marker', + 'color': 'Purple', + 'price': '5' + } + + def update_entity(self): + from azure.data.tables import TableClient + from azure.core.exceptions import ResourceNotFoundError + + table_client = TableClient(account_url=self.account_url, credential=self.access_key, table_name=self.table_name) + try: + # defaults to UpdateMode.MERGE + table_client.update_entity(entity=self.entity) + except ResourceNotFoundError: + print("Entity does not exist") + + def upsert_entity(self): + from azure.data.tables import TableClient + from azure.data.tables._models import UpdateMode + + table_client = TableClient(account_url=self.account_url, credential=self.access_key, table_name=self.table_name) + + table_client.upsert_entity(entity=self.entity, mode=UpdateMode.REPLACE) + # no error will be thrown - it will insert diff --git a/sdk/tables/azure-data-tables/setup.cfg b/sdk/tables/azure-data-tables/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/tables/azure-data-tables/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/tables/azure-data-tables/setup.py b/sdk/tables/azure-data-tables/setup.py new file mode 100644 index 000000000000..9cf68df37c3d --- /dev/null +++ b/sdk/tables/azure-data-tables/setup.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup # type: ignore + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-data-tables" +PACKAGE_PPRINT_NAME = "Azure Data Tables" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ # type: ignore + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', # type: ignore + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description='\n\n', + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='ascl@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/table/azure-table', + classifiers=[ + "Development Status :: 4 - Beta", + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'tests', + ]), + install_requires=[ + "azure-core<2.0.0,>=1.2.2", + "msrest>=0.6.10" + # azure-data-tables + ], + extras_require={ + ":python_version<'3.0'": ['futures'], + ":python_version<'3.4'": ['enum34>=1.0.4'], + ":python_version<'3.5'": ["typing"] + }, +) diff --git a/sdk/tables/azure-data-tables/tests/_shared/__init__.py b/sdk/tables/azure-data-tables/tests/_shared/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sdk/tables/azure-data-tables/tests/_shared/asynctestcase.py b/sdk/tables/azure-data-tables/tests/_shared/asynctestcase.py new file mode 100644 index 000000000000..b23fb1974198 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/_shared/asynctestcase.py @@ -0,0 +1,56 @@ + +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import asyncio +import functools + +from azure_devtools.scenario_tests.utilities import trim_kwargs_from_test_function + +from azure.core.credentials import AccessToken + +from .testcase import TableTestCase + +LOGGING_FORMAT = '%(asctime)s %(name)-20s %(levelname)-5s %(message)s' + +class AsyncFakeTokenCredential(object): + """Protocol for classes able to provide OAuth tokens. + :param str scopes: Lets you specify the type of access needed. + """ + def __init__(self): + self.token = AccessToken("YOU SHALL NOT PASS", 0) + + async def get_token(self, *args): + return self.token + + +class AsyncTableTestCase(TableTestCase): + @staticmethod + def await_prepared_test(test_fn): + """Synchronous wrapper for async test methods. Used to avoid making changes + upstream to AbstractPreparer (which doesn't await the functions it wraps) + """ + + @functools.wraps(test_fn) + def run(test_class_instance, *args, **kwargs): + trim_kwargs_from_test_function(test_fn, kwargs) + loop = asyncio.get_event_loop() + return loop.run_until_complete(test_fn(test_class_instance, **kwargs)) + + return run + + def generate_oauth_token(self): + if self.is_live: + from azure.identity.aio import ClientSecretCredential + return ClientSecretCredential( + self.get_settings_value("TENANT_ID"), + self.get_settings_value("CLIENT_ID"), + self.get_settings_value("CLIENT_SECRET"), + ) + return self.generate_fake_token() + + def generate_fake_token(self): + return AsyncFakeTokenCredential() diff --git a/sdk/tables/azure-data-tables/tests/_shared/testcase.py b/sdk/tables/azure-data-tables/tests/_shared/testcase.py new file mode 100644 index 000000000000..69d43165658d --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/_shared/testcase.py @@ -0,0 +1,442 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from __future__ import division +from contextlib import contextmanager +import copy +import inspect +import os +import os.path +import time +from datetime import datetime, timedelta + +from azure.data.tables import ResourceTypes, AccountSasPermissions +from azure.data.tables._shared.table_shared_access_signature import generate_account_sas + +try: + import unittest.mock as mock +except ImportError: + import mock + +import zlib +import math +import sys +import string +import random +import re +import logging +from devtools_testutils import ( + AzureMgmtTestCase, + AzureMgmtPreparer, + ResourceGroupPreparer, + StorageAccountPreparer, + FakeResource, +) +from azure_devtools.scenario_tests import RecordingProcessor, AzureTestError, create_random_name +try: + from cStringIO import StringIO # Python 2 +except ImportError: + from io import StringIO + +from azure.core.credentials import AccessToken +#from azure.data.tabless import generate_account_sas, AccountSasPermissions, ResourceTypes +from azure.mgmt.storage.models import StorageAccount, Endpoints + +try: + from devtools_testutils import mgmt_settings_real as settings +except ImportError: + from devtools_testutils import mgmt_settings_fake as settings + +import pytest + + +LOGGING_FORMAT = '%(asctime)s %(name)-20s %(levelname)-5s %(message)s' + +class FakeTokenCredential(object): + """Protocol for classes able to provide OAuth tokens. + :param str scopes: Lets you specify the type of access needed. + """ + def __init__(self): + self.token = AccessToken("YOU SHALL NOT PASS", 0) + + def get_token(self, *args): + return self.token + + +class XMSRequestIDBody(RecordingProcessor): + """This process is used for Storage batch call only, to avoid the echo policy. + """ + def process_response(self, response): + content_type = None + for key, value in response.get('headers', {}).items(): + if key.lower() == 'content-type': + content_type = (value[0] if isinstance(value, list) else value).lower() + break + + if content_type and 'multipart/mixed' in content_type: + response['body']['string'] = re.sub(b"x-ms-client-request-id: [a-f0-9-]+\r\n", b"", response['body']['string']) + + return response + + +class GlobalStorageAccountPreparer(AzureMgmtPreparer): + def __init__(self): + super(GlobalStorageAccountPreparer, self).__init__( + name_prefix='', + random_name_length=42 + ) + + def create_resource(self, name, **kwargs): + storage_account = TableTestCase._STORAGE_ACCOUNT + if self.is_live: + self.test_class_instance.scrubber.register_name_pair( + storage_account.name, + "storagename" + ) + else: + name = "storagename" + storage_account.name = name + storage_account.primary_endpoints.table = 'https://{}.{}.core.windows.net'.format(name, 'table') + + return { + 'location': 'westus', + 'resource_group': TableTestCase._RESOURCE_GROUP, + 'storage_account': storage_account, + 'storage_account_key': TableTestCase._STORAGE_KEY, + 'storage_account_cs': TableTestCase._STORAGE_CONNECTION_STRING, + } + +class GlobalResourceGroupPreparer(AzureMgmtPreparer): + def __init__(self): + super(GlobalResourceGroupPreparer, self).__init__( + name_prefix='', + random_name_length=42 + ) + + def create_resource(self, name, **kwargs): + rg = TableTestCase._RESOURCE_GROUP + if self.is_live: + self.test_class_instance.scrubber.register_name_pair( + rg.name, + "rgname" + ) + else: + rg = FakeResource( + name="rgname", + id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname" + ) + + return { + 'location': 'westus', + 'resource_group': rg, + } + + +class TableTestCase(AzureMgmtTestCase): + + def __init__(self, *args, **kwargs): + super(TableTestCase, self).__init__(*args, **kwargs) + self.replay_processors.append(XMSRequestIDBody()) + + def connection_string(self, account, key): + return "DefaultEndpointsProtocol=https;AccountName=" + account.name + ";AccountKey=" + str(key) + ";EndpointSuffix=core.windows.net" + + def account_url(self, account, endpoint_type): + """Return an url of storage account. + + :param str storage_account: Storage account name + :param str storage_type: The Storage type part of the URL. Should be "blob", or "queue", etc. + """ + try: + if endpoint_type == "table": + return account.primary_endpoints.table.rstrip("/") + if endpoint_type == "cosmos": + return "https://{}.table.cosmos.azure.com".format(account.name) + else: + raise ValueError("Unknown storage type {}".format(storage_type)) + except AttributeError: # Didn't find "primary_endpoints" + return 'https://{}.{}.core.windows.net'.format(account, endpoint_type) + + def configure_logging(self): + try: + enable_logging = self.get_settings_value("ENABLE_LOGGING") + except AzureTestError: + enable_logging = True # That's the default value in fake settings + + self.enable_logging() if enable_logging else self.disable_logging() + + def enable_logging(self): + handler = logging.StreamHandler() + handler.setFormatter(logging.Formatter(LOGGING_FORMAT)) + self.logger.handlers = [handler] + self.logger.setLevel(logging.INFO) + self.logger.propagate = True + self.logger.disabled = False + + def disable_logging(self): + self.logger.propagate = False + self.logger.disabled = True + self.logger.handlers = [] + + def sleep(self, seconds): + if self.is_live: + time.sleep(seconds) + + def get_random_bytes(self, size): + # recordings don't like random stuff. making this more + # deterministic. + return b'a'*size + + def get_random_text_data(self, size): + '''Returns random unicode text data exceeding the size threshold for + chunking blob upload.''' + checksum = zlib.adler32(self.qualified_test_name.encode()) & 0xffffffff + rand = random.Random(checksum) + text = u'' + words = [u'hello', u'world', u'python', u'啊齄丂狛狜'] + while (len(text) < size): + index = int(rand.random()*(len(words) - 1)) + text = text + u' ' + words[index] + + return text + + @staticmethod + def _set_test_proxy(service, settings): + if settings.USE_PROXY: + service.set_proxy( + settings.PROXY_HOST, + settings.PROXY_PORT, + settings.PROXY_USER, + settings.PROXY_PASSWORD, + ) + + def assertNamedItemInContainer(self, container, item_name, msg=None): + def _is_string(obj): + if sys.version_info >= (3,): + return isinstance(obj, str) + else: + return isinstance(obj, basestring) + for item in container: + if _is_string(item): + if item == item_name: + return + elif item.name == item_name: + return + elif hasattr(item, 'snapshot') and item.snapshot == item_name: + return + + + standardMsg = '{0} not found in {1}'.format( + repr(item_name), [str(c) for c in container]) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertNamedItemNotInContainer(self, container, item_name, msg=None): + for item in container: + if item.name == item_name: + standardMsg = '{0} unexpectedly found in {1}'.format( + repr(item_name), repr(container)) + self.fail(self._formatMessage(msg, standardMsg)) + + def generate_oauth_token(self): + if self.is_live: + from azure.identity import ClientSecretCredential + return ClientSecretCredential( + self.get_settings_value("TENANT_ID"), + self.get_settings_value("CLIENT_ID"), + self.get_settings_value("CLIENT_SECRET"), + ) + return self.generate_fake_token() + + def generate_sas_token(self): + fake_key = 'a'*30 + 'b'*30 + + return '?' + generate_account_sas( + account_name = 'test', # name of the storage account + account_key = fake_key, # key for the storage account + resource_types = ResourceTypes(object=True), + permission = AccountSasPermissions(read=True,list=True), + start = datetime.now() - timedelta(hours = 24), + expiry = datetime.now() + timedelta(days = 8) + ) + + def generate_fake_token(self): + return FakeTokenCredential() + + +def not_for_emulator(test): + def skip_test_if_targeting_emulator(self): + test(self) + return skip_test_if_targeting_emulator + + +class RetryCounter(object): + def __init__(self): + self.count = 0 + + def simple_count(self, retry_context): + self.count += 1 + + +class ResponseCallback(object): + def __init__(self, status=None, new_status=None): + self.status = status + self.new_status = new_status + self.first = True + self.count = 0 + + def override_first_status(self, response): + if self.first and response.http_response.status_code == self.status: + response.http_response.status_code = self.new_status + self.first = False + self.count += 1 + + def override_status(self, response): + if response.http_response.status_code == self.status: + response.http_response.status_code = self.new_status + self.count += 1 + + +class LogCaptured(object): + def __init__(self, test_case=None): + # accept the test case so that we may reset logging after capturing logs + self.test_case = test_case + + def __enter__(self): + # enable logging + # it is possible that the global logging flag is turned off + self.test_case.enable_logging() + + # create a string stream to send the logs to + self.log_stream = StringIO() + + # the handler needs to be stored so that we can remove it later + self.handler = logging.StreamHandler(self.log_stream) + self.handler.setFormatter(logging.Formatter(LOGGING_FORMAT)) + + # get and enable the logger to send the outputs to the string stream + self.logger = logging.getLogger('azure.storage') + self.logger.level = logging.DEBUG + self.logger.addHandler(self.handler) + + # the stream is returned to the user so that the capture logs can be retrieved + return self.log_stream + + def __exit__(self, exc_type, exc_val, exc_tb): + # stop the handler, and close the stream to exit + self.logger.removeHandler(self.handler) + self.log_stream.close() + + # reset logging since we messed with the setting + self.test_case.configure_logging() + + +@pytest.fixture(scope="session") +def storage_account(): + test_case = AzureMgmtTestCase("__init__") + rg_preparer = ResourceGroupPreparer(random_name_enabled=True, name_prefix='pystorage') + storage_preparer = StorageAccountPreparer(random_name_enabled=True, name_prefix='pyacrstorage') + + # Create + subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", None) + location = os.environ.get("AZURE_LOCATION", "westus") + + existing_rg_name = os.environ.get("AZURE_RESOURCEGROUP_NAME") + existing_storage_name = os.environ.get("AZURE_STORAGE_ACCOUNT_NAME") + existing_storage_key = os.environ.get("AZURE_STORAGE_ACCOUNT_KEY") + storage_connection_string = os.environ.get("AZURE_STORAGE_CONNECTION_STRING") + + i_need_to_create_rg = not (existing_rg_name or existing_storage_name or storage_connection_string) + got_storage_info_from_env = existing_storage_name or storage_connection_string + + try: + if i_need_to_create_rg: + rg_name, rg_kwargs = rg_preparer._prepare_create_resource(test_case) + rg = rg_kwargs['resource_group'] + else: + rg_name = existing_rg_name or "no_rg_needed" + rg = FakeResource( + name=rg_name, + id="/subscriptions/{}/resourceGroups/{}".format(subscription_id, rg_name) + ) + TableTestCase._RESOURCE_GROUP = rg + + try: + if got_storage_info_from_env: + + if storage_connection_string: + storage_connection_string_parts = dict([ + part.split('=', 1) + for part in storage_connection_string.split(";") + ]) + + storage_account = None + if existing_storage_name: + storage_name = existing_storage_name + storage_account = StorageAccount( + location=location, + ) + storage_account.name = storage_name + storage_account.id = storage_name + storage_account.primary_endpoints=Endpoints() + storage_account.primary_endpoints.table = 'https://{}.{}.core.windows.net'.format(storage_name, 'table') + storage_key = existing_storage_key + + if not storage_connection_string: + # It means I have received a storage name from env + storage_connection_string=";".join([ + "DefaultEndpointsProtocol=https", + "AccountName={}".format(storage_name), + "AccountKey={}".format(storage_key), + "TableEndpoint={}".format(storage_account.primary_endpoints.table), + ]) + + if not storage_account: + # It means I have received a connection string + storage_name = storage_connection_string_parts["AccountName"] + storage_account = StorageAccount( + location=location, + ) + + def build_service_endpoint(service): + try: + suffix = storage_connection_string_parts["EndpointSuffix"] + except KeyError: + suffix = "cosmos.azure.com" + return "{}://{}.{}.{}".format( + storage_connection_string_parts.get("DefaultEndpointsProtocol", "https"), + storage_connection_string_parts["AccountName"], + service, + suffix + ) + + storage_account.name = storage_name + storage_account.id = storage_name + storage_account.primary_endpoints=Endpoints() + storage_account.primary_endpoints.table = storage_connection_string_parts.get("TableEndpoint", build_service_endpoint("table")) + storage_account.secondary_endpoints=Endpoints() + storage_account.secondary_endpoints.table = storage_connection_string_parts.get("TableSecondaryEndpoint", build_service_endpoint("table")) + storage_key = storage_connection_string_parts["AccountKey"] + + else: + storage_name, storage_kwargs = storage_preparer._prepare_create_resource(test_case, **rg_kwargs) + storage_account = storage_kwargs['storage_account'] + storage_key = storage_kwargs['storage_account_key'] + storage_connection_string = storage_kwargs['storage_account_cs'] + + TableTestCase._STORAGE_ACCOUNT = storage_account + TableTestCase._STORAGE_KEY = storage_key + TableTestCase._STORAGE_CONNECTION_STRING = storage_connection_string + yield + finally: + if not got_storage_info_from_env: + storage_preparer.remove_resource( + storage_name, + resource_group=rg + ) + finally: + if i_need_to_create_rg: + rg_preparer.remove_resource(rg_name) + TableTestCase._RESOURCE_GROUP = None diff --git a/sdk/tables/azure-data-tables/tests/conftest.py b/sdk/tables/azure-data-tables/tests/conftest.py new file mode 100644 index 000000000000..b73f2c91f9b2 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/conftest.py @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +import sys + +# fixture needs to be visible from conftest +from _shared.testcase import storage_account + +# Ignore async tests for Python < 3.5 +collect_ignore_glob = [] +if sys.version_info < (3, 5): + collect_ignore_glob.append("*_async.py") + +def pytest_configure(config): + # register an additional marker + config.addinivalue_line( + "usefixtures", "storage_account" + ) diff --git a/sdk/tables/azure-data-tables/tests/encryption_test_helper.py b/sdk/tables/azure-data-tables/tests/encryption_test_helper.py new file mode 100644 index 000000000000..e1e9f5439ec3 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/encryption_test_helper.py @@ -0,0 +1,90 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +# from cryptography.hazmat.backends import default_backend +# from cryptography.hazmat.primitives.asymmetric.padding import ( +# OAEP, +# MGF1, +# ) +# from cryptography.hazmat.primitives.asymmetric.rsa import generate_private_key +# from cryptography.hazmat.primitives.hashes import SHA1 +# from cryptography.hazmat.primitives.keywrap import ( +# aes_key_wrap, +# aes_key_unwrap, +# ) + + +# class KeyWrapper: +# def __init__(self, kid='local:key1'): +# # Must have constant key value for recorded tests, otherwise we could use a random generator. +# self.kek = b'\xbe\xa4\x11K\x9eJ\x07\xdafF\x83\xad+\xadvA C\xe8\xbc\x90\xa4\x11}G\xc3\x0f\xd4\xb4\x19m\x11' +# self.backend = default_backend() +# self.kid = kid +# +# def wrap_key(self, key, algorithm='A256KW'): +# if algorithm == 'A256KW': +# return aes_key_wrap(self.kek, key, self.backend) +# +# raise ValueError(_ERROR_UNKNOWN_KEY_WRAP_ALGORITHM) +# +# def unwrap_key(self, key, algorithm): +# if algorithm == 'A256KW': +# return aes_key_unwrap(self.kek, key, self.backend) +# +# raise ValueError(_ERROR_UNKNOWN_KEY_WRAP_ALGORITHM) +# +# def get_key_wrap_algorithm(self): +# return 'A256KW' +# +# def get_kid(self): +# return self.kid +# +# +# class KeyResolver: +# def __init__(self): +# self.keys = {} +# +# def put_key(self, key): +# self.keys[key.get_kid()] = key +# +# def resolve_key(self, kid): +# return self.keys[kid] +# +# +# class RSAKeyWrapper: +# def __init__(self, kid='local:key2'): +# self.private_key = generate_private_key(public_exponent=65537, +# key_size=2048, +# backend=default_backend()) +# self.public_key = self.private_key.public_key() +# self.kid = kid +# +# def wrap_key(self, key, algorithm='RSA'): +# if algorithm == 'RSA': +# return self.public_key.encrypt(key, +# OAEP( +# mgf=MGF1(algorithm=SHA1()), +# algorithm=SHA1(), +# label=None) +# ) +# +# raise ValueError(_ERROR_UNKNOWN_KEY_WRAP_ALGORITHM) +# +# def unwrap_key(self, key, algorithm): +# if algorithm == 'RSA': +# return self.private_key.decrypt(key, +# OAEP( +# mgf=MGF1(algorithm=SHA1()), +# algorithm=SHA1(), +# label=None) +# ) +# +# raise ValueError(_ERROR_UNKNOWN_KEY_WRAP_ALGORITHM) +# +# def get_key_wrap_algorithm(self): +# return 'RSA' +# +# def get_kid(self): +# return self.kid diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_account_sas.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_account_sas.yaml new file mode 100644 index 000000000000..741501bf67f0 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_account_sas.yaml @@ -0,0 +1,224 @@ +interactions: +- request: + body: '{"TableName": "pytablesync99dc0b08"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:16 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesync99dc0b08"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:14 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesync99dc0b08') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "test", "RowKey": "test1", "text": "hello"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '60' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:16 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/pytablesync99dc0b08(PartitionKey='test',RowKey='test1') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:14 GMT + etag: + - W/"datetime'2020-07-30T13%3A30%3A15.8178135Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: '{"PartitionKey": "test", "RowKey": "test2", "text": "hello"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '60' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:16 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/pytablesync99dc0b08(PartitionKey='test',RowKey='test2') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:15 GMT + etag: + - W/"datetime'2020-07-30T13%3A30%3A15.9048723Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:16 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/pytablesync99dc0b08()?st=2020-07-30T13%3A29%3A16Z&se=2020-07-30T14%3A30%3A16Z&sp=r&sv=2019-07-07&ss=t&srt=o&sig=0OQL2hilfGTuH%2FU49GkWLVFZf6k3qzZxHLBJae7gShE%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#pytablesync99dc0b08","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A30%3A15.8178135Z''\"","PartitionKey":"test","RowKey":"test1","Timestamp":"2020-07-30T13:30:15.8178135Z","text":"hello"},{"odata.etag":"W/\"datetime''2020-07-30T13%3A30%3A15.9048723Z''\"","PartitionKey":"test","RowKey":"test2","Timestamp":"2020-07-30T13:30:15.9048723Z","text":"hello"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:15 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:17 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesync99dc0b08') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:15 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_table.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_table.yaml new file mode 100644 index 000000000000..bf152c84c08b --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_table.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"TableName": "pytablesynca4ed0b50"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:17 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesynca4ed0b50"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:16 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesynca4ed0b50') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:17 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesynca4ed0b50') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:16 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_table_fail_on_exist.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_table_fail_on_exist.yaml new file mode 100644 index 000000000000..54e63317d03e --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_table_fail_on_exist.yaml @@ -0,0 +1,137 @@ +interactions: +- request: + body: '{"TableName": "pytablesync6d7c1113"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:17 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesync6d7c1113"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:17 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesync6d7c1113') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "pytablesync6d7c1113"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:18 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.error":{"code":"TableAlreadyExists","message":{"lang":"en-US","value":"The + table specified already exists.\nRequestId:aaf65c7a-b002-0055-7875-66bf84000000\nTime:2020-07-30T13:30:17.3141296Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:17 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 409 + message: Conflict +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:18 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesync6d7c1113') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:17 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_delete_table_with_existing_table.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_delete_table_with_existing_table.yaml new file mode 100644 index 000000000000..ce2bcfded581 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_delete_table_with_existing_table.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"TableName": "pytablesyncded1139b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:18 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesyncded1139b"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:17 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesyncded1139b') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:18 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesyncded1139b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:17 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_delete_table_with_non_existing_table_fail_not_exist.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_delete_table_with_non_existing_table_fail_not_exist.yaml new file mode 100644 index 000000000000..9459690dfb9c --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_delete_table_with_non_existing_table_fail_not_exist.yaml @@ -0,0 +1,49 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:18 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesynca12c1b7c') + response: + body: + string: 'ResourceNotFoundThe specified resource does not exist. + + RequestId:380aef87-1002-0071-4675-6626ca000000 + + Time:2020-07-30T13:30:18.2321770Z' + headers: + cache-control: + - no-cache + content-type: + - application/xml;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:17 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 404 + message: Not Found +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_get_table_acl.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_get_table_acl.yaml new file mode 100644 index 000000000000..9d61c26b68bf --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_get_table_acl.yaml @@ -0,0 +1,127 @@ +interactions: +- request: + body: '{"TableName": "pytablesyncb07a0bab"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:19 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesyncb07a0bab"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:18 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesyncb07a0bab') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 30 Jul 2020 13:30:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:19 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/pytablesyncb07a0bab?comp=acl + response: + body: + string: "\uFEFF" + headers: + content-type: + - application/xml + date: + - Thu, 30 Jul 2020 13:30:18 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:19 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesyncb07a0bab') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:18 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables.yaml new file mode 100644 index 000000000000..1eeeb4ad4a2d --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables.yaml @@ -0,0 +1,132 @@ +interactions: +- request: + body: '{"TableName": "pytablesync9a730b0b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:12 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesync9a730b0b"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:05 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesync9a730b0b') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:13 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"pytablesync9a730b0b"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:05 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Mon, 06 Jul 2020 18:27:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:13 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesync9a730b0b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 06 Jul 2020 18:27:05 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_filter.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_filter.yaml new file mode 100644 index 000000000000..672042849d88 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_filter.yaml @@ -0,0 +1,132 @@ +interactions: +- request: + body: '{"TableName": "pytablesync3f57100b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:13 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesync3f57100b"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:04 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesync3f57100b') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:13 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$filter=TableName%20eq%20%27pytablesync3f57100b%27 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"pytablesync3f57100b"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:04 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Mon, 06 Jul 2020 18:27:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:13 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesync3f57100b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 06 Jul 2020 18:27:04 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_marker.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_marker.yaml new file mode 100644 index 000000000000..93bc752e952c --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_marker.yaml @@ -0,0 +1,282 @@ +interactions: +- request: + body: '{"TableName": "listtable03f561007"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:13 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable03f561007"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:05 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable03f561007') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable13f561007"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable13f561007"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable13f561007') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable23f561007"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable23f561007"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable23f561007') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable33f561007"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable33f561007"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable33f561007') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:14 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$top=2 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable03f561007"},{"TableName":"listtable13f561007"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-continuation-nexttablename: + - 1!48!bGlzdHRhYmxlMjNmNTYxMDA3ATAxZDY1M2MzMGQ5N2M3YTY- + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:14 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$top=2&NextTableName=1%2148%21bGlzdHRhYmxlMjNmNTYxMDA3ATAxZDY1M2MzMGQ5N2M3YTY- + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable23f561007"},{"TableName":"listtable33f561007"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-continuation-nexttablename: + - 1!48!cHl0YWJsZXN5bmMzZjU3MTAwYgEwMWQ2NTNjMzBkMTdkMWY2 + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_num_results.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_num_results.yaml new file mode 100644 index 000000000000..06733f6d4453 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_list_tables_with_num_results.yaml @@ -0,0 +1,280 @@ +interactions: +- request: + body: '{"TableName": "listtable0967e1246"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable0967e1246"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable0967e1246') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable1967e1246"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:15 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable1967e1246"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable1967e1246') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable2967e1246"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:15 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable2967e1246"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable2967e1246') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable3967e1246"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:15 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable3967e1246"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable3967e1246') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:15 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable03f561007"},{"TableName":"listtable0967e1246"},{"TableName":"listtable13f561007"},{"TableName":"listtable1967e1246"},{"TableName":"listtable23f561007"},{"TableName":"listtable2967e1246"},{"TableName":"listtable33f561007"},{"TableName":"listtable3967e1246"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Mon, 06 Jul 2020 18:27:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 06 Jul 2020 18:27:15 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$top=3 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable03f561007"},{"TableName":"listtable0967e1246"},{"TableName":"listtable13f561007"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 06 Jul 2020 18:27:06 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-continuation-nexttablename: + - 1!48!bGlzdHRhYmxlMTk2N2UxMjQ2ATAxZDY1M2MzMGUwNWI4YWU- + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables.yaml new file mode 100644 index 000000000000..f7d5d473f268 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables.yaml @@ -0,0 +1,132 @@ +interactions: +- request: + body: '{"TableName": "pytablesynca68e0b85"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:19 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesynca68e0b85"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:18 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesynca68e0b85') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:20 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"pytablesynca68e0b85"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:18 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:20 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesynca68e0b85') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:19 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_filter.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_filter.yaml new file mode 100644 index 000000000000..d178fe108c18 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_filter.yaml @@ -0,0 +1,132 @@ +interactions: +- request: + body: '{"TableName": "pytablesync512a1085"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:20 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesync512a1085"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:19 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesync512a1085') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:20 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$filter=TableName%20eq%20%27pytablesync512a1085%27 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"pytablesync512a1085"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:19 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:20 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesync512a1085') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:19 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_marker.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_marker.yaml new file mode 100644 index 000000000000..357c4ee12762 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_marker.yaml @@ -0,0 +1,282 @@ +interactions: +- request: + body: '{"TableName": "listtable051291081"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:21 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable051291081"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:19 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable051291081') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable151291081"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:21 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable151291081"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:19 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable151291081') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable251291081"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:21 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable251291081"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:20 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable251291081') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable351291081"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:21 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable351291081"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:20 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable351291081') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:21 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$top=2 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable051291081"},{"TableName":"listtable151291081"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:20 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-continuation-nexttablename: + - 1!48!bGlzdHRhYmxlMjUxMjkxMDgxATAxZDY2Njc1OTI0MDk0Yjk- + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:21 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$top=2&NextTableName=1%2148%21bGlzdHRhYmxlMjUxMjkxMDgxATAxZDY2Njc1OTI0MDk0Yjk- + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable251291081"},{"TableName":"listtable351291081"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:20 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-continuation-nexttablename: + - 1!48!cHl0YWJsZXN5bmM1MTJhMTA4NQEwMWQ2NjY3NTkxY2M2MTAx + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_num_results.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_num_results.yaml new file mode 100644 index 000000000000..a0f64072a7d6 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_num_results.yaml @@ -0,0 +1,280 @@ +interactions: +- request: + body: '{"TableName": "listtable0aab312c0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:21 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable0aab312c0"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:20 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable0aab312c0') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable1aab312c0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:22 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable1aab312c0"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:20 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable1aab312c0') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable2aab312c0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:22 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable2aab312c0"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:20 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable2aab312c0') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "listtable3aab312c0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:22 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable3aab312c0"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:20 GMT + location: + - https://storagename.table.core.windows.net/Tables('listtable3aab312c0') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:22 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$top=3 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable051291081"},{"TableName":"listtable0aab312c0"},{"TableName":"listtable151291081"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:20 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-continuation-nexttablename: + - 1!48!bGlzdHRhYmxlMWFhYjMxMmMwATAxZDY2Njc1OTJiM2I2Y2M- + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:22 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable051291081"},{"TableName":"listtable0aab312c0"},{"TableName":"listtable151291081"},{"TableName":"listtable1aab312c0"},{"TableName":"listtable251291081"},{"TableName":"listtable2aab312c0"},{"TableName":"listtable351291081"},{"TableName":"listtable3aab312c0"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:21 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_too_many_ids.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_too_many_ids.yaml new file mode 100644 index 000000000000..3940f45778b6 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_too_many_ids.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"TableName": "pytablesync6f17111b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:22 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesync6f17111b"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:21 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesync6f17111b') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:23 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesync6f17111b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:21 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifier.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifier.yaml new file mode 100644 index 000000000000..633676e5b817 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifier.yaml @@ -0,0 +1,166 @@ +interactions: +- request: + body: '{"TableName": "pytablesyncb9bd17bb"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 22 Jun 2020 17:01:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 22 Jun 2020 17:01:27 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesyncb9bd17bb"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 22 Jun 2020 17:01:27 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesyncb9bd17bb') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: ' + + empty' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '129' + Content-Type: + - application/xml + Date: + - Mon, 22 Jun 2020 17:01:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 22 Jun 2020 17:01:27 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/pytablesyncb9bd17bb?comp=acl + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Mon, 22 Jun 2020 17:01:27 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 22 Jun 2020 17:01:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 22 Jun 2020 17:01:27 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/pytablesyncb9bd17bb?comp=acl + response: + body: + string: "\uFEFFempty" + headers: + content-type: + - application/xml + date: + - Mon, 22 Jun 2020 17:01:28 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Mon, 22 Jun 2020 17:01:28 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 22 Jun 2020 17:01:28 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesyncb9bd17bb') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 22 Jun 2020 17:01:28 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifiers.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifiers.yaml new file mode 100644 index 000000000000..f121bda2200b --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifiers.yaml @@ -0,0 +1,165 @@ +interactions: +- request: + body: '{"TableName": "pytablesyncd1eb182e"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:23 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesyncd1eb182e"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:22 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesyncd1eb182e') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/xml + Date: + - Thu, 30 Jul 2020 13:30:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:23 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/pytablesyncd1eb182e?comp=acl + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:22 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 30 Jul 2020 13:30:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:23 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/pytablesyncd1eb182e?comp=acl + response: + body: + string: "\uFEFF" + headers: + content-type: + - application/xml + date: + - Thu, 30 Jul 2020 13:30:22 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:23 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesyncd1eb182e') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:22 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_signed_identifiers.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_signed_identifiers.yaml new file mode 100644 index 000000000000..7f509ff962ae --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_signed_identifiers.yaml @@ -0,0 +1,166 @@ +interactions: +- request: + body: '{"TableName": "pytablesync45dd15a0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:30:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:23 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesync45dd15a0"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 13:30:23 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesync45dd15a0') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: ' + + testid2020-07-30T13:25:24Z2020-07-30T14:30:24Zr' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '257' + Content-Type: + - application/xml + Date: + - Thu, 30 Jul 2020 13:30:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:24 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/pytablesync45dd15a0?comp=acl + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:23 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 30 Jul 2020 13:30:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:24 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/pytablesync45dd15a0?comp=acl + response: + body: + string: "\uFEFFtestid2020-07-30T13:25:24.0000000Z2020-07-30T14:30:24.0000000Zr" + headers: + content-type: + - application/xml + date: + - Thu, 30 Jul 2020 13:30:23 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 13:30:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:30:24 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesync45dd15a0') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 13:30:23 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_account_sas.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_account_sas.yaml new file mode 100644 index 000000000000..bd44b04c6092 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_account_sas.yaml @@ -0,0 +1,165 @@ +interactions: +- request: + body: '{"TableName": "pytableasynce5ae0d85"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 01 Jul 2020 19:38:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 01 Jul 2020 19:38:16 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasynce5ae0d85"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 01 Jul 2020 19:38:14 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasynce5ae0d85') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstoragewmjulbgag54k.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "test", "RowKey": "test1", "text": "hello"}' + headers: + Content-Length: + - '60' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Wed, 01 Jul 2020 19:38:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 01 Jul 2020 19:38:16 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/pytableasynce5ae0d85(PartitionKey='test',RowKey='test1') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Wed, 01 Jul 2020 19:38:14 GMT + etag: W/"datetime'2020-07-01T19%3A38%3A15.4375691Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstoragewmjulbgag54k.table.core.windows.net/pytableasynce5ae0d85(PartitionKey='test',RowKey='test1') +- request: + body: '{"PartitionKey": "test", "RowKey": "test2", "text": "hello"}' + headers: + Content-Length: + - '60' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Wed, 01 Jul 2020 19:38:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 01 Jul 2020 19:38:16 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/pytableasynce5ae0d85(PartitionKey='test',RowKey='test2') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Wed, 01 Jul 2020 19:38:14 GMT + etag: W/"datetime'2020-07-01T19%3A38%3A15.5206274Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstoragewmjulbgag54k.table.core.windows.net/pytableasynce5ae0d85(PartitionKey='test',RowKey='test2') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 01 Jul 2020 19:40:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 01 Jul 2020 19:40:44 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?st=2020-07-01T19:37:16Z&se=2020-07-01T20:38:16Z&sp=l&sv=2019-07-07&ss=t&srt=c&sig=vFStimHCbV6koJEHsdqo3MqWUYRHvwTl4F2pkJ1qdxk%3D + response: + body: + string: '{"odata.error":{"code":"InvalidUri","message":{"lang":"en-US","value":"The + requested URI does not represent any resource on the server.\nRequestId:006703ee-6002-0050-4cdf-4f8a05000000\nTime:2020-07-01T19:40:43.4759218Z"}}}' + headers: + content-length: '222' + content-type: application/json + date: Wed, 01 Jul 2020 19:40:43 GMT + server: Microsoft-HTTPAPI/2.0 + x-ms-error-code: InvalidUri + status: + code: 400 + message: The requested URI does not represent any resource on the server. + url: https://pyacrstoragewmjulbgag54k.table.core.windows.net//Tables?st=2020-07-01T19:37:16Z&se=2020-07-01T20:38:16Z&sp=l&sv=2019-07-07&ss=t&srt=c&sig=vFStimHCbV6koJEHsdqo3MqWUYRHvwTl4F2pkJ1qdxk%3D +- request: + body: null + headers: + Date: + - Wed, 01 Jul 2020 19:40:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 01 Jul 2020 19:40:44 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasynce5ae0d85') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Wed, 01 Jul 2020 19:40:43 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstoragewmjulbgag54k.table.core.windows.net/Tables('pytableasynce5ae0d85') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_table.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_table.yaml new file mode 100644 index 000000000000..dbd0daa84a87 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_table.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: '{"TableName": "pytableasyncf33c0dcd"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:09 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasyncf33c0dcd"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:08 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasyncf33c0dcd') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:31:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:09 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasyncf33c0dcd') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:31:08 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables('pytableasyncf33c0dcd') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_table_fail_on_exist.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_table_fail_on_exist.yaml new file mode 100644 index 000000000000..05fe78006883 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_table_fail_on_exist.yaml @@ -0,0 +1,103 @@ +interactions: +- request: + body: '{"TableName": "pytableasyncdea11390"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:09 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasyncdea11390"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:08 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasyncdea11390') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: '{"TableName": "pytableasyncdea11390"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:10 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.error":{"code":"TableAlreadyExists","message":{"lang":"en-US","value":"The + table specified already exists.\nRequestId:4783f26d-b002-001c-1975-66e974000000\nTime:2020-07-30T13:31:09.2843685Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:08 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 409 + message: Conflict + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:31:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:10 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasyncdea11390') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:31:08 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables('pytableasyncdea11390') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_existing_table.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_existing_table.yaml new file mode 100644 index 000000000000..b3298a2f8cfa --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_existing_table.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: '{"TableName": "pytableasync5ef31618"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:10 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasync5ef31618"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:08 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasync5ef31618') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:31:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:10 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasync5ef31618') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:31:09 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables('pytableasync5ef31618') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_non_existing_table_fail_not_exist.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_non_existing_table_fail_not_exist.yaml new file mode 100644 index 000000000000..0a55171a744b --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_non_existing_table_fail_not_exist.yaml @@ -0,0 +1,35 @@ +interactions: +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:31:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:10 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasync50951df9') + response: + body: + string: 'ResourceNotFoundThe specified resource does not exist. + + RequestId:685895a9-9002-0066-1b75-668339000000 + + Time:2020-07-30T13:31:10.1773914Z' + headers: + cache-control: no-cache + content-type: application/xml;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:09 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 404 + message: Not Found + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables('pytableasync50951df9') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_get_table_acl.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_get_table_acl.yaml new file mode 100644 index 000000000000..e2dcef36a394 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_get_table_acl.yaml @@ -0,0 +1,95 @@ +interactions: +- request: + body: '{"TableName": "pytableasync1550e28"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:11 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasync1550e28"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:10 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasync1550e28') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/xml + Date: + - Thu, 30 Jul 2020 13:31:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:11 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/pytableasync1550e28?comp=acl + response: + body: + string: "\uFEFF" + headers: + content-type: application/xml + date: Thu, 30 Jul 2020 13:31:10 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/pytableasync1550e28?comp=acl +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:31:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:11 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasync1550e28') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:31:10 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables('pytableasync1550e28') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables.yaml new file mode 100644 index 000000000000..5ac4de53c713 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables.yaml @@ -0,0 +1,71 @@ +interactions: +- request: + body: '{"TableName": "pytableasynce6450d88"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:11 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasynce6450d88"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:10 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasynce6450d88') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:12 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"pytableasynce6450d88"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:10 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_filter.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_filter.yaml new file mode 100644 index 000000000000..f5ba218782d5 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_filter.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: '{"TableName": "pytableasynca9051288"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 23 Jul 2020 14:21:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 23 Jul 2020 14:21:27 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasynca9051288"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 23 Jul 2020 14:21:28 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasynca9051288') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstoragej3sl6jfnvp34.table.core.windows.net/Tables +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_marker.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_marker.yaml new file mode 100644 index 000000000000..f9338c2477f8 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_marker.yaml @@ -0,0 +1,214 @@ +interactions: +- request: + body: '{"TableName": "listtable0a9041284"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 22 Jul 2020 19:11:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 22 Jul 2020 19:11:34 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable0a9041284"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 22 Jul 2020 19:11:34 GMT + location: https://storagename.table.core.windows.net/Tables('listtable0a9041284') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables +- request: + body: '{"TableName": "listtable1a9041284"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 22 Jul 2020 19:11:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 22 Jul 2020 19:11:34 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable1a9041284"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 22 Jul 2020 19:11:34 GMT + location: https://storagename.table.core.windows.net/Tables('listtable1a9041284') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables +- request: + body: '{"TableName": "listtable2a9041284"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 22 Jul 2020 19:11:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 22 Jul 2020 19:11:34 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable2a9041284"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 22 Jul 2020 19:11:35 GMT + location: https://storagename.table.core.windows.net/Tables('listtable2a9041284') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables +- request: + body: '{"TableName": "listtable3a9041284"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 22 Jul 2020 19:11:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 22 Jul 2020 19:11:34 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable3a9041284"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 22 Jul 2020 19:11:35 GMT + location: https://storagename.table.core.windows.net/Tables('listtable3a9041284') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 22 Jul 2020 19:11:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 22 Jul 2020 19:11:35 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0a9041284"},{"TableName":"listtable1a9041284"},{"TableName":"listtable2a9041284"},{"TableName":"listtable3a9041284"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 22 Jul 2020 19:11:35 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 22 Jul 2020 19:11:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 22 Jul 2020 19:11:35 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0a9041284"},{"TableName":"listtable1a9041284"},{"TableName":"listtable2a9041284"},{"TableName":"listtable3a9041284"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 22 Jul 2020 19:11:35 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_num_results.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_num_results.yaml new file mode 100644 index 000000000000..aaaef8669965 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_num_results.yaml @@ -0,0 +1,247 @@ +interactions: +- request: + body: '{"TableName": "listtable0cac14c3"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '34' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:12 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable0cac14c3"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:11 GMT + location: https://storagename.table.core.windows.net/Tables('listtable0cac14c3') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: '{"TableName": "listtable1cac14c3"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '34' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:12 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable1cac14c3"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:11 GMT + location: https://storagename.table.core.windows.net/Tables('listtable1cac14c3') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: '{"TableName": "listtable2cac14c3"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '34' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:12 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable2cac14c3"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:11 GMT + location: https://storagename.table.core.windows.net/Tables('listtable2cac14c3') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: '{"TableName": "listtable3cac14c3"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '34' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:13 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable3cac14c3"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:12 GMT + location: https://storagename.table.core.windows.net/Tables('listtable3cac14c3') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:13 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0cac14c3"},{"TableName":"listtable1cac14c3"},{"TableName":"listtable2cac14c3"},{"TableName":"listtable3cac14c3"},{"TableName":"pytableasynce6450d88"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:12 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:13 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$top=3 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0cac14c3"},{"TableName":"listtable1cac14c3"},{"TableName":"listtable2cac14c3"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:12 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-continuation-nexttablename: 1!48!bGlzdHRhYmxlM2NhYzE0YzMBMDFkNjY2NzViMGY4YjFkYw-- + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables?$top=3 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:13 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$top=3&NextTableName=1!48!bGlzdHRhYmxlM2NhYzE0YzMBMDFkNjY2NzViMGY4YjFkYw-- + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable3cac14c3"},{"TableName":"pytableasynce6450d88"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:12 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables?$top=3&NextTableName=1!48!bGlzdHRhYmxlM2NhYzE0YzMBMDFkNjY2NzViMGY4YjFkYw-- +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_query_tables_with_filter.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_query_tables_with_filter.yaml new file mode 100644 index 000000000000..71721dd0002f --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_query_tables_with_filter.yaml @@ -0,0 +1,98 @@ +interactions: +- request: + body: '{"TableName": "pytableasyncbd551302"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:13 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasyncbd551302"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:12 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasyncbd551302') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:13 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$filter=TableName%20eq%20'pytableasyncbd551302' + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"pytableasyncbd551302"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:12 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables?$filter=TableName%20eq%20'pytableasyncbd551302' +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:31:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:14 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasyncbd551302') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:31:12 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables('pytableasyncbd551302') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_too_many_ids.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_too_many_ids.yaml new file mode 100644 index 000000000000..345ba7b9888a --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_too_many_ids.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: '{"TableName": "pytableasynce03c1398"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasynce03c1398"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:12 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasynce03c1398') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:31:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:14 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasynce03c1398') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:31:12 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables('pytableasynce03c1398') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_empty_signed_identifiers.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_empty_signed_identifiers.yaml new file mode 100644 index 000000000000..15a202289223 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_empty_signed_identifiers.yaml @@ -0,0 +1,124 @@ +interactions: +- request: + body: '{"TableName": "pytableasync6d6c1aab"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasync6d6c1aab"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:12 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasync6d6c1aab') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/xml + Content-Type: + - application/xml + Date: + - Thu, 30 Jul 2020 13:31:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:14 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/pytableasync6d6c1aab?comp=acl + response: + body: + string: '' + headers: + content-length: '0' + date: Thu, 30 Jul 2020 13:31:12 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/pytableasync6d6c1aab?comp=acl +- request: + body: null + headers: + Accept: + - application/xml + Date: + - Thu, 30 Jul 2020 13:31:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:14 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/pytableasync6d6c1aab?comp=acl + response: + body: + string: "\uFEFF" + headers: + content-type: application/xml + date: Thu, 30 Jul 2020 13:31:13 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/pytableasync6d6c1aab?comp=acl +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:31:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:15 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasync6d6c1aab') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:31:13 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables('pytableasync6d6c1aab') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_signed_identifiers.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_signed_identifiers.yaml new file mode 100644 index 000000000000..ddf1845c6423 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_signed_identifiers.yaml @@ -0,0 +1,127 @@ +interactions: +- request: + body: '{"TableName": "pytableasyncd261181d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:31:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:15 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasyncd261181d"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:31:13 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasyncd261181d') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables +- request: + body: ' + + testid2020-07-30T13:26:15Z2020-07-30T14:31:15Zr' + headers: + Accept: + - application/xml + Content-Length: + - '257' + Content-Type: + - application/xml + Date: + - Thu, 30 Jul 2020 13:31:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:15 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/pytableasyncd261181d?comp=acl + response: + body: + string: '' + headers: + content-length: '0' + date: Thu, 30 Jul 2020 13:31:14 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/pytableasyncd261181d?comp=acl +- request: + body: null + headers: + Accept: + - application/xml + Date: + - Thu, 30 Jul 2020 13:31:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:15 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/pytableasyncd261181d?comp=acl + response: + body: + string: "\uFEFFtestid2020-07-30T13:26:15.0000000Z2020-07-30T14:31:15.0000000Zr" + headers: + content-type: application/xml + date: Thu, 30 Jul 2020 13:31:14 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/pytableasyncd261181d?comp=acl +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:31:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:31:15 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasyncd261181d') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:31:14 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageq3qeesbeuztp.table.core.windows.net/Tables('pytableasyncd261181d') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_request_callback_signed_header.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_request_callback_signed_header.yaml new file mode 100644 index 000000000000..0c69b85c1fa5 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_request_callback_signed_header.yaml @@ -0,0 +1,114 @@ +interactions: +- request: + body: '{"TableName": "cont48761589"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '29' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: +<<<<<<< HEAD + - Wed, 15 Jul 2020 12:56:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 15 Jul 2020 12:56:10 GMT +======= + - Wed, 01 Jul 2020 18:18:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 01 Jul 2020 18:18:37 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"cont48761589"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: +<<<<<<< HEAD + - Wed, 15 Jul 2020 12:56:10 GMT +======= + - Wed, 01 Jul 2020 18:18:35 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + location: + - https://storagename.table.core.windows.net/Tables('cont48761589') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: +<<<<<<< HEAD + - Wed, 15 Jul 2020 12:56:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 15 Jul 2020 12:56:11 GMT +======= + - Wed, 01 Jul 2020 18:18:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 01 Jul 2020 18:18:37 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('cont48761589') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: +<<<<<<< HEAD + - Wed, 15 Jul 2020 12:56:10 GMT +======= + - Wed, 01 Jul 2020 18:18:35 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_response_callback.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_response_callback.yaml new file mode 100644 index 000000000000..fd9bd5a4d21e --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_response_callback.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Wed, 01 Jul 2020 18:18:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 01 Jul 2020 18:18:37 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse" + headers: + content-type: + - application/xml + date: + - Wed, 01 Jul 2020 18:18:35 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml new file mode 100644 index 000000000000..5e43e4345d35 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: +<<<<<<< HEAD + - Wed, 01 Jul 2020 18:25:06 GMT + User-Agent: + - customer_user_agent + x-ms-date: + - Wed, 01 Jul 2020 18:25:06 GMT +======= + - Wed, 01 Jul 2020 18:18:37 GMT + User-Agent: + - customer_user_agent + x-ms-date: + - Wed, 01 Jul 2020 18:18:37 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: +<<<<<<< HEAD + - Wed, 01 Jul 2020 18:25:05 GMT +======= + - Wed, 01 Jul 2020 18:18:36 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml new file mode 100644 index 000000000000..abd3dd677701 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml @@ -0,0 +1,87 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Mon, 27 Jul 2020 14:16:21 GMT + User-Agent: + - TestApp/v1.0 azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:16:21 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 27 Jul 2020 14:16:21 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Mon, 27 Jul 2020 14:16:21 GMT + User-Agent: + - TestApp/v2.0 TestApp/v1.0 azsdk-python-storage-table/2019-07-07 Python/3.8.3 + (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:16:21 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Mon, 27 Jul 2020 14:16:21 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml new file mode 100644 index 000000000000..d3da2ae7a6c4 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml @@ -0,0 +1,44 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 30 Jun 2020 19:45:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 30 Jun 2020 19:45:39 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 30 Jun 2020 19:45:38 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_binary_property_value.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_binary_property_value.yaml new file mode 100644 index 000000000000..8ed696eaf9da --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_binary_property_value.yaml @@ -0,0 +1,185 @@ +interactions: +- request: + body: '{"TableName": "uttable99fe1256"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:35 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable99fe1256"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:34 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable99fe1256') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk99fe1256", "RowKey": "rk99fe1256", "binary": "AQIDBAUGBwgJCg==", + "binary@odata.type": "Edm.Binary"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '119' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:35 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable99fe1256 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable99fe1256/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A34.6927611Z''\"","PartitionKey":"pk99fe1256","RowKey":"rk99fe1256","Timestamp":"2020-07-30T14:24:34.6927611Z","binary@odata.type":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:34 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A34.6927611Z'" + location: + - https://storagename.table.core.windows.net/uttable99fe1256(PartitionKey='pk99fe1256',RowKey='rk99fe1256') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:35 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable99fe1256(PartitionKey='pk99fe1256',RowKey='rk99fe1256') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable99fe1256/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A34.6927611Z''\"","PartitionKey":"pk99fe1256","RowKey":"rk99fe1256","Timestamp":"2020-07-30T14:24:34.6927611Z","binary@odata.type":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:34 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A34.6927611Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:35 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable99fe1256') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:34 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity.yaml new file mode 100644 index 000000000000..60a0ec925dbc --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity.yaml @@ -0,0 +1,233 @@ +interactions: +- request: + body: '{"TableName": "uttable12440ee0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:35 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable12440ee0"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:34 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable12440ee0') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk12440ee0", "RowKey": "rk12440ee0", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:36 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:36 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable12440ee0 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable12440ee0/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A35.3901372Z''\"","PartitionKey":"pk12440ee0","RowKey":"rk12440ee0","Timestamp":"2020-07-30T14:24:35.3901372Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:34 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A35.3901372Z'" + location: + - https://storagename.table.core.windows.net/uttable12440ee0(PartitionKey='pk12440ee0',RowKey='rk12440ee0') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:36 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:36 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttable12440ee0(PartitionKey='pk12440ee0',RowKey='rk12440ee0') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:34 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:36 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:36 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable12440ee0(PartitionKey='pk12440ee0',RowKey='rk12440ee0') + response: + body: + string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:1e52ed17-0002-002f-077d-6628c3000000\nTime:2020-07-30T14:24:35.5952834Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:34 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:36 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:36 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable12440ee0') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:34 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_not_existing.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_not_existing.yaml new file mode 100644 index 000000000000..180b3fb1edf6 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_not_existing.yaml @@ -0,0 +1,141 @@ +interactions: +- request: + body: '{"TableName": "uttablef9b6145a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:36 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:36 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablef9b6145a"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:35 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablef9b6145a') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:37 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:37 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttablef9b6145a(PartitionKey='pkf9b6145a',RowKey='rkf9b6145a') + response: + body: + string: 'ResourceNotFoundThe specified resource does not exist. + + RequestId:dc92eeba-e002-0007-227d-665f7c000000 + + Time:2020-07-30T14:24:36.2619723Z' + headers: + cache-control: + - no-cache + content-type: + - application/xml;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:35 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:37 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablef9b6145a') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:35 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_with_if_doesnt_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_with_if_doesnt_match.yaml new file mode 100644 index 000000000000..9c427c9e7c77 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_with_if_doesnt_match.yaml @@ -0,0 +1,197 @@ +interactions: +- request: + body: '{"TableName": "uttablea99a1781"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:37 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablea99a1781"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:35 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablea99a1781') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pka99a1781", "RowKey": "rka99a1781", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:37 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablea99a1781 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablea99a1781/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A36.8026672Z''\"","PartitionKey":"pka99a1781","RowKey":"rka99a1781","Timestamp":"2020-07-30T14:24:36.8026672Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:35 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A36.8026672Z'" + location: + - https://storagename.table.core.windows.net/uttablea99a1781(PartitionKey='pka99a1781',RowKey='rka99a1781') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:37 GMT + If-Match: + - W/"datetime'2012-06-15T22%3A51%3A44.9662825Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:37 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttablea99a1781(PartitionKey='pka99a1781',RowKey='rka99a1781') + response: + body: + string: 'UpdateConditionNotSatisfiedThe update condition specified in the request was not satisfied. + + RequestId:9818b359-f002-0057-697d-664074000000 + + Time:2020-07-30T14:24:36.8927298Z' + headers: + cache-control: + - no-cache + content-type: + - application/xml;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:35 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 412 + message: Precondition Failed +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:37 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablea99a1781') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:36 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_with_if_matches.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_with_if_matches.yaml new file mode 100644 index 000000000000..fc7891635888 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_with_if_matches.yaml @@ -0,0 +1,233 @@ +interactions: +- request: + body: '{"TableName": "uttable3801156d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:38 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable3801156d"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:36 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable3801156d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk3801156d", "RowKey": "rk3801156d", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:38 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable3801156d + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable3801156d/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A37.4661421Z''\"","PartitionKey":"pk3801156d","RowKey":"rk3801156d","Timestamp":"2020-07-30T14:24:37.4661421Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:36 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A37.4661421Z'" + location: + - https://storagename.table.core.windows.net/uttable3801156d(PartitionKey='pk3801156d',RowKey='rk3801156d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:38 GMT + If-Match: + - W/"datetime'2020-07-30T14%3A24%3A37.4661421Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:38 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttable3801156d(PartitionKey='pk3801156d',RowKey='rk3801156d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:36 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:38 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable3801156d(PartitionKey='pk3801156d',RowKey='rk3801156d') + response: + body: + string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:1d3cb1c3-a002-0044-617d-667595000000\nTime:2020-07-30T14:24:37.6402651Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:36 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:38 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable3801156d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:36 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_empty_and_spaces_property_value.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_empty_and_spaces_property_value.yaml new file mode 100644 index 000000000000..d49027ddb9fb --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_empty_and_spaces_property_value.yaml @@ -0,0 +1,188 @@ +interactions: +- request: + body: '{"TableName": "uttable66111670"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:38 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable66111670"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:38 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable66111670') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk66111670", "RowKey": "rk66111670", "EmptyByte": "", + "EmptyUnicode": "", "SpacesOnlyByte": " ", "SpacesOnlyUnicode": " ", "SpacesBeforeByte": + " Text", "SpacesBeforeUnicode": " Text", "SpacesAfterByte": "Text ", "SpacesAfterUnicode": + "Text ", "SpacesBeforeAndAfterByte": " Text ", "SpacesBeforeAndAfterUnicode": + " Text "}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '359' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:39 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable66111670 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable66111670/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A38.1730826Z''\"","PartitionKey":"pk66111670","RowKey":"rk66111670","Timestamp":"2020-07-30T14:24:38.1730826Z","EmptyByte":"","EmptyUnicode":"","SpacesOnlyByte":" ","SpacesOnlyUnicode":" ","SpacesBeforeByte":" Text","SpacesBeforeUnicode":" Text","SpacesAfterByte":"Text ","SpacesAfterUnicode":"Text ","SpacesBeforeAndAfterByte":" Text ","SpacesBeforeAndAfterUnicode":" Text "}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:38 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A38.1730826Z'" + location: + - https://storagename.table.core.windows.net/uttable66111670(PartitionKey='pk66111670',RowKey='rk66111670') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:39 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable66111670(PartitionKey='pk66111670',RowKey='rk66111670') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable66111670/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A38.1730826Z''\"","PartitionKey":"pk66111670","RowKey":"rk66111670","Timestamp":"2020-07-30T14:24:38.1730826Z","EmptyByte":"","EmptyUnicode":"","SpacesOnlyByte":" ","SpacesOnlyUnicode":" ","SpacesBeforeByte":" Text","SpacesBeforeUnicode":" Text","SpacesAfterByte":"Text ","SpacesAfterUnicode":"Text ","SpacesBeforeAndAfterByte":" Text ","SpacesBeforeAndAfterUnicode":" Text "}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:38 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A38.1730826Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:39 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable66111670') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:38 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity.yaml new file mode 100644 index 000000000000..e2a2f91ea816 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity.yaml @@ -0,0 +1,190 @@ +interactions: +- request: + body: '{"TableName": "uttablee7730dad"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:39 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablee7730dad"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:38 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablee7730dad') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pke7730dad", "RowKey": "rke7730dad", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:39 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablee7730dad + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee7730dad/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A38.7779466Z''\"","PartitionKey":"pke7730dad","RowKey":"rke7730dad","Timestamp":"2020-07-30T14:24:38.7779466Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:38 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A38.7779466Z'" + location: + - https://storagename.table.core.windows.net/uttablee7730dad(PartitionKey='pke7730dad',RowKey='rke7730dad') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:39 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablee7730dad(PartitionKey='pke7730dad',RowKey='rke7730dad') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee7730dad/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A38.7779466Z''\"","PartitionKey":"pke7730dad","RowKey":"rke7730dad","Timestamp":"2020-07-30T14:24:38.7779466Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:38 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A38.7779466Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:39 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablee7730dad') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:38 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_full_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_full_metadata.yaml new file mode 100644 index 000000000000..9d07a60dd4d7 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_full_metadata.yaml @@ -0,0 +1,190 @@ +interactions: +- request: + body: '{"TableName": "uttabled1cb135f"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:40 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:40 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttabled1cb135f"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:38 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttabled1cb135f') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkd1cb135f", "RowKey": "rkd1cb135f", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:40 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:40 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttabled1cb135f + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttabled1cb135f/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A39.3967653Z''\"","PartitionKey":"pkd1cb135f","RowKey":"rkd1cb135f","Timestamp":"2020-07-30T14:24:39.3967653Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:38 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A39.3967653Z'" + location: + - https://storagename.table.core.windows.net/uttabled1cb135f(PartitionKey='pkd1cb135f',RowKey='rkd1cb135f') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:40 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + accept: + - application/json;odata=fullmetadata + x-ms-date: + - Thu, 30 Jul 2020 14:24:40 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttabled1cb135f(PartitionKey='pkd1cb135f',RowKey='rkd1cb135f') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttabled1cb135f/@Element","odata.type":"storagename.uttabled1cb135f","odata.id":"https://storagename.table.core.windows.net/uttabled1cb135f(PartitionKey=''pkd1cb135f'',RowKey=''rkd1cb135f'')","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A39.3967653Z''\"","odata.editLink":"uttabled1cb135f(PartitionKey=''pkd1cb135f'',RowKey=''rkd1cb135f'')","PartitionKey":"pkd1cb135f","RowKey":"rkd1cb135f","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2020-07-30T14:24:39.3967653Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:38 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A39.3967653Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:40 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:40 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttabled1cb135f') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:39 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match.yaml new file mode 100644 index 000000000000..c665ee80f445 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match.yaml @@ -0,0 +1,234 @@ +interactions: +- request: + body: '{"TableName": "uttable74691147"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:40 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:40 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable74691147"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:39 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable74691147') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk74691147", "RowKey": "rk74691147", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:40 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:40 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable74691147 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable74691147/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A40.0164803Z''\"","PartitionKey":"pk74691147","RowKey":"rk74691147","Timestamp":"2020-07-30T14:24:40.0164803Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:39 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A40.0164803Z'" + location: + - https://storagename.table.core.windows.net/uttable74691147(PartitionKey='pk74691147',RowKey='rk74691147') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:41 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable74691147(PartitionKey='pk74691147',RowKey='rk74691147') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable74691147/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A40.0164803Z''\"","PartitionKey":"pk74691147","RowKey":"rk74691147","Timestamp":"2020-07-30T14:24:40.0164803Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:39 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A40.0164803Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:41 GMT + If-Match: + - W/"datetime'2020-07-30T14%3A24%3A40.0164803Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:41 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttable74691147(PartitionKey='pk74691147',RowKey='rk74691147') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:39 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:41 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable74691147') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:39 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_no_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_no_metadata.yaml new file mode 100644 index 000000000000..aeced10878b4 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_no_metadata.yaml @@ -0,0 +1,190 @@ +interactions: +- request: + body: '{"TableName": "uttableab3d1289"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:41 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttableab3d1289"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:40 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttableab3d1289') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkab3d1289", "RowKey": "rkab3d1289", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:41 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttableab3d1289 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableab3d1289/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A40.7237784Z''\"","PartitionKey":"pkab3d1289","RowKey":"rkab3d1289","Timestamp":"2020-07-30T14:24:40.7237784Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:40 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A40.7237784Z'" + location: + - https://storagename.table.core.windows.net/uttableab3d1289(PartitionKey='pkab3d1289',RowKey='rkab3d1289') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + accept: + - application/json;odata=nometadata + x-ms-date: + - Thu, 30 Jul 2020 14:24:41 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttableab3d1289(PartitionKey='pkab3d1289',RowKey='rkab3d1289') + response: + body: + string: '{"PartitionKey":"pkab3d1289","RowKey":"rkab3d1289","Timestamp":"2020-07-30T14:24:40.7237784Z","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":"933311100","Birthday":"1973-10-04T00:00:00Z","birthday":"1970-10-04T00:00:00Z","binary":"YmluYXJ5","other":20,"clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:40 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A40.7237784Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:41 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttableab3d1289') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:40 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_not_existing.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_not_existing.yaml new file mode 100644 index 000000000000..3df4716dcefd --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_not_existing.yaml @@ -0,0 +1,133 @@ +interactions: +- request: + body: '{"TableName": "uttablebf5d1327"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:41 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablebf5d1327"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:40 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablebf5d1327') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:42 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablebf5d1327(PartitionKey='pkbf5d1327',RowKey='rkbf5d1327') + response: + body: + string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:702f6a3a-6002-0059-267d-66ac7f000000\nTime:2020-07-30T14:24:41.3611094Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:40 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:42 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablebf5d1327') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:41 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_hook.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_hook.yaml new file mode 100644 index 000000000000..6350c814411e --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_hook.yaml @@ -0,0 +1,190 @@ +interactions: +- request: + body: '{"TableName": "uttable871e11d8"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:42 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable871e11d8"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:40 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable871e11d8') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk871e11d8", "RowKey": "rk871e11d8", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:42 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable871e11d8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable871e11d8/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A41.9261543Z''\"","PartitionKey":"pk871e11d8","RowKey":"rk871e11d8","Timestamp":"2020-07-30T14:24:41.9261543Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:40 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A41.9261543Z'" + location: + - https://storagename.table.core.windows.net/uttable871e11d8(PartitionKey='pk871e11d8',RowKey='rk871e11d8') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:42 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable871e11d8(PartitionKey='pk871e11d8',RowKey='rk871e11d8') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable871e11d8/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A41.9261543Z''\"","PartitionKey":"pk871e11d8","RowKey":"rk871e11d8","Timestamp":"2020-07-30T14:24:41.9261543Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:41 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A41.9261543Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:43 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable871e11d8') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:41 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml new file mode 100644 index 000000000000..31ede325cf04 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml @@ -0,0 +1,250 @@ +interactions: +- request: + body: '{"TableName": "uttableabfa12a7"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:09 GMT +======= + - Wed, 22 Jul 2020 15:51:05 GMT +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:09 GMT +======= + - Wed, 22 Jul 2020 15:51:05 GMT +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttableabfa12a7"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:09 GMT +======= + - Wed, 22 Jul 2020 15:51:04 GMT +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + location: + - https://storagename.table.core.windows.net/Tables('uttableabfa12a7') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkabfa12a7", "RowKey": "rkabfa12a7", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:10 GMT +======= + - Wed, 22 Jul 2020 15:51:05 GMT +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:10 GMT +======= + - Wed, 22 Jul 2020 15:51:05 GMT +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttableabfa12a7 + response: + body: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableabfa12a7/@Element","odata.etag":"W/\"datetime''2020-07-23T14%3A40%3A10.5120215Z''\"","PartitionKey":"pkabfa12a7","RowKey":"rkabfa12a7","Timestamp":"2020-07-23T14:40:10.5120215Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' +======= + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableabfa12a7/@Element","odata.etag":"W/\"datetime''2020-07-22T15%3A51%3A05.1113456Z''\"","PartitionKey":"pkabfa12a7","RowKey":"rkabfa12a7","Timestamp":"2020-07-22T15:51:05.1113456Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:09 GMT + etag: + - W/"datetime'2020-07-23T14%3A40%3A10.5120215Z'" +======= + - Wed, 22 Jul 2020 15:51:04 GMT + etag: + - W/"datetime'2020-07-22T15%3A51%3A05.1113456Z'" +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + location: + - https://storagename.table.core.windows.net/uttableabfa12a7(PartitionKey='pkabfa12a7',RowKey='rkabfa12a7') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:10 GMT +======= + - Wed, 22 Jul 2020 15:51:05 GMT +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:10 GMT +======= + - Wed, 22 Jul 2020 15:51:05 GMT +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttableabfa12a7(PartitionKey='pkabfa12a7',RowKey='rkabfa12a7')?$select=agesexxyz + response: + body: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableabfa12a7/@Element&$select=age,sex,xyz","odata.etag":"W/\"datetime''2020-07-23T14%3A40%3A10.5120215Z''\"","age@odata.type":"Edm.Int64","age":"39","sex":"male","xyz":null}' +======= + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableabfa12a7/@Element&$select=agesexxyz","odata.etag":"W/\"datetime''2020-07-22T15%3A51%3A05.1113456Z''\"","agesexxyz":null}' +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:10 GMT + etag: + - W/"datetime'2020-07-23T14%3A40%3A10.5120215Z'" +======= + - Wed, 22 Jul 2020 15:51:04 GMT + etag: + - W/"datetime'2020-07-22T15%3A51%3A05.1113456Z'" +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:10 GMT +======= + - Wed, 22 Jul 2020 15:51:05 GMT +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:10 GMT +======= + - Wed, 22 Jul 2020 15:51:05 GMT +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttableabfa12a7') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: +<<<<<<< HEAD:sdk/table/azure-table/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + - Thu, 23 Jul 2020 14:40:10 GMT +======= + - Wed, 22 Jul 2020 15:51:05 GMT +>>>>>>> 32dbb1125b174271baf26296ae51abef0bbcccfa:sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_select.yaml + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_special_doubles.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_special_doubles.yaml new file mode 100644 index 000000000000..90df53cf6712 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_with_special_doubles.yaml @@ -0,0 +1,186 @@ +interactions: +- request: + body: '{"TableName": "uttable65ff1655"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:43 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable65ff1655"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:42 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable65ff1655') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk65ff1655", "RowKey": "rk65ff1655", "inf": "Infinity", + "inf@odata.type": "Edm.Double", "negativeinf": "-Infinity", "negativeinf@odata.type": + "Edm.Double", "nan": "NaN", "nan@odata.type": "Edm.Double"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '219' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:43 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable65ff1655 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable65ff1655/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A42.5373861Z''\"","PartitionKey":"pk65ff1655","RowKey":"rk65ff1655","Timestamp":"2020-07-30T14:24:42.5373861Z","inf@odata.type":"Edm.Double","inf":"Infinity","negativeinf@odata.type":"Edm.Double","negativeinf":"-Infinity","nan@odata.type":"Edm.Double","nan":"NaN"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:42 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A42.5373861Z'" + location: + - https://storagename.table.core.windows.net/uttable65ff1655(PartitionKey='pk65ff1655',RowKey='rk65ff1655') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:43 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable65ff1655(PartitionKey='pk65ff1655',RowKey='rk65ff1655') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable65ff1655/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A42.5373861Z''\"","PartitionKey":"pk65ff1655","RowKey":"rk65ff1655","Timestamp":"2020-07-30T14:24:42.5373861Z","inf@odata.type":"Edm.Double","inf":"Infinity","negativeinf@odata.type":"Edm.Double","negativeinf":"-Infinity","nan@odata.type":"Edm.Double","nan":"NaN"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:42 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A42.5373861Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:43 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable65ff1655') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:42 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_conflict.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_conflict.yaml new file mode 100644 index 000000000000..9de878286c0a --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_conflict.yaml @@ -0,0 +1,199 @@ +interactions: +- request: + body: '{"TableName": "uttableace512b3"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:43 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttableace512b3"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:42 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttableace512b3') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkace512b3", "RowKey": "rkace512b3", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:44 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttableace512b3 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableace512b3/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A43.1800879Z''\"","PartitionKey":"pkace512b3","RowKey":"rkace512b3","Timestamp":"2020-07-30T14:24:43.1800879Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:42 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A43.1800879Z'" + location: + - https://storagename.table.core.windows.net/uttableace512b3(PartitionKey='pkace512b3',RowKey='rkace512b3') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkace512b3", "RowKey": "rkace512b3", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:44 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttableace512b3 + response: + body: + string: '{"odata.error":{"code":"EntityAlreadyExists","message":{"lang":"en-US","value":"The + specified entity already exists.\nRequestId:4e924949-5002-005a-0d7d-66af78000000\nTime:2020-07-30T14:24:43.2741543Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:42 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 409 + message: Conflict +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:44 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttableace512b3') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:42 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_dictionary.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_dictionary.yaml new file mode 100644 index 000000000000..14bbf10cad43 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_dictionary.yaml @@ -0,0 +1,146 @@ +interactions: +- request: + body: '{"TableName": "uttabled3851397"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:44 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttabled3851397"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:42 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttabled3851397') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkd3851397", "RowKey": "rkd3851397", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:44 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttabled3851397 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttabled3851397/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A43.813941Z''\"","PartitionKey":"pkd3851397","RowKey":"rkd3851397","Timestamp":"2020-07-30T14:24:43.813941Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:42 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A43.813941Z'" + location: + - https://storagename.table.core.windows.net/uttabled3851397(PartitionKey='pkd3851397',RowKey='rkd3851397') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:44 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttabled3851397') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:43 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_empty_string_pk.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_empty_string_pk.yaml new file mode 100644 index 000000000000..9bed2a6f5268 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_empty_string_pk.yaml @@ -0,0 +1,140 @@ +interactions: +- request: + body: '{"TableName": "uttable3d1615c0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:44 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable3d1615c0"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:44 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable3d1615c0') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"RowKey": "rk", "PartitionKey": ""}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:45 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:45 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable3d1615c0 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable3d1615c0/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A44.3589789Z''\"","PartitionKey":"","RowKey":"rk","Timestamp":"2020-07-30T14:24:44.3589789Z"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:44 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A44.3589789Z'" + location: + - https://storagename.table.core.windows.net/uttable3d1615c0(PartitionKey='',RowKey='rk') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:45 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:45 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable3d1615c0') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:44 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_empty_string_rk.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_empty_string_rk.yaml new file mode 100644 index 000000000000..4fd0064c8210 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_empty_string_rk.yaml @@ -0,0 +1,140 @@ +interactions: +- request: + body: '{"TableName": "uttable3d1a15c2"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:45 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:45 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable3d1a15c2"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:43 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable3d1a15c2') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk", "RowKey": ""}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:45 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:45 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable3d1a15c2 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable3d1a15c2/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A44.9268631Z''\"","PartitionKey":"pk","RowKey":"","Timestamp":"2020-07-30T14:24:44.9268631Z"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:44 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A44.9268631Z'" + location: + - https://storagename.table.core.windows.net/uttable3d1a15c2(PartitionKey='pk',RowKey='') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:45 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:45 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable3d1a15c2') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:44 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_missing_pk.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_missing_pk.yaml new file mode 100644 index 000000000000..39f025927c1b --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_missing_pk.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"TableName": "uttabled41f1395"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:46 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:46 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttabled41f1395"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:44 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttabled41f1395') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:46 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:46 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttabled41f1395') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:44 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_missing_rk.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_missing_rk.yaml new file mode 100644 index 000000000000..fa8888987f13 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_missing_rk.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"TableName": "uttabled4231397"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:46 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:46 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttabled4231397"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:45 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttabled4231397') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:46 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:46 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttabled4231397') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:45 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_property_name_too_long.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_property_name_too_long.yaml new file mode 100644 index 000000000000..e6a5e3a08f43 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_property_name_too_long.yaml @@ -0,0 +1,138 @@ +interactions: +- request: + body: '{"TableName": "uttablee10d18a6"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:46 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:46 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablee10d18a6"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:46 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablee10d18a6') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pke10d18a6", "RowKey": "rke10d18a6", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": + "badval"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '324' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:47 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:47 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablee10d18a6 + response: + body: + string: '{"odata.error":{"code":"PropertyNameTooLong","message":{"lang":"en-US","value":"The + property name exceeds the maximum allowed length (255).\nRequestId:4c2f74b7-b002-005b-357d-66ae85000000\nTime:2020-07-30T14:24:46.3911183Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:46 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:47 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:47 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablee10d18a6') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:46 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_too_many_properties.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_too_many_properties.yaml new file mode 100644 index 000000000000..bcf767aac948 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_too_many_properties.yaml @@ -0,0 +1,207 @@ +interactions: +- request: + body: '{"TableName": "uttable97d21773"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:47 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:47 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable97d21773"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:46 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable97d21773') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk97d21773", "RowKey": "rk97d21773", "key0": "value0", + "key1": "value1", "key2": "value2", "key3": "value3", "key4": "value4", "key5": + "value5", "key6": "value6", "key7": "value7", "key8": "value8", "key9": "value9", + "key10": "value10", "key11": "value11", "key12": "value12", "key13": "value13", + "key14": "value14", "key15": "value15", "key16": "value16", "key17": "value17", + "key18": "value18", "key19": "value19", "key20": "value20", "key21": "value21", + "key22": "value22", "key23": "value23", "key24": "value24", "key25": "value25", + "key26": "value26", "key27": "value27", "key28": "value28", "key29": "value29", + "key30": "value30", "key31": "value31", "key32": "value32", "key33": "value33", + "key34": "value34", "key35": "value35", "key36": "value36", "key37": "value37", + "key38": "value38", "key39": "value39", "key40": "value40", "key41": "value41", + "key42": "value42", "key43": "value43", "key44": "value44", "key45": "value45", + "key46": "value46", "key47": "value47", "key48": "value48", "key49": "value49", + "key50": "value50", "key51": "value51", "key52": "value52", "key53": "value53", + "key54": "value54", "key55": "value55", "key56": "value56", "key57": "value57", + "key58": "value58", "key59": "value59", "key60": "value60", "key61": "value61", + "key62": "value62", "key63": "value63", "key64": "value64", "key65": "value65", + "key66": "value66", "key67": "value67", "key68": "value68", "key69": "value69", + "key70": "value70", "key71": "value71", "key72": "value72", "key73": "value73", + "key74": "value74", "key75": "value75", "key76": "value76", "key77": "value77", + "key78": "value78", "key79": "value79", "key80": "value80", "key81": "value81", + "key82": "value82", "key83": "value83", "key84": "value84", "key85": "value85", + "key86": "value86", "key87": "value87", "key88": "value88", "key89": "value89", + "key90": "value90", "key91": "value91", "key92": "value92", "key93": "value93", + "key94": "value94", "key95": "value95", "key96": "value96", "key97": "value97", + "key98": "value98", "key99": "value99", "key100": "value100", "key101": "value101", + "key102": "value102", "key103": "value103", "key104": "value104", "key105": + "value105", "key106": "value106", "key107": "value107", "key108": "value108", + "key109": "value109", "key110": "value110", "key111": "value111", "key112": + "value112", "key113": "value113", "key114": "value114", "key115": "value115", + "key116": "value116", "key117": "value117", "key118": "value118", "key119": + "value119", "key120": "value120", "key121": "value121", "key122": "value122", + "key123": "value123", "key124": "value124", "key125": "value125", "key126": + "value126", "key127": "value127", "key128": "value128", "key129": "value129", + "key130": "value130", "key131": "value131", "key132": "value132", "key133": + "value133", "key134": "value134", "key135": "value135", "key136": "value136", + "key137": "value137", "key138": "value138", "key139": "value139", "key140": + "value140", "key141": "value141", "key142": "value142", "key143": "value143", + "key144": "value144", "key145": "value145", "key146": "value146", "key147": + "value147", "key148": "value148", "key149": "value149", "key150": "value150", + "key151": "value151", "key152": "value152", "key153": "value153", "key154": + "value154", "key155": "value155", "key156": "value156", "key157": "value157", + "key158": "value158", "key159": "value159", "key160": "value160", "key161": + "value161", "key162": "value162", "key163": "value163", "key164": "value164", + "key165": "value165", "key166": "value166", "key167": "value167", "key168": + "value168", "key169": "value169", "key170": "value170", "key171": "value171", + "key172": "value172", "key173": "value173", "key174": "value174", "key175": + "value175", "key176": "value176", "key177": "value177", "key178": "value178", + "key179": "value179", "key180": "value180", "key181": "value181", "key182": + "value182", "key183": "value183", "key184": "value184", "key185": "value185", + "key186": "value186", "key187": "value187", "key188": "value188", "key189": + "value189", "key190": "value190", "key191": "value191", "key192": "value192", + "key193": "value193", "key194": "value194", "key195": "value195", "key196": + "value196", "key197": "value197", "key198": "value198", "key199": "value199", + "key200": "value200", "key201": "value201", "key202": "value202", "key203": + "value203", "key204": "value204", "key205": "value205", "key206": "value206", + "key207": "value207", "key208": "value208", "key209": "value209", "key210": + "value210", "key211": "value211", "key212": "value212", "key213": "value213", + "key214": "value214", "key215": "value215", "key216": "value216", "key217": + "value217", "key218": "value218", "key219": "value219", "key220": "value220", + "key221": "value221", "key222": "value222", "key223": "value223", "key224": + "value224", "key225": "value225", "key226": "value226", "key227": "value227", + "key228": "value228", "key229": "value229", "key230": "value230", "key231": + "value231", "key232": "value232", "key233": "value233", "key234": "value234", + "key235": "value235", "key236": "value236", "key237": "value237", "key238": + "value238", "key239": "value239", "key240": "value240", "key241": "value241", + "key242": "value242", "key243": "value243", "key244": "value244", "key245": + "value245", "key246": "value246", "key247": "value247", "key248": "value248", + "key249": "value249", "key250": "value250", "key251": "value251", "key252": + "value252", "key253": "value253", "key254": "value254"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '5444' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:47 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:47 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable97d21773 + response: + body: + string: '{"odata.error":{"code":"TooManyProperties","message":{"lang":"en-US","value":"The + entity contains more properties than allowed. Each entity can include up to + 252 properties to store data. Each entity also has 3 system properties.\nRequestId:74988813-9002-0047-207d-667692000000\nTime:2020-07-30T14:24:46.9374438Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:46 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:47 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:47 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable97d21773') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:46 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_full_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_full_metadata.yaml new file mode 100644 index 000000000000..ce7a8eacf9cf --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_full_metadata.yaml @@ -0,0 +1,146 @@ +interactions: +- request: + body: '{"TableName": "uttable7f6816cf"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:48 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:48 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7f6816cf"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:46 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable7f6816cf') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk7f6816cf", "RowKey": "rk7f6816cf", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:48 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:48 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable7f6816cf + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable7f6816cf/@Element","odata.type":"storagename.uttable7f6816cf","odata.id":"https://storagename.table.core.windows.net/uttable7f6816cf(PartitionKey=''pk7f6816cf'',RowKey=''rk7f6816cf'')","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A47.4909784Z''\"","odata.editLink":"uttable7f6816cf(PartitionKey=''pk7f6816cf'',RowKey=''rk7f6816cf'')","PartitionKey":"pk7f6816cf","RowKey":"rk7f6816cf","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2020-07-30T14:24:47.4909784Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:46 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A47.4909784Z'" + location: + - https://storagename.table.core.windows.net/uttable7f6816cf(PartitionKey='pk7f6816cf',RowKey='rk7f6816cf') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:48 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:48 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable7f6816cf') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:47 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_hook.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_hook.yaml new file mode 100644 index 000000000000..75bec5ea8988 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_hook.yaml @@ -0,0 +1,146 @@ +interactions: +- request: + body: '{"TableName": "uttablec092132d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:48 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:48 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablec092132d"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:47 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablec092132d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkc092132d", "RowKey": "rkc092132d", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:49 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:49 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablec092132d + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablec092132d/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A48.0754342Z''\"","PartitionKey":"pkc092132d","RowKey":"rkc092132d","Timestamp":"2020-07-30T14:24:48.0754342Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:47 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A48.0754342Z'" + location: + - https://storagename.table.core.windows.net/uttablec092132d(PartitionKey='pkc092132d',RowKey='rkc092132d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:49 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:49 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablec092132d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:47 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_large_int32_value_throws.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_large_int32_value_throws.yaml new file mode 100644 index 000000000000..bcff74c22a4c --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_large_int32_value_throws.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"TableName": "uttable8fac1b18"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:49 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:49 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable8fac1b18"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:48 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable8fac1b18') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:49 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:49 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable8fac1b18') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:48 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_large_int64_value_throws.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_large_int64_value_throws.yaml new file mode 100644 index 000000000000..bd233ff2d3e6 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_large_int64_value_throws.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"TableName": "uttable8ff51b1d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:49 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:49 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable8ff51b1d"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:48 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable8ff51b1d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:50 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:50 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable8ff51b1d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:48 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_no_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_no_metadata.yaml new file mode 100644 index 000000000000..edb7b7fd2e84 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_entity_with_no_metadata.yaml @@ -0,0 +1,146 @@ +interactions: +- request: + body: '{"TableName": "uttable51fa15f9"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:50 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:50 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable51fa15f9"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:49 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable51fa15f9') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk51fa15f9", "RowKey": "rk51fa15f9", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=nometadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:50 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:50 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable51fa15f9 + response: + body: + string: '{"PartitionKey":"pk51fa15f9","RowKey":"rk51fa15f9","Timestamp":"2020-07-30T14:24:49.5291129Z","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":"933311100","Birthday":"1973-10-04T00:00:00Z","birthday":"1970-10-04T00:00:00Z","binary":"YmluYXJ5","other":20,"clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:49 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A49.5291129Z'" + location: + - https://storagename.table.core.windows.net/uttable51fa15f9(PartitionKey='pk51fa15f9',RowKey='rk51fa15f9') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:50 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:50 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable51fa15f9') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:49 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_etag.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_etag.yaml new file mode 100644 index 000000000000..a9327ff69d6d --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_etag.yaml @@ -0,0 +1,150 @@ +interactions: +- request: + body: '{"TableName": "uttablef5f40e06"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:50 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:50 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablef5f40e06"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:49 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablef5f40e06') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkf5f40e06", "RowKey": "rkf5f40e06", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:51 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:51 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablef5f40e06 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablef5f40e06/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A50.0795467Z''\"","PartitionKey":"pkf5f40e06","RowKey":"rkf5f40e06","Timestamp":"2020-07-30T14:24:50.0795467Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:49 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A50.0795467Z'" + location: + - https://storagename.table.core.windows.net/uttablef5f40e06(PartitionKey='pkf5f40e06',RowKey='rkf5f40e06') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:51 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:51 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablef5f40e06(PartitionKey='pkf5f40e06',RowKey='rkf5f40e06') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablef5f40e06/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A50.0795467Z''\"","PartitionKey":"pkf5f40e06","RowKey":"rkf5f40e06","Timestamp":"2020-07-30T14:24:50.0795467Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:50 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A50.0795467Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_merge_entity_with_existing_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_merge_entity_with_existing_entity.yaml new file mode 100644 index 000000000000..5ee3dba06871 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_merge_entity_with_existing_entity.yaml @@ -0,0 +1,238 @@ +interactions: +- request: + body: '{"TableName": "uttable95761b92"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:51 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:51 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable95761b92"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:50 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable95761b92') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk95761b92", "RowKey": "rk95761b92", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:51 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:51 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable95761b92 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable95761b92/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A50.6145306Z''\"","PartitionKey":"pk95761b92","RowKey":"rk95761b92","Timestamp":"2020-07-30T14:24:50.6145306Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:50 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A50.6145306Z'" + location: + - https://storagename.table.core.windows.net/uttable95761b92(PartitionKey='pk95761b92',RowKey='rk95761b92') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk95761b92", "RowKey": "rk95761b92", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:51 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:51 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable95761b92(PartitionKey='pk95761b92',RowKey='rk95761b92') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:50 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A50.7009442Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:51 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:51 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable95761b92(PartitionKey='pk95761b92',RowKey='rk95761b92') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable95761b92/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A50.7009442Z''\"","PartitionKey":"pk95761b92","RowKey":"rk95761b92","Timestamp":"2020-07-30T14:24:50.7009442Z","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","age":"abc","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","deceased":false,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","married":true,"other":20,"ratio":3.1,"sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:50 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A50.7009442Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:51 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:51 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable95761b92') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:50 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_merge_entity_with_non_existing_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_merge_entity_with_non_existing_entity.yaml new file mode 100644 index 000000000000..52b1d8b3b0a3 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_merge_entity_with_non_existing_entity.yaml @@ -0,0 +1,182 @@ +interactions: +- request: + body: '{"TableName": "uttable7671d3c"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '31' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:51 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:51 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7671d3c"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:50 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable7671d3c') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk7671d3c", "RowKey": "rk7671d3c", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '178' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:52 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:52 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable7671d3c(PartitionKey='pk7671d3c',RowKey='rk7671d3c') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:50 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A51.3754209Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:52 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:52 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable7671d3c(PartitionKey='pk7671d3c',RowKey='rk7671d3c') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable7671d3c/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A51.3754209Z''\"","PartitionKey":"pk7671d3c","RowKey":"rk7671d3c","Timestamp":"2020-07-30T14:24:51.3754209Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:50 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A51.3754209Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:52 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:52 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable7671d3c') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:50 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_replace_entity_with_existing_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_replace_entity_with_existing_entity.yaml new file mode 100644 index 000000000000..6f34af815e19 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_replace_entity_with_existing_entity.yaml @@ -0,0 +1,238 @@ +interactions: +- request: + body: '{"TableName": "uttablecc7c1c5e"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:52 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:52 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablecc7c1c5e"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:51 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablecc7c1c5e') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkcc7c1c5e", "RowKey": "rkcc7c1c5e", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:52 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:52 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablecc7c1c5e + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablecc7c1c5e/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A51.9816094Z''\"","PartitionKey":"pkcc7c1c5e","RowKey":"rkcc7c1c5e","Timestamp":"2020-07-30T14:24:51.9816094Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:51 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A51.9816094Z'" + location: + - https://storagename.table.core.windows.net/uttablecc7c1c5e(PartitionKey='pkcc7c1c5e',RowKey='rkcc7c1c5e') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkcc7c1c5e", "RowKey": "rkcc7c1c5e", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:53 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:53 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttablecc7c1c5e(PartitionKey='pkcc7c1c5e',RowKey='rkcc7c1c5e') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:51 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A52.0689108Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:53 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:53 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablecc7c1c5e(PartitionKey='pkcc7c1c5e',RowKey='rkcc7c1c5e') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablecc7c1c5e/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A52.0689108Z''\"","PartitionKey":"pkcc7c1c5e","RowKey":"rkcc7c1c5e","Timestamp":"2020-07-30T14:24:52.0689108Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:51 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A52.0689108Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:53 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:53 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablecc7c1c5e') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:51 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_replace_entity_with_non_existing_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_replace_entity_with_non_existing_entity.yaml new file mode 100644 index 000000000000..e10757f57cbb --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_insert_or_replace_entity_with_non_existing_entity.yaml @@ -0,0 +1,182 @@ +interactions: +- request: + body: '{"TableName": "uttable419d1e08"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:53 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:53 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable419d1e08"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:52 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable419d1e08') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk419d1e08", "RowKey": "rk419d1e08", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:53 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:53 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttable419d1e08(PartitionKey='pk419d1e08',RowKey='rk419d1e08') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:52 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A52.7533942Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:53 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:53 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable419d1e08(PartitionKey='pk419d1e08',RowKey='rk419d1e08') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable419d1e08/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A52.7533942Z''\"","PartitionKey":"pk419d1e08","RowKey":"rk419d1e08","Timestamp":"2020-07-30T14:24:52.7533942Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:52 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A52.7533942Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:53 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:53 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable419d1e08') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:52 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity.yaml new file mode 100644 index 000000000000..648d07dc0210 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity.yaml @@ -0,0 +1,240 @@ +interactions: +- request: + body: '{"TableName": "uttable3df0e7d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '31' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:53 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:53 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable3df0e7d"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:53 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable3df0e7d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk3df0e7d", "RowKey": "rk3df0e7d", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '535' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:54 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:54 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable3df0e7d + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable3df0e7d/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A53.3764814Z''\"","PartitionKey":"pk3df0e7d","RowKey":"rk3df0e7d","Timestamp":"2020-07-30T14:24:53.3764814Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:53 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A53.3764814Z'" + location: + - https://storagename.table.core.windows.net/uttable3df0e7d(PartitionKey='pk3df0e7d',RowKey='rk3df0e7d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk3df0e7d", "RowKey": "rk3df0e7d", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '178' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:54 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:54 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable3df0e7d(PartitionKey='pk3df0e7d',RowKey='rk3df0e7d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:53 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A53.472903Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:54 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:54 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable3df0e7d(PartitionKey='pk3df0e7d',RowKey='rk3df0e7d') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable3df0e7d/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A53.472903Z''\"","PartitionKey":"pk3df0e7d","RowKey":"rk3df0e7d","Timestamp":"2020-07-30T14:24:53.472903Z","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","age":"abc","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","deceased":false,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","married":true,"other":20,"ratio":3.1,"sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:53 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A53.472903Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:54 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:54 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable3df0e7d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:53 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_not_existing.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_not_existing.yaml new file mode 100644 index 000000000000..c4c0d07e89a1 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_not_existing.yaml @@ -0,0 +1,145 @@ +interactions: +- request: + body: '{"TableName": "uttablee64a13f7"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:54 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:54 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablee64a13f7"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:53 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablee64a13f7') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pke64a13f7", "RowKey": "rke64a13f7", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:55 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:55 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttablee64a13f7(PartitionKey='pke64a13f7',RowKey='rke64a13f7') + response: + body: + string: 'ResourceNotFoundThe specified resource does not exist. + + RequestId:f68387d3-2002-005e-187d-665afa000000 + + Time:2020-07-30T14:24:54.1053791Z' + headers: + cache-control: + - no-cache + content-type: + - application/xml;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:53 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:55 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:55 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablee64a13f7') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:53 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_with_if_doesnt_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_with_if_doesnt_match.yaml new file mode 100644 index 000000000000..cb0cecb749e4 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_with_if_doesnt_match.yaml @@ -0,0 +1,201 @@ +interactions: +- request: + body: '{"TableName": "uttable9316171e"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:55 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:55 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable9316171e"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:54 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable9316171e') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk9316171e", "RowKey": "rk9316171e", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:55 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:55 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable9316171e + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable9316171e/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A54.6804392Z''\"","PartitionKey":"pk9316171e","RowKey":"rk9316171e","Timestamp":"2020-07-30T14:24:54.6804392Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:54 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A54.6804392Z'" + location: + - https://storagename.table.core.windows.net/uttable9316171e(PartitionKey='pk9316171e',RowKey='rk9316171e') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk9316171e", "RowKey": "rk9316171e", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:55 GMT + If-Match: + - W/"datetime'2012-06-15T22%3A51%3A44.9662825Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:55 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable9316171e(PartitionKey='pk9316171e',RowKey='rk9316171e') + response: + body: + string: 'UpdateConditionNotSatisfiedThe update condition specified in the request was not satisfied. + + RequestId:9f1812d1-3002-004a-537d-66999e000000 + + Time:2020-07-30T14:24:54.7644978Z' + headers: + cache-control: + - no-cache + content-type: + - application/xml;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:54 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 412 + message: Precondition Failed +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:55 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:55 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable9316171e') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:54 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_with_if_matches.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_with_if_matches.yaml new file mode 100644 index 000000000000..9521b0437825 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_merge_entity_with_if_matches.yaml @@ -0,0 +1,240 @@ +interactions: +- request: + body: '{"TableName": "uttable236c150a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:55 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:55 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable236c150a"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:55 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable236c150a') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk236c150a", "RowKey": "rk236c150a", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:56 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:56 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable236c150a + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable236c150a/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A55.315605Z''\"","PartitionKey":"pk236c150a","RowKey":"rk236c150a","Timestamp":"2020-07-30T14:24:55.315605Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:55 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A55.315605Z'" + location: + - https://storagename.table.core.windows.net/uttable236c150a(PartitionKey='pk236c150a',RowKey='rk236c150a') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk236c150a", "RowKey": "rk236c150a", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:56 GMT + If-Match: + - W/"datetime'2020-07-30T14%3A24%3A55.315605Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:56 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable236c150a(PartitionKey='pk236c150a',RowKey='rk236c150a') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:55 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A55.4002652Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:56 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:56 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable236c150a(PartitionKey='pk236c150a',RowKey='rk236c150a') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable236c150a/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A55.4002652Z''\"","PartitionKey":"pk236c150a","RowKey":"rk236c150a","Timestamp":"2020-07-30T14:24:55.4002652Z","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","age":"abc","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","deceased":false,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","married":true,"other":20,"ratio":3.1,"sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:55 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A55.4002652Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:56 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:56 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable236c150a') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:55 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_none_property_value.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_none_property_value.yaml new file mode 100644 index 000000000000..77cea668a83e --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_none_property_value.yaml @@ -0,0 +1,184 @@ +interactions: +- request: + body: '{"TableName": "uttable76561181"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:56 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:56 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable76561181"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:54 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable76561181') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk76561181", "RowKey": "rk76561181"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '54' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:57 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:57 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable76561181 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable76561181/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A56.0435707Z''\"","PartitionKey":"pk76561181","RowKey":"rk76561181","Timestamp":"2020-07-30T14:24:56.0435707Z"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:55 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A56.0435707Z'" + location: + - https://storagename.table.core.windows.net/uttable76561181(PartitionKey='pk76561181',RowKey='rk76561181') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:57 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:57 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable76561181(PartitionKey='pk76561181',RowKey='rk76561181') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable76561181/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A56.0435707Z''\"","PartitionKey":"pk76561181","RowKey":"rk76561181","Timestamp":"2020-07-30T14:24:56.0435707Z"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:55 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A56.0435707Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:57 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:57 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable76561181') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:55 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_operations_on_entity_with_partition_key_having_single_quote.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_operations_on_entity_with_partition_key_having_single_quote.yaml new file mode 100644 index 000000000000..d19c247f7358 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_operations_on_entity_with_partition_key_having_single_quote.yaml @@ -0,0 +1,376 @@ +interactions: +- request: + body: '{"TableName": "uttable88682233"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:57 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:57 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable88682233"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:56 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable88682233') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "a''''''''b", "RowKey": "a''''''''b", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '529' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:57 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:57 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable88682233 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable88682233/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A56.6959097Z''\"","PartitionKey":"a''''''''b","RowKey":"a''''''''b","Timestamp":"2020-07-30T14:24:56.6959097Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:56 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A56.6959097Z'" + location: + - https://storagename.table.core.windows.net/uttable88682233(PartitionKey='a''''''''b',RowKey='a''''''''b') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "a''''''''b", "RowKey": "a''''''''b", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '172' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:57 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:57 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable88682233(PartitionKey='a%27%27%27%27b',RowKey='a%27%27%27%27b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:56 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A56.7922489Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:57 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:57 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable88682233(PartitionKey='a%27%27%27%27b',RowKey='a%27%27%27%27b') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable88682233/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A56.7922489Z''\"","PartitionKey":"a''''b","RowKey":"a''''b","Timestamp":"2020-07-30T14:24:56.7922489Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:56 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A56.7922489Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: '{"PartitionKey": "a''''''''b", "RowKey": "a''''''''b", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime", "newField": "newFieldValue"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '201' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:57 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:57 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable88682233(PartitionKey='a%27%27%27%27b',RowKey='a%27%27%27%27b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:56 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A56.9733775Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:58 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:58 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable88682233(PartitionKey='a%27%27%27%27b',RowKey='a%27%27%27%27b') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable88682233/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A56.9733775Z''\"","PartitionKey":"a''''b","RowKey":"a''''b","Timestamp":"2020-07-30T14:24:56.9733775Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","newField":"newFieldValue","sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:56 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A56.9733775Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:58 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:58 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttable88682233(PartitionKey='a%27%27%27%27b',RowKey='a%27%27%27%27b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:56 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:58 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:58 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable88682233') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:57 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities.yaml new file mode 100644 index 000000000000..4e5f6e3fd8b1 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities.yaml @@ -0,0 +1,332 @@ +interactions: +- request: + body: '{"TableName": "uttable23930f6b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:58 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:58 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable23930f6b"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:56 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable23930f6b') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "querytable23930f6b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:58 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:58 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytable23930f6b"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:56 GMT + location: + - https://storagename.table.core.windows.net/Tables('querytable23930f6b') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk23930f6b", "RowKey": "rk23930f6b1", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:58 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:58 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable23930f6b + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable23930f6b/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A57.7802038Z''\"","PartitionKey":"pk23930f6b","RowKey":"rk23930f6b1","Timestamp":"2020-07-30T14:24:57.7802038Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:56 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A57.7802038Z'" + location: + - https://storagename.table.core.windows.net/querytable23930f6b(PartitionKey='pk23930f6b',RowKey='rk23930f6b1') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk23930f6b", "RowKey": "rk23930f6b12", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:58 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:58 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable23930f6b + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable23930f6b/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A57.8612602Z''\"","PartitionKey":"pk23930f6b","RowKey":"rk23930f6b12","Timestamp":"2020-07-30T14:24:57.8612602Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:56 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A57.8612602Z'" + location: + - https://storagename.table.core.windows.net/querytable23930f6b(PartitionKey='pk23930f6b',RowKey='rk23930f6b12') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:58 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:58 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable23930f6b() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable23930f6b","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A57.7802038Z''\"","PartitionKey":"pk23930f6b","RowKey":"rk23930f6b1","Timestamp":"2020-07-30T14:24:57.7802038Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A57.8612602Z''\"","PartitionKey":"pk23930f6b","RowKey":"rk23930f6b12","Timestamp":"2020-07-30T14:24:57.8612602Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:57 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:59 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:59 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable23930f6b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:57 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:59 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:59 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytable23930f6b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:57 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_full_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_full_metadata.yaml new file mode 100644 index 000000000000..e7e6c815aa16 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_full_metadata.yaml @@ -0,0 +1,332 @@ +interactions: +- request: + body: '{"TableName": "uttable264f151d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:59 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:59 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable264f151d"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:58 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable264f151d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "querytable264f151d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:59 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:59 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytable264f151d"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:58 GMT + location: + - https://storagename.table.core.windows.net/Tables('querytable264f151d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk264f151d", "RowKey": "rk264f151d1", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:59 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:59 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable264f151d + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable264f151d/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A58.6636662Z''\"","PartitionKey":"pk264f151d","RowKey":"rk264f151d1","Timestamp":"2020-07-30T14:24:58.6636662Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:58 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A58.6636662Z'" + location: + - https://storagename.table.core.windows.net/querytable264f151d(PartitionKey='pk264f151d',RowKey='rk264f151d1') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk264f151d", "RowKey": "rk264f151d12", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:59 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:59 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable264f151d + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable264f151d/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A58.746726Z''\"","PartitionKey":"pk264f151d","RowKey":"rk264f151d12","Timestamp":"2020-07-30T14:24:58.746726Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:58 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A58.746726Z'" + location: + - https://storagename.table.core.windows.net/querytable264f151d(PartitionKey='pk264f151d',RowKey='rk264f151d12') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:24:59 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + accept: + - application/json;odata=fullmetadata + x-ms-date: + - Thu, 30 Jul 2020 14:24:59 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable264f151d() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable264f151d","value":[{"odata.type":"storagename.querytable264f151d","odata.id":"https://storagename.table.core.windows.net/querytable264f151d(PartitionKey=''pk264f151d'',RowKey=''rk264f151d1'')","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A58.6636662Z''\"","odata.editLink":"querytable264f151d(PartitionKey=''pk264f151d'',RowKey=''rk264f151d1'')","PartitionKey":"pk264f151d","RowKey":"rk264f151d1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2020-07-30T14:24:58.6636662Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"odata.type":"storagename.querytable264f151d","odata.id":"https://storagename.table.core.windows.net/querytable264f151d(PartitionKey=''pk264f151d'',RowKey=''rk264f151d12'')","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A58.746726Z''\"","odata.editLink":"querytable264f151d(PartitionKey=''pk264f151d'',RowKey=''rk264f151d12'')","PartitionKey":"pk264f151d","RowKey":"rk264f151d12","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2020-07-30T14:24:58.746726Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:58 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:59 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:59 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable264f151d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:58 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:24:59 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:24:59 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytable264f151d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:58 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_no_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_no_metadata.yaml new file mode 100644 index 000000000000..9f2fd09f46d3 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_no_metadata.yaml @@ -0,0 +1,332 @@ +interactions: +- request: + body: '{"TableName": "uttablefc361447"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:00 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:00 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablefc361447"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:58 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablefc361447') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "querytablefc361447"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:00 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:00 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytablefc361447"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:58 GMT + location: + - https://storagename.table.core.windows.net/Tables('querytablefc361447') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkfc361447", "RowKey": "rkfc3614471", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:00 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:00 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytablefc361447 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytablefc361447/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A59.5774073Z''\"","PartitionKey":"pkfc361447","RowKey":"rkfc3614471","Timestamp":"2020-07-30T14:24:59.5774073Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:58 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A59.5774073Z'" + location: + - https://storagename.table.core.windows.net/querytablefc361447(PartitionKey='pkfc361447',RowKey='rkfc3614471') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkfc361447", "RowKey": "rkfc36144712", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:00 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:00 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytablefc361447 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytablefc361447/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A24%3A59.6594639Z''\"","PartitionKey":"pkfc361447","RowKey":"rkfc36144712","Timestamp":"2020-07-30T14:24:59.6594639Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:58 GMT + etag: + - W/"datetime'2020-07-30T14%3A24%3A59.6594639Z'" + location: + - https://storagename.table.core.windows.net/querytablefc361447(PartitionKey='pkfc361447',RowKey='rkfc36144712') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:00 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + accept: + - application/json;odata=nometadata + x-ms-date: + - Thu, 30 Jul 2020 14:25:00 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytablefc361447() + response: + body: + string: '{"value":[{"PartitionKey":"pkfc361447","RowKey":"rkfc3614471","Timestamp":"2020-07-30T14:24:59.5774073Z","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":"933311100","Birthday":"1973-10-04T00:00:00Z","birthday":"1970-10-04T00:00:00Z","binary":"YmluYXJ5","other":20,"clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"PartitionKey":"pkfc361447","RowKey":"rkfc36144712","Timestamp":"2020-07-30T14:24:59.6594639Z","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":"933311100","Birthday":"1973-10-04T00:00:00Z","birthday":"1970-10-04T00:00:00Z","binary":"YmluYXJ5","other":20,"clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:58 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:00 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:00 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablefc361447') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:58 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:00 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:00 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytablefc361447') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:24:58 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_filter.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_filter.yaml new file mode 100644 index 000000000000..41550d407e7f --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_filter.yaml @@ -0,0 +1,188 @@ +interactions: +- request: + body: '{"TableName": "uttablefce8146b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:01 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:01 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablefce8146b"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:59 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablefce8146b') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkfce8146b", "RowKey": "rkfce8146b", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:01 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:01 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablefce8146b + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablefce8146b/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A00.3672487Z''\"","PartitionKey":"pkfce8146b","RowKey":"rkfce8146b","Timestamp":"2020-07-30T14:25:00.3672487Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:59 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A00.3672487Z'" + location: + - https://storagename.table.core.windows.net/uttablefce8146b(PartitionKey='pkfce8146b',RowKey='rkfce8146b') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:01 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:01 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablefce8146b() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablefce8146b","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A00.3672487Z''\"","PartitionKey":"pkfce8146b","RowKey":"rkfce8146b","Timestamp":"2020-07-30T14:25:00.3672487Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:24:59 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:01 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:01 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablefce8146b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:00 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_select.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_select.yaml new file mode 100644 index 000000000000..dd49e745767a --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_select.yaml @@ -0,0 +1,332 @@ +interactions: +- request: + body: '{"TableName": "uttablefcf31465"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:01 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:01 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablefcf31465"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:00 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablefcf31465') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "querytablefcf31465"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:01 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:01 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytablefcf31465"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:00 GMT + location: + - https://storagename.table.core.windows.net/Tables('querytablefcf31465') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkfcf31465", "RowKey": "rkfcf314651", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:02 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytablefcf31465 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytablefcf31465/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A01.0987797Z''\"","PartitionKey":"pkfcf31465","RowKey":"rkfcf314651","Timestamp":"2020-07-30T14:25:01.0987797Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:00 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A01.0987797Z'" + location: + - https://storagename.table.core.windows.net/querytablefcf31465(PartitionKey='pkfcf31465',RowKey='rkfcf314651') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkfcf31465", "RowKey": "rkfcf3146512", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:02 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytablefcf31465 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytablefcf31465/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A01.1808356Z''\"","PartitionKey":"pkfcf31465","RowKey":"rkfcf3146512","Timestamp":"2020-07-30T14:25:01.1808356Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:00 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A01.1808356Z'" + location: + - https://storagename.table.core.windows.net/querytablefcf31465(PartitionKey='pkfcf31465',RowKey='rkfcf3146512') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:02 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytablefcf31465()?$select=age%2C%20sex + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytablefcf31465&$select=age,%20sex","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A01.0987797Z''\"","age@odata.type":"Edm.Int64","age":"39","sex":"male"},{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A01.1808356Z''\"","age@odata.type":"Edm.Int64","age":"39","sex":"male"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:00 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:02 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablefcf31465') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:01 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:02 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytablefcf31465') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:01 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_top.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_top.yaml new file mode 100644 index 000000000000..40d595f1f4e9 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_top.yaml @@ -0,0 +1,392 @@ +interactions: +- request: + body: '{"TableName": "uttablec12a1338"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:02 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablec12a1338"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:00 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablec12a1338') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "querytablec12a1338"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:02 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytablec12a1338"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:00 GMT + location: + - https://storagename.table.core.windows.net/Tables('querytablec12a1338') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkc12a1338", "RowKey": "rkc12a13381", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:02 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytablec12a1338 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytablec12a1338/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A01.9958858Z''\"","PartitionKey":"pkc12a1338","RowKey":"rkc12a13381","Timestamp":"2020-07-30T14:25:01.9958858Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:01 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A01.9958858Z'" + location: + - https://storagename.table.core.windows.net/querytablec12a1338(PartitionKey='pkc12a1338',RowKey='rkc12a13381') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkc12a1338", "RowKey": "rkc12a133812", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:03 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:03 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytablec12a1338 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytablec12a1338/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A02.078943Z''\"","PartitionKey":"pkc12a1338","RowKey":"rkc12a133812","Timestamp":"2020-07-30T14:25:02.078943Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:01 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A02.078943Z'" + location: + - https://storagename.table.core.windows.net/querytablec12a1338(PartitionKey='pkc12a1338',RowKey='rkc12a133812') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkc12a1338", "RowKey": "rkc12a1338123", "age": "39", + "age@odata.type": "Edm.Int64", "sex": "male", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", + "Birthday": "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": + "1970-10-04T00:00:00Z", "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", + "binary@odata.type": "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '540' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:03 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:03 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytablec12a1338 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytablec12a1338/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A02.1620006Z''\"","PartitionKey":"pkc12a1338","RowKey":"rkc12a1338123","Timestamp":"2020-07-30T14:25:02.1620006Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:01 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A02.1620006Z'" + location: + - https://storagename.table.core.windows.net/querytablec12a1338(PartitionKey='pkc12a1338',RowKey='rkc12a1338123') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:03 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:03 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytablec12a1338()?$top=2 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytablec12a1338","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A01.9958858Z''\"","PartitionKey":"pkc12a1338","RowKey":"rkc12a13381","Timestamp":"2020-07-30T14:25:01.9958858Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A02.078943Z''\"","PartitionKey":"pkc12a1338","RowKey":"rkc12a133812","Timestamp":"2020-07-30T14:25:02.078943Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:01 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-continuation-nextpartitionkey: + - 1!16!cGtjMTJhMTMzOA-- + x-ms-continuation-nextrowkey: + - 1!20!cmtjMTJhMTMzODEyMw-- + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:03 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:03 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablec12a1338') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:01 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:03 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:03 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytablec12a1338') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:01 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_top_and_next.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_top_and_next.yaml new file mode 100644 index 000000000000..80a534233671 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_entities_with_top_and_next.yaml @@ -0,0 +1,592 @@ +interactions: +- request: + body: '{"TableName": "uttable801016e8"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:03 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:03 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable801016e8"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:02 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable801016e8') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "querytable801016e8"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:03 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:03 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytable801016e8"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:02 GMT + location: + - https://storagename.table.core.windows.net/Tables('querytable801016e8') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk801016e8", "RowKey": "rk801016e81", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:03 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:03 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable801016e8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable801016e8/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A03.0268879Z''\"","PartitionKey":"pk801016e8","RowKey":"rk801016e81","Timestamp":"2020-07-30T14:25:03.0268879Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:02 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A03.0268879Z'" + location: + - https://storagename.table.core.windows.net/querytable801016e8(PartitionKey='pk801016e8',RowKey='rk801016e81') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk801016e8", "RowKey": "rk801016e812", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:04 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:04 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable801016e8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable801016e8/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A03.1149487Z''\"","PartitionKey":"pk801016e8","RowKey":"rk801016e812","Timestamp":"2020-07-30T14:25:03.1149487Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:02 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A03.1149487Z'" + location: + - https://storagename.table.core.windows.net/querytable801016e8(PartitionKey='pk801016e8',RowKey='rk801016e812') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk801016e8", "RowKey": "rk801016e8123", "age": "39", + "age@odata.type": "Edm.Int64", "sex": "male", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", + "Birthday": "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": + "1970-10-04T00:00:00Z", "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", + "binary@odata.type": "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '540' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:04 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:04 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable801016e8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable801016e8/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A03.2050103Z''\"","PartitionKey":"pk801016e8","RowKey":"rk801016e8123","Timestamp":"2020-07-30T14:25:03.2050103Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:02 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A03.2050103Z'" + location: + - https://storagename.table.core.windows.net/querytable801016e8(PartitionKey='pk801016e8',RowKey='rk801016e8123') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk801016e8", "RowKey": "rk801016e81234", "age": "39", + "age@odata.type": "Edm.Int64", "sex": "male", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", + "Birthday": "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": + "1970-10-04T00:00:00Z", "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", + "binary@odata.type": "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '541' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:04 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:04 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable801016e8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable801016e8/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A03.2880679Z''\"","PartitionKey":"pk801016e8","RowKey":"rk801016e81234","Timestamp":"2020-07-30T14:25:03.2880679Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:03 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A03.2880679Z'" + location: + - https://storagename.table.core.windows.net/querytable801016e8(PartitionKey='pk801016e8',RowKey='rk801016e81234') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk801016e8", "RowKey": "rk801016e812345", "age": "39", + "age@odata.type": "Edm.Int64", "sex": "male", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", + "Birthday": "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": + "1970-10-04T00:00:00Z", "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", + "binary@odata.type": "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '542' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:04 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:04 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable801016e8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable801016e8/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A03.37713Z''\"","PartitionKey":"pk801016e8","RowKey":"rk801016e812345","Timestamp":"2020-07-30T14:25:03.37713Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:03 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A03.37713Z'" + location: + - https://storagename.table.core.windows.net/querytable801016e8(PartitionKey='pk801016e8',RowKey='rk801016e812345') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:04 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:04 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable801016e8()?$top=2 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable801016e8","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A03.0268879Z''\"","PartitionKey":"pk801016e8","RowKey":"rk801016e81","Timestamp":"2020-07-30T14:25:03.0268879Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A03.1149487Z''\"","PartitionKey":"pk801016e8","RowKey":"rk801016e812","Timestamp":"2020-07-30T14:25:03.1149487Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:03 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-continuation-nextpartitionkey: + - 1!16!cGs4MDEwMTZlOA-- + x-ms-continuation-nextrowkey: + - 1!20!cms4MDEwMTZlODEyMw-- + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:04 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:04 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable801016e8()?$top=2&NextPartitionKey=1%2116%21cGs4MDEwMTZlOA--&NextRowKey=1%2120%21cms4MDEwMTZlODEyMw-- + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable801016e8","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A03.2050103Z''\"","PartitionKey":"pk801016e8","RowKey":"rk801016e8123","Timestamp":"2020-07-30T14:25:03.2050103Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A03.2880679Z''\"","PartitionKey":"pk801016e8","RowKey":"rk801016e81234","Timestamp":"2020-07-30T14:25:03.2880679Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:03 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-continuation-nextpartitionkey: + - 1!16!cGs4MDEwMTZlOA-- + x-ms-continuation-nextrowkey: + - 1!20!cms4MDEwMTZlODEyMzQ1 + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:04 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:04 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable801016e8()?$top=2&NextPartitionKey=1%2116%21cGs4MDEwMTZlOA--&NextRowKey=1%2120%21cms4MDEwMTZlODEyMzQ1 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable801016e8","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A03.37713Z''\"","PartitionKey":"pk801016e8","RowKey":"rk801016e812345","Timestamp":"2020-07-30T14:25:03.37713Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:03 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:04 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:04 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable801016e8') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:03 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:04 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:04 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytable801016e8') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:03 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_user_filter.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_user_filter.yaml new file mode 100644 index 000000000000..fbdc0cb13d7f --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_user_filter.yaml @@ -0,0 +1,146 @@ +interactions: +- request: + body: '{"TableName": "uttable546210aa"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:04 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:04 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable546210aa"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:03 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable546210aa') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk546210aa", "RowKey": "rk546210aa", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:05 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:05 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable546210aa + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable546210aa/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A04.3123943Z''\"","PartitionKey":"pk546210aa","RowKey":"rk546210aa","Timestamp":"2020-07-30T14:25:04.3123943Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:03 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A04.3123943Z'" + location: + - https://storagename.table.core.windows.net/uttable546210aa(PartitionKey='pk546210aa',RowKey='rk546210aa') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:05 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:05 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable546210aa') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:03 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_zero_entities.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_zero_entities.yaml new file mode 100644 index 000000000000..df02d5f78c5e --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_query_zero_entities.yaml @@ -0,0 +1,220 @@ +interactions: +- request: + body: '{"TableName": "uttable7732118a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:05 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:05 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7732118a"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:04 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable7732118a') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"TableName": "querytable7732118a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:05 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:05 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytable7732118a"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:04 GMT + location: + - https://storagename.table.core.windows.net/Tables('querytable7732118a') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:05 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:05 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable7732118a() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable7732118a","value":[]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:04 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:06 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:06 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable7732118a') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:04 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:06 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:06 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytable7732118a') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:04 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add.yaml new file mode 100644 index 000000000000..27f94ab56ad1 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add.yaml @@ -0,0 +1,190 @@ +interactions: +- request: + body: '{"TableName": "uttablebfd90c40"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:06 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:06 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablebfd90c40"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:04 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablebfd90c40') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkbfd90c40", "RowKey": "rkbfd90c40", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:06 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:06 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablebfd90c40?st=2020-07-30T14%3A24%3A06Z&se=2020-07-30T15%3A25%3A06Z&sp=a&sv=2019-07-07&tn=uttablebfd90c40&sig=fXD4tI6Ue%2BNF%2F90e81hMVWjUVL7IJ4zZi0oKy4DRJkg%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablebfd90c40/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A05.9288095Z''\"","PartitionKey":"pkbfd90c40","RowKey":"rkbfd90c40","Timestamp":"2020-07-30T14:25:05.9288095Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:05 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A05.9288095Z'" + location: + - https://storagename.table.core.windows.net/uttablebfd90c40(PartitionKey='pkbfd90c40',RowKey='rkbfd90c40') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:06 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:06 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablebfd90c40(PartitionKey='pkbfd90c40',RowKey='rkbfd90c40') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablebfd90c40/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A05.9288095Z''\"","PartitionKey":"pkbfd90c40","RowKey":"rkbfd90c40","Timestamp":"2020-07-30T14:25:05.9288095Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:05 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A05.9288095Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:07 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:07 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablebfd90c40') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:05 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add_inside_range.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add_inside_range.yaml new file mode 100644 index 000000000000..7a83eed91406 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add_inside_range.yaml @@ -0,0 +1,190 @@ +interactions: +- request: + body: '{"TableName": "uttable84281187"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:07 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:07 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable84281187"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:05 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable84281187') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "test", "RowKey": "test1", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '526' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:07 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:07 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable84281187?se=2020-07-30T15%3A25%3A07Z&sp=a&sv=2019-07-07&tn=uttable84281187&spk=test&srk=test1&epk=test&erk=test1&sig=S2LAuFVQfomgXS986%2B%2FHTujEcgJd9vd1gsNXXHKC4yc%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable84281187/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A06.8043504Z''\"","PartitionKey":"test","RowKey":"test1","Timestamp":"2020-07-30T14:25:06.8043504Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:06 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A06.8043504Z'" + location: + - https://storagename.table.core.windows.net/uttable84281187(PartitionKey='test',RowKey='test1') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:07 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:07 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable84281187(PartitionKey='test',RowKey='test1') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable84281187/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A06.8043504Z''\"","PartitionKey":"test","RowKey":"test1","Timestamp":"2020-07-30T14:25:06.8043504Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:06 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A06.8043504Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:07 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:07 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable84281187') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:06 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add_outside_range.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add_outside_range.yaml new file mode 100644 index 000000000000..2156c8f4bdc9 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_add_outside_range.yaml @@ -0,0 +1,143 @@ +interactions: +- request: + body: '{"TableName": "uttable973c1208"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:08 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:08 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable973c1208"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:06 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable973c1208') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk973c1208", "RowKey": "rk973c1208", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:08 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:08 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable973c1208?se=2020-07-30T15%3A25%3A08Z&sp=a&sv=2019-07-07&tn=uttable973c1208&spk=test&srk=test1&epk=test&erk=test1&sig=F%2FW5DJ9FV2uXi1DUTqRdhnMLoPz%2FYCWId2%2Fsh6icCrY%3D + response: + body: + string: '{"odata.error":{"code":"AuthorizationFailure","message":{"lang":"en-US","value":"This + request is not authorized to perform this operation.\nRequestId:56758a81-e002-0025-787d-66314a000000\nTime:2020-07-30T14:25:07.6660493Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:07 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 403 + message: Forbidden +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:08 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:08 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable973c1208') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:06 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_delete.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_delete.yaml new file mode 100644 index 000000000000..17a4f55d50e1 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_delete.yaml @@ -0,0 +1,233 @@ +interactions: +- request: + body: '{"TableName": "uttablee74c0d8a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:08 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:08 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablee74c0d8a"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:07 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablee74c0d8a') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pke74c0d8a", "RowKey": "rke74c0d8a", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:09 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablee74c0d8a + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee74c0d8a/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A08.1834177Z''\"","PartitionKey":"pke74c0d8a","RowKey":"rke74c0d8a","Timestamp":"2020-07-30T14:25:08.1834177Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:07 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A08.1834177Z'" + location: + - https://storagename.table.core.windows.net/uttablee74c0d8a(PartitionKey='pke74c0d8a',RowKey='rke74c0d8a') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:09 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:09 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttablee74c0d8a(PartitionKey='pke74c0d8a',RowKey='rke74c0d8a')?se=2020-07-30T15%3A25%3A09Z&sp=d&sv=2019-07-07&tn=uttablee74c0d8a&sig=yWEPg2BaMpgc%2FTwPzDc4OZ7X5Fz3RXfBqmRoDk9Ua6w%3D + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:08 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:09 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablee74c0d8a(PartitionKey='pke74c0d8a',RowKey='rke74c0d8a') + response: + body: + string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:cdb8df15-4002-004e-4a7d-666c1c000000\nTime:2020-07-30T14:25:08.6067193Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:08 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:09 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablee74c0d8a') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:08 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_query.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_query.yaml new file mode 100644 index 000000000000..b30f1b3d21da --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_query.yaml @@ -0,0 +1,188 @@ +interactions: +- request: + body: '{"TableName": "uttableda4d0d4d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:09 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttableda4d0d4d"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:08 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttableda4d0d4d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkda4d0d4d", "RowKey": "rkda4d0d4d", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:10 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttableda4d0d4d + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableda4d0d4d/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A09.1350748Z''\"","PartitionKey":"pkda4d0d4d","RowKey":"rkda4d0d4d","Timestamp":"2020-07-30T14:25:09.1350748Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:08 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A09.1350748Z'" + location: + - https://storagename.table.core.windows.net/uttableda4d0d4d(PartitionKey='pkda4d0d4d',RowKey='rkda4d0d4d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:10 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttableda4d0d4d()?st=2020-07-30T14%3A24%3A10Z&se=2020-07-30T15%3A25%3A10Z&sp=r&sv=2019-07-07&tn=uttableda4d0d4d&sig=bQ%2B%2B8KMyjEm7PxTOx86odItfh9AXPrCfS%2FmgY6r617o%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableda4d0d4d","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A09.1350748Z''\"","PartitionKey":"pkda4d0d4d","RowKey":"rkda4d0d4d","Timestamp":"2020-07-30T14:25:09.1350748Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:08 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:10 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttableda4d0d4d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:08 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_signed_identifier.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_signed_identifier.yaml new file mode 100644 index 000000000000..f8ed3b5f4489 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_signed_identifier.yaml @@ -0,0 +1,228 @@ +interactions: +- request: + body: '{"TableName": "uttable979d1213"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:10 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable979d1213"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:09 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable979d1213') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk979d1213", "RowKey": "rk979d1213", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:10 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable979d1213 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable979d1213/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A10.0244191Z''\"","PartitionKey":"pk979d1213","RowKey":"rk979d1213","Timestamp":"2020-07-30T14:25:10.0244191Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:09 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A10.0244191Z'" + location: + - https://storagename.table.core.windows.net/uttable979d1213(PartitionKey='pk979d1213',RowKey='rk979d1213') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: ' + + testid2011-10-11T00:00:00Z2020-10-12T00:00:00Zr' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '257' + Content-Type: + - application/xml + Date: + - Thu, 30 Jul 2020 14:25:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:11 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttable979d1213?comp=acl + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:09 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:11 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable979d1213()?sv=2019-07-07&si=testid&tn=uttable979d1213&sig=s6voo8dUkMGlXXy3%2FS%2BbgXhkjKFiLpJ%2B%2Fq2QspO6%2BHM%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable979d1213","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A10.0244191Z''\"","PartitionKey":"pk979d1213","RowKey":"rk979d1213","Timestamp":"2020-07-30T14:25:10.0244191Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:10 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:11 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable979d1213') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:10 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_update.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_update.yaml new file mode 100644 index 000000000000..e8914f67f1cf --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_update.yaml @@ -0,0 +1,240 @@ +interactions: +- request: + body: '{"TableName": "uttablee7bd0d9a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:11 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablee7bd0d9a"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:09 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablee7bd0d9a') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pke7bd0d9a", "RowKey": "rke7bd0d9a", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:11 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablee7bd0d9a + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee7bd0d9a/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A11.0242053Z''\"","PartitionKey":"pke7bd0d9a","RowKey":"rke7bd0d9a","Timestamp":"2020-07-30T14:25:11.0242053Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:10 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A11.0242053Z'" + location: + - https://storagename.table.core.windows.net/uttablee7bd0d9a(PartitionKey='pke7bd0d9a',RowKey='rke7bd0d9a') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pke7bd0d9a", "RowKey": "rke7bd0d9a", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:12 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:12 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttablee7bd0d9a(PartitionKey='pke7bd0d9a',RowKey='rke7bd0d9a')?se=2020-07-30T15%3A25%3A12Z&sp=u&sv=2019-07-07&tn=uttablee7bd0d9a&sig=Pu2Z4pva64F7RmLbcF3imXIGa16lfySNc%2Fgg7h2Kfxk%3D + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:11 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A11.3945698Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:12 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablee7bd0d9a(PartitionKey='pke7bd0d9a',RowKey='rke7bd0d9a') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee7bd0d9a/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A11.3945698Z''\"","PartitionKey":"pke7bd0d9a","RowKey":"rke7bd0d9a","Timestamp":"2020-07-30T14:25:11.3945698Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:10 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A11.3945698Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:12 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablee7bd0d9a') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:10 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_upper_case_table_name.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_upper_case_table_name.yaml new file mode 100644 index 000000000000..0b3676aac171 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_sas_upper_case_table_name.yaml @@ -0,0 +1,188 @@ +interactions: +- request: + body: '{"TableName": "uttablee48713a5"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:12 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablee48713a5"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:11 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablee48713a5') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pke48713a5", "RowKey": "rke48713a5", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:13 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablee48713a5 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee48713a5/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A12.0637078Z''\"","PartitionKey":"pke48713a5","RowKey":"rke48713a5","Timestamp":"2020-07-30T14:25:12.0637078Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:11 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A12.0637078Z'" + location: + - https://storagename.table.core.windows.net/uttablee48713a5(PartitionKey='pke48713a5',RowKey='rke48713a5') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:13 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablee48713a5()?st=2020-07-30T14%3A24%3A13Z&se=2020-07-30T15%3A25%3A13Z&sp=r&sv=2019-07-07&tn=UTTABLEE48713A5&sig=c55VGZIwHLTfBkqqVOl8pyJj%2BlAOJfxp3O5Znm4typg%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee48713a5","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A12.0637078Z''\"","PartitionKey":"pke48713a5","RowKey":"rke48713a5","Timestamp":"2020-07-30T14:25:12.0637078Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:12 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:13 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablee48713a5') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:12 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_timezone.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_timezone.yaml new file mode 100644 index 000000000000..90d266e0bb83 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_timezone.yaml @@ -0,0 +1,245 @@ +interactions: +- request: + body: '{"TableName": "uttablecd510cdc"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: +<<<<<<< HEAD + - Mon, 20 Jul 2020 13:33:55 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 20 Jul 2020 13:33:55 GMT +======= + - Thu, 02 Jul 2020 17:25:01 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 02 Jul 2020 17:25:01 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablecd510cdc"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: +<<<<<<< HEAD + - Mon, 20 Jul 2020 13:33:50 GMT +======= + - Thu, 02 Jul 2020 17:24:58 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + location: + - https://storagename.table.core.windows.net/Tables('uttablecd510cdc') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkcd510cdc", "RowKey": "rkcd510cdc", "date": "2003-09-27T09:52:43Z", + "date@odata.type": "Edm.DateTime"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '121' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: +<<<<<<< HEAD + - Mon, 20 Jul 2020 13:33:55 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 20 Jul 2020 13:33:55 GMT +======= + - Thu, 02 Jul 2020 17:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 02 Jul 2020 17:25:02 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablecd510cdc + response: + body: +<<<<<<< HEAD + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablecd510cdc/@Element","odata.etag":"W/\"datetime''2020-07-20T13%3A33%3A51.7472327Z''\"","PartitionKey":"pkcd510cdc","RowKey":"rkcd510cdc","Timestamp":"2020-07-20T13:33:51.7472327Z","date@odata.type":"Edm.DateTime","date":"2003-09-27T09:52:43Z"}' +======= + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablecd510cdc/@Element","odata.etag":"W/\"datetime''2020-07-02T17%3A24%3A59.5396317Z''\"","PartitionKey":"pkcd510cdc","RowKey":"rkcd510cdc","Timestamp":"2020-07-02T17:24:59.5396317Z","date@odata.type":"Edm.DateTime","date":"2003-09-27T09:52:43Z"}' +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: +<<<<<<< HEAD + - Mon, 20 Jul 2020 13:33:50 GMT + etag: + - W/"datetime'2020-07-20T13%3A33%3A51.7472327Z'" +======= + - Thu, 02 Jul 2020 17:24:58 GMT + etag: + - W/"datetime'2020-07-02T17%3A24%3A59.5396317Z'" +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + location: + - https://storagename.table.core.windows.net/uttablecd510cdc(PartitionKey='pkcd510cdc',RowKey='rkcd510cdc') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: +<<<<<<< HEAD + - Mon, 20 Jul 2020 13:33:56 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 20 Jul 2020 13:33:56 GMT +======= + - Thu, 02 Jul 2020 17:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 02 Jul 2020 17:25:02 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablecd510cdc(PartitionKey='pkcd510cdc',RowKey='rkcd510cdc') + response: + body: +<<<<<<< HEAD + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablecd510cdc/@Element","odata.etag":"W/\"datetime''2020-07-20T13%3A33%3A51.7472327Z''\"","PartitionKey":"pkcd510cdc","RowKey":"rkcd510cdc","Timestamp":"2020-07-20T13:33:51.7472327Z","date@odata.type":"Edm.DateTime","date":"2003-09-27T09:52:43Z"}' +======= + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablecd510cdc/@Element","odata.etag":"W/\"datetime''2020-07-02T17%3A24%3A59.5396317Z''\"","PartitionKey":"pkcd510cdc","RowKey":"rkcd510cdc","Timestamp":"2020-07-02T17:24:59.5396317Z","date@odata.type":"Edm.DateTime","date":"2003-09-27T09:52:43Z"}' +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: +<<<<<<< HEAD + - Mon, 20 Jul 2020 13:33:50 GMT + etag: + - W/"datetime'2020-07-20T13%3A33%3A51.7472327Z'" +======= + - Thu, 02 Jul 2020 17:24:59 GMT + etag: + - W/"datetime'2020-07-02T17%3A24%3A59.5396317Z'" +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: +<<<<<<< HEAD + - Mon, 20 Jul 2020 13:33:56 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 20 Jul 2020 13:33:56 GMT +======= + - Thu, 02 Jul 2020 17:25:02 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 02 Jul 2020 17:25:02 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablecd510cdc') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: +<<<<<<< HEAD + - Mon, 20 Jul 2020 13:33:50 GMT +======= + - Thu, 02 Jul 2020 17:24:59 GMT +>>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_unicode_property_name.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_unicode_property_name.yaml new file mode 100644 index 000000000000..44416b07b555 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_unicode_property_name.yaml @@ -0,0 +1,234 @@ +interactions: +- request: + body: '{"TableName": "uttable9990123c"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:13 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable9990123c"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:12 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable9990123c') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk9990123c", "RowKey": "rk9990123c", "\u554a\u9f44\u4e02\u72db\u72dc": + "\ua015"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '98' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:13 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable9990123c + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable9990123c/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A12.9807488Z''\"","PartitionKey":"pk9990123c","RowKey":"rk9990123c","Timestamp":"2020-07-30T14:25:12.9807488Z","\u554a\u9f44\u4e02\u72db\u72dc":"\ua015"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:12 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A12.9807488Z'" + location: + - https://storagename.table.core.windows.net/uttable9990123c(PartitionKey='pk9990123c',RowKey='rk9990123c') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk9990123c", "RowKey": "test2", "\u554a\u9f44\u4e02\u72db\u72dc": + "hello"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '92' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable9990123c + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable9990123c/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A13.0678085Z''\"","PartitionKey":"pk9990123c","RowKey":"test2","Timestamp":"2020-07-30T14:25:13.0678085Z","\u554a\u9f44\u4e02\u72db\u72dc":"hello"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:12 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A13.0678085Z'" + location: + - https://storagename.table.core.windows.net/uttable9990123c(PartitionKey='pk9990123c',RowKey='test2') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:14 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable9990123c() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable9990123c","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A12.9807488Z''\"","PartitionKey":"pk9990123c","RowKey":"rk9990123c","Timestamp":"2020-07-30T14:25:12.9807488Z","\u554a\u9f44\u4e02\u72db\u72dc":"\ua015"},{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A13.0678085Z''\"","PartitionKey":"pk9990123c","RowKey":"test2","Timestamp":"2020-07-30T14:25:13.0678085Z","\u554a\u9f44\u4e02\u72db\u72dc":"hello"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:12 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:14 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable9990123c') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:12 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_unicode_property_value.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_unicode_property_value.yaml new file mode 100644 index 000000000000..77aaaf12be36 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_unicode_property_value.yaml @@ -0,0 +1,232 @@ +interactions: +- request: + body: '{"TableName": "uttableac7612b8"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttableac7612b8"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:12 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttableac7612b8') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkac7612b8", "RowKey": "rkac7612b8", "Description": "\ua015"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '79' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttableac7612b8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableac7612b8/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A13.7006244Z''\"","PartitionKey":"pkac7612b8","RowKey":"rkac7612b8","Timestamp":"2020-07-30T14:25:13.7006244Z","Description":"\ua015"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:13 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A13.7006244Z'" + location: + - https://storagename.table.core.windows.net/uttableac7612b8(PartitionKey='pkac7612b8',RowKey='rkac7612b8') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkac7612b8", "RowKey": "test2", "Description": "\ua015"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '74' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttableac7612b8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableac7612b8/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A13.7896884Z''\"","PartitionKey":"pkac7612b8","RowKey":"test2","Timestamp":"2020-07-30T14:25:13.7896884Z","Description":"\ua015"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:13 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A13.7896884Z'" + location: + - https://storagename.table.core.windows.net/uttableac7612b8(PartitionKey='pkac7612b8',RowKey='test2') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:14 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttableac7612b8() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableac7612b8","value":[{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A13.7006244Z''\"","PartitionKey":"pkac7612b8","RowKey":"rkac7612b8","Timestamp":"2020-07-30T14:25:13.7006244Z","Description":"\ua015"},{"odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A13.7896884Z''\"","PartitionKey":"pkac7612b8","RowKey":"test2","Timestamp":"2020-07-30T14:25:13.7896884Z","Description":"\ua015"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:13 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:14 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttableac7612b8') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:13 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity.yaml new file mode 100644 index 000000000000..6707b72ce817 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity.yaml @@ -0,0 +1,240 @@ +interactions: +- request: + body: '{"TableName": "uttable13250ef0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:15 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable13250ef0"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:13 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable13250ef0') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk13250ef0", "RowKey": "rk13250ef0", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:15 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable13250ef0 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable13250ef0/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A14.4293512Z''\"","PartitionKey":"pk13250ef0","RowKey":"rk13250ef0","Timestamp":"2020-07-30T14:25:14.4293512Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:13 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A14.4293512Z'" + location: + - https://storagename.table.core.windows.net/uttable13250ef0(PartitionKey='pk13250ef0',RowKey='rk13250ef0') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk13250ef0", "RowKey": "rk13250ef0", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:15 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:15 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttable13250ef0(PartitionKey='pk13250ef0',RowKey='rk13250ef0') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:13 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A14.5137747Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:15 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable13250ef0(PartitionKey='pk13250ef0',RowKey='rk13250ef0') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable13250ef0/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A14.5137747Z''\"","PartitionKey":"pk13250ef0","RowKey":"rk13250ef0","Timestamp":"2020-07-30T14:25:14.5137747Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:13 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A14.5137747Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:15 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable13250ef0') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:13 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_not_existing.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_not_existing.yaml new file mode 100644 index 000000000000..d20af7e259fd --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_not_existing.yaml @@ -0,0 +1,145 @@ +interactions: +- request: + body: '{"TableName": "uttablefb67146a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:15 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablefb67146a"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:14 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttablefb67146a') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkfb67146a", "RowKey": "rkfb67146a", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:16 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:16 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttablefb67146a(PartitionKey='pkfb67146a',RowKey='rkfb67146a') + response: + body: + string: 'ResourceNotFoundThe specified resource does not exist. + + RequestId:dfb6a408-a002-0029-6c7d-66dfbb000000 + + Time:2020-07-30T14:25:15.2185782Z' + headers: + cache-control: + - no-cache + content-type: + - application/xml;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:14 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:16 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablefb67146a') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:14 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_with_if_doesnt_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_with_if_doesnt_match.yaml new file mode 100644 index 000000000000..cd52d96f8b89 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_with_if_doesnt_match.yaml @@ -0,0 +1,201 @@ +interactions: +- request: + body: '{"TableName": "uttableabcb1791"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:16 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttableabcb1791"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:15 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttableabcb1791') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkabcb1791", "RowKey": "rkabcb1791", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:16 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttableabcb1791 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableabcb1791/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A15.8403997Z''\"","PartitionKey":"pkabcb1791","RowKey":"rkabcb1791","Timestamp":"2020-07-30T14:25:15.8403997Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:15 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A15.8403997Z'" + location: + - https://storagename.table.core.windows.net/uttableabcb1791(PartitionKey='pkabcb1791',RowKey='rkabcb1791') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pkabcb1791", "RowKey": "rkabcb1791", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:16 GMT + If-Match: + - W/"datetime'2012-06-15T22%3A51%3A44.9662825Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:16 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttableabcb1791(PartitionKey='pkabcb1791',RowKey='rkabcb1791') + response: + body: + string: 'UpdateConditionNotSatisfiedThe update condition specified in the request was not satisfied. + + RequestId:7e044957-8002-003e-677d-661fd8000000 + + Time:2020-07-30T14:25:15.9364680Z' + headers: + cache-control: + - no-cache + content-type: + - application/xml;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:15 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 412 + message: Precondition Failed +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:16 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttableabcb1791') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:15 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_with_if_matches.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_with_if_matches.yaml new file mode 100644 index 000000000000..8fcdd010bada --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_update_entity_with_if_matches.yaml @@ -0,0 +1,240 @@ +interactions: +- request: + body: '{"TableName": "uttable39e2157d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:17 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable39e2157d"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:15 GMT + location: + - https://storagename.table.core.windows.net/Tables('uttable39e2157d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk39e2157d", "RowKey": "rk39e2157d", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:17 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable39e2157d + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable39e2157d/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A16.4963252Z''\"","PartitionKey":"pk39e2157d","RowKey":"rk39e2157d","Timestamp":"2020-07-30T14:25:16.4963252Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:15 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A16.4963252Z'" + location: + - https://storagename.table.core.windows.net/uttable39e2157d(PartitionKey='pk39e2157d',RowKey='rk39e2157d') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk39e2157d", "RowKey": "rk39e2157d", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:17 GMT + If-Match: + - W/"datetime'2020-07-30T14%3A25%3A16.4963252Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:17 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttable39e2157d(PartitionKey='pk39e2157d',RowKey='rk39e2157d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:15 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A16.5932449Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 14:25:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:17 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable39e2157d(PartitionKey='pk39e2157d',RowKey='rk39e2157d') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable39e2157d/@Element","odata.etag":"W/\"datetime''2020-07-30T14%3A25%3A16.5932449Z''\"","PartitionKey":"pk39e2157d","RowKey":"rk39e2157d","Timestamp":"2020-07-30T14:25:16.5932449Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 30 Jul 2020 14:25:15 GMT + etag: + - W/"datetime'2020-07-30T14%3A25%3A16.5932449Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 30 Jul 2020 14:25:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 14:25:17 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable39e2157d') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Jul 2020 14:25:15 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-07-07' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_binary_property_value.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_binary_property_value.yaml new file mode 100644 index 000000000000..a904f4e50dc3 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_binary_property_value.yaml @@ -0,0 +1,138 @@ +interactions: +- request: + body: '{"TableName": "uttable10a914d3"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:08 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:08 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable10a914d3"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:07 GMT + location: https://storagename.table.core.windows.net/Tables('uttable10a914d3') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk10a914d3", "RowKey": "rk10a914d3", "binary": "AQIDBAUGBwgJCg==", + "binary@odata.type": "Edm.Binary"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '119' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:08 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:08 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable10a914d3 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable10a914d3/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A07.5921964Z''\"","PartitionKey":"pk10a914d3","RowKey":"rk10a914d3","Timestamp":"2020-07-30T13:33:07.5921964Z","binary@odata.type":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:07 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A07.5921964Z'" + location: https://storagename.table.core.windows.net/uttable10a914d3(PartitionKey='pk10a914d3',RowKey='rk10a914d3') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable10a914d3 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:08 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:08 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable10a914d3(PartitionKey='pk10a914d3',RowKey='rk10a914d3') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable10a914d3/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A07.5921964Z''\"","PartitionKey":"pk10a914d3","RowKey":"rk10a914d3","Timestamp":"2020-07-30T13:33:07.5921964Z","binary@odata.type":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:07 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A07.5921964Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable10a914d3(PartitionKey='pk10a914d3',RowKey='rk10a914d3') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:09 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable10a914d3') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:07 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable10a914d3') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity.yaml new file mode 100644 index 000000000000..723ce487482f --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity.yaml @@ -0,0 +1,174 @@ +interactions: +- request: + body: '{"TableName": "uttable74f8115d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:09 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable74f8115d"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:08 GMT + location: https://storagename.table.core.windows.net/Tables('uttable74f8115d') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk74f8115d", "RowKey": "rk74f8115d", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:09 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable74f8115d + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable74f8115d/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A08.4768117Z''\"","PartitionKey":"pk74f8115d","RowKey":"rk74f8115d","Timestamp":"2020-07-30T13:33:08.4768117Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:08 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A08.4768117Z'" + location: https://storagename.table.core.windows.net/uttable74f8115d(PartitionKey='pk74f8115d',RowKey='rk74f8115d') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable74f8115d +- request: + body: null + headers: + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:09 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:09 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttable74f8115d(PartitionKey='pk74f8115d',RowKey='rk74f8115d') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:08 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable74f8115d(PartitionKey='pk74f8115d',RowKey='rk74f8115d') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:09 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable74f8115d(PartitionKey='pk74f8115d',RowKey='rk74f8115d') + response: + body: + string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:60a46c4d-d002-0020-1175-6666c6000000\nTime:2020-07-30T13:33:08.6499351Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:08 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 404 + message: Not Found + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable74f8115d(PartitionKey='pk74f8115d',RowKey='rk74f8115d') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:09 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable74f8115d') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:08 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable74f8115d') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_not_existing.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_not_existing.yaml new file mode 100644 index 000000000000..b7653b5883db --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_not_existing.yaml @@ -0,0 +1,103 @@ +interactions: +- request: + body: '{"TableName": "uttable7cd216d7"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:09 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:09 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7cd216d7"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:08 GMT + location: https://storagename.table.core.windows.net/Tables('uttable7cd216d7') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: null + headers: + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:10 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:10 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttable7cd216d7(PartitionKey='pk7cd216d7',RowKey='rk7cd216d7') + response: + body: + string: 'ResourceNotFoundThe specified resource does not exist. + + RequestId:c2880782-2002-001c-6b75-66d21d000000 + + Time:2020-07-30T13:33:09.1571934Z' + headers: + cache-control: no-cache + content-type: application/xml;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:08 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 404 + message: Not Found + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable7cd216d7(PartitionKey='pk7cd216d7',RowKey='rk7cd216d7') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:10 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable7cd216d7') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:08 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable7cd216d7') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_with_if_doesnt_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_with_if_doesnt_match.yaml new file mode 100644 index 000000000000..d4d913a0c1d9 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_with_if_doesnt_match.yaml @@ -0,0 +1,147 @@ +interactions: +- request: + body: '{"TableName": "uttable409e19fe"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:10 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable409e19fe"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:09 GMT + location: https://storagename.table.core.windows.net/Tables('uttable409e19fe') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk409e19fe", "RowKey": "rk409e19fe", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:10 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable409e19fe + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable409e19fe/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A09.6372886Z''\"","PartitionKey":"pk409e19fe","RowKey":"rk409e19fe","Timestamp":"2020-07-30T13:33:09.6372886Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:09 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A09.6372886Z'" + location: https://storagename.table.core.windows.net/uttable409e19fe(PartitionKey='pk409e19fe',RowKey='rk409e19fe') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable409e19fe +- request: + body: null + headers: + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:10 GMT + If-Match: + - W/"datetime'2012-06-15T22%3A51%3A44.9662825Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:10 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttable409e19fe(PartitionKey='pk409e19fe',RowKey='rk409e19fe') + response: + body: + string: 'UpdateConditionNotSatisfiedThe update condition specified in the request was not satisfied. + + RequestId:76b253b9-0002-006d-0775-66a024000000 + + Time:2020-07-30T13:33:09.7123389Z' + headers: + cache-control: no-cache + content-type: application/xml;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:09 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 412 + message: Precondition Failed + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable409e19fe(PartitionKey='pk409e19fe',RowKey='rk409e19fe') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:10 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable409e19fe') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:09 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable409e19fe') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_with_if_matches.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_with_if_matches.yaml new file mode 100644 index 000000000000..31afb48c7ea5 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_with_if_matches.yaml @@ -0,0 +1,174 @@ +interactions: +- request: + body: '{"TableName": "uttablec28517ea"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:10 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:10 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablec28517ea"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:09 GMT + location: https://storagename.table.core.windows.net/Tables('uttablec28517ea') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkc28517ea", "RowKey": "rkc28517ea", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:11 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablec28517ea + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablec28517ea/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A10.2016072Z''\"","PartitionKey":"pkc28517ea","RowKey":"rkc28517ea","Timestamp":"2020-07-30T13:33:10.2016072Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:09 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A10.2016072Z'" + location: https://storagename.table.core.windows.net/uttablec28517ea(PartitionKey='pkc28517ea',RowKey='rkc28517ea') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablec28517ea +- request: + body: null + headers: + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:11 GMT + If-Match: + - W/"datetime'2020-07-30T13%3A33%3A10.2016072Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:11 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttablec28517ea(PartitionKey='pkc28517ea',RowKey='rkc28517ea') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:09 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablec28517ea(PartitionKey='pkc28517ea',RowKey='rkc28517ea') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:11 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablec28517ea(PartitionKey='pkc28517ea',RowKey='rkc28517ea') + response: + body: + string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:90187323-e002-0023-6275-6665c1000000\nTime:2020-07-30T13:33:10.3637214Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:09 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 404 + message: Not Found + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablec28517ea(PartitionKey='pkc28517ea',RowKey='rkc28517ea') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:11 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablec28517ea') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:10 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablec28517ea') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_empty_and_spaces_property_value.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_empty_and_spaces_property_value.yaml new file mode 100644 index 000000000000..dee2b6066079 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_empty_and_spaces_property_value.yaml @@ -0,0 +1,141 @@ +interactions: +- request: + body: '{"TableName": "uttablef58f18ed"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:11 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablef58f18ed"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:10 GMT + location: https://storagename.table.core.windows.net/Tables('uttablef58f18ed') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkf58f18ed", "RowKey": "rkf58f18ed", "EmptyByte": "", + "EmptyUnicode": "", "SpacesOnlyByte": " ", "SpacesOnlyUnicode": " ", "SpacesBeforeByte": + " Text", "SpacesBeforeUnicode": " Text", "SpacesAfterByte": "Text ", "SpacesAfterUnicode": + "Text ", "SpacesBeforeAndAfterByte": " Text ", "SpacesBeforeAndAfterUnicode": + " Text "}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '359' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:11 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablef58f18ed + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablef58f18ed/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A10.8499402Z''\"","PartitionKey":"pkf58f18ed","RowKey":"rkf58f18ed","Timestamp":"2020-07-30T13:33:10.8499402Z","EmptyByte":"","EmptyUnicode":"","SpacesOnlyByte":" ","SpacesOnlyUnicode":" ","SpacesBeforeByte":" Text","SpacesBeforeUnicode":" Text","SpacesAfterByte":"Text ","SpacesAfterUnicode":"Text ","SpacesBeforeAndAfterByte":" Text ","SpacesBeforeAndAfterUnicode":" Text "}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:10 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A10.8499402Z'" + location: https://storagename.table.core.windows.net/uttablef58f18ed(PartitionKey='pkf58f18ed',RowKey='rkf58f18ed') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablef58f18ed +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:11 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablef58f18ed(PartitionKey='pkf58f18ed',RowKey='rkf58f18ed') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablef58f18ed/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A10.8499402Z''\"","PartitionKey":"pkf58f18ed","RowKey":"rkf58f18ed","Timestamp":"2020-07-30T13:33:10.8499402Z","EmptyByte":"","EmptyUnicode":"","SpacesOnlyByte":" ","SpacesOnlyUnicode":" ","SpacesBeforeByte":" Text","SpacesBeforeUnicode":" Text","SpacesAfterByte":"Text ","SpacesAfterUnicode":"Text ","SpacesBeforeAndAfterByte":" Text ","SpacesBeforeAndAfterUnicode":" Text "}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:10 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A10.8499402Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablef58f18ed(PartitionKey='pkf58f18ed',RowKey='rkf58f18ed') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:11 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:11 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablef58f18ed') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:10 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablef58f18ed') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity.yaml new file mode 100644 index 000000000000..23ff699e1ce5 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity.yaml @@ -0,0 +1,143 @@ +interactions: +- request: + body: '{"TableName": "uttable42bf102a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:12 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable42bf102a"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:11 GMT + location: https://storagename.table.core.windows.net/Tables('uttable42bf102a') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk42bf102a", "RowKey": "rk42bf102a", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:12 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable42bf102a + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable42bf102a/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A11.4231078Z''\"","PartitionKey":"pk42bf102a","RowKey":"rk42bf102a","Timestamp":"2020-07-30T13:33:11.4231078Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:11 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A11.4231078Z'" + location: https://storagename.table.core.windows.net/uttable42bf102a(PartitionKey='pk42bf102a',RowKey='rk42bf102a') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable42bf102a +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:12 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable42bf102a(PartitionKey='pk42bf102a',RowKey='rk42bf102a') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable42bf102a/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A11.4231078Z''\"","PartitionKey":"pk42bf102a","RowKey":"rk42bf102a","Timestamp":"2020-07-30T13:33:11.4231078Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:11 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A11.4231078Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable42bf102a(PartitionKey='pk42bf102a',RowKey='rk42bf102a') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:12 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable42bf102a') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:11 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable42bf102a') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_full_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_full_metadata.yaml new file mode 100644 index 000000000000..d559f65c235e --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_full_metadata.yaml @@ -0,0 +1,143 @@ +interactions: +- request: + body: '{"TableName": "uttable4fed15dc"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:12 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable4fed15dc"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:11 GMT + location: https://storagename.table.core.windows.net/Tables('uttable4fed15dc') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk4fed15dc", "RowKey": "rk4fed15dc", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:12 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:12 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable4fed15dc + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable4fed15dc/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A11.996063Z''\"","PartitionKey":"pk4fed15dc","RowKey":"rk4fed15dc","Timestamp":"2020-07-30T13:33:11.996063Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:11 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A11.996063Z'" + location: https://storagename.table.core.windows.net/uttable4fed15dc(PartitionKey='pk4fed15dc',RowKey='rk4fed15dc') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable4fed15dc +- request: + body: null + headers: + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + accept: + - application/json;odata=fullmetadata + x-ms-date: + - Thu, 30 Jul 2020 13:33:13 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable4fed15dc(PartitionKey='pk4fed15dc',RowKey='rk4fed15dc') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable4fed15dc/@Element","odata.type":"storagename.uttable4fed15dc","odata.id":"https://storagename.table.core.windows.net/uttable4fed15dc(PartitionKey=''pk4fed15dc'',RowKey=''rk4fed15dc'')","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A11.996063Z''\"","odata.editLink":"uttable4fed15dc(PartitionKey=''pk4fed15dc'',RowKey=''rk4fed15dc'')","PartitionKey":"pk4fed15dc","RowKey":"rk4fed15dc","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2020-07-30T13:33:11.996063Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=fullmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:11 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A11.996063Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable4fed15dc(PartitionKey='pk4fed15dc',RowKey='rk4fed15dc') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:13 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable4fed15dc') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:11 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable4fed15dc') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match.yaml new file mode 100644 index 000000000000..1c6e7e62b85b --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match.yaml @@ -0,0 +1,174 @@ +interactions: +- request: + body: '{"TableName": "uttablee60b13c4"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:13 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablee60b13c4"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:11 GMT + location: https://storagename.table.core.windows.net/Tables('uttablee60b13c4') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pke60b13c4", "RowKey": "rke60b13c4", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:13 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablee60b13c4 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee60b13c4/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A12.5681839Z''\"","PartitionKey":"pke60b13c4","RowKey":"rke60b13c4","Timestamp":"2020-07-30T13:33:12.5681839Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:11 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A12.5681839Z'" + location: https://storagename.table.core.windows.net/uttablee60b13c4(PartitionKey='pke60b13c4',RowKey='rke60b13c4') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablee60b13c4 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:13 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablee60b13c4(PartitionKey='pke60b13c4',RowKey='rke60b13c4') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee60b13c4/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A12.5681839Z''\"","PartitionKey":"pke60b13c4","RowKey":"rke60b13c4","Timestamp":"2020-07-30T13:33:12.5681839Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:11 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A12.5681839Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablee60b13c4(PartitionKey='pke60b13c4',RowKey='rke60b13c4') +- request: + body: null + headers: + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:13 GMT + If-Match: + - W/"datetime'2020-07-30T13%3A33%3A12.5681839Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:13 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttablee60b13c4(PartitionKey='pke60b13c4',RowKey='rke60b13c4') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:11 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablee60b13c4(PartitionKey='pke60b13c4',RowKey='rke60b13c4') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:13 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablee60b13c4') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:11 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablee60b13c4') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_no_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_no_metadata.yaml new file mode 100644 index 000000000000..00b4d7e7ee0b --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_no_metadata.yaml @@ -0,0 +1,143 @@ +interactions: +- request: + body: '{"TableName": "uttable24651506"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:13 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:13 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable24651506"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:12 GMT + location: https://storagename.table.core.windows.net/Tables('uttable24651506') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk24651506", "RowKey": "rk24651506", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable24651506 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable24651506/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A13.2354777Z''\"","PartitionKey":"pk24651506","RowKey":"rk24651506","Timestamp":"2020-07-30T13:33:13.2354777Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:12 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A13.2354777Z'" + location: https://storagename.table.core.windows.net/uttable24651506(PartitionKey='pk24651506',RowKey='rk24651506') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable24651506 +- request: + body: null + headers: + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + accept: + - application/json;odata=nometadata + x-ms-date: + - Thu, 30 Jul 2020 13:33:14 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable24651506(PartitionKey='pk24651506',RowKey='rk24651506') + response: + body: + string: '{"PartitionKey":"pk24651506","RowKey":"rk24651506","Timestamp":"2020-07-30T13:33:13.2354777Z","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":"933311100","Birthday":"1973-10-04T00:00:00Z","birthday":"1970-10-04T00:00:00Z","binary":"YmluYXJ5","other":20,"clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=nometadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:12 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A13.2354777Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable24651506(PartitionKey='pk24651506',RowKey='rk24651506') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:14 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable24651506') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:12 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable24651506') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_not_existing.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_not_existing.yaml new file mode 100644 index 000000000000..562d270636ff --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_not_existing.yaml @@ -0,0 +1,99 @@ +interactions: +- request: + body: '{"TableName": "uttable3b0215a4"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable3b0215a4"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:12 GMT + location: https://storagename.table.core.windows.net/Tables('uttable3b0215a4') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:14 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable3b0215a4(PartitionKey='pk3b0215a4',RowKey='rk3b0215a4') + response: + body: + string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:a97c0a5d-b002-0030-6775-665020000000\nTime:2020-07-30T13:33:13.8058709Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:13 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 404 + message: Not Found + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable3b0215a4(PartitionKey='pk3b0215a4',RowKey='rk3b0215a4') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:14 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable3b0215a4') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:13 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable3b0215a4') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_hook.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_hook.yaml new file mode 100644 index 000000000000..064b00c78381 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_hook.yaml @@ -0,0 +1,143 @@ +interactions: +- request: + body: '{"TableName": "uttablefb3d1455"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:14 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:14 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablefb3d1455"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:13 GMT + location: https://storagename.table.core.windows.net/Tables('uttablefb3d1455') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkfb3d1455", "RowKey": "rkfb3d1455", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:15 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablefb3d1455 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablefb3d1455/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A14.2838561Z''\"","PartitionKey":"pkfb3d1455","RowKey":"rkfb3d1455","Timestamp":"2020-07-30T13:33:14.2838561Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:13 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A14.2838561Z'" + location: https://storagename.table.core.windows.net/uttablefb3d1455(PartitionKey='pkfb3d1455',RowKey='rkfb3d1455') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablefb3d1455 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:15 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablefb3d1455(PartitionKey='pkfb3d1455',RowKey='rkfb3d1455') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablefb3d1455/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A14.2838561Z''\"","PartitionKey":"pkfb3d1455","RowKey":"rkfb3d1455","Timestamp":"2020-07-30T13:33:14.2838561Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:13 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A14.2838561Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablefb3d1455(PartitionKey='pkfb3d1455',RowKey='rkfb3d1455') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:15 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablefb3d1455') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:13 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablefb3d1455') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_select.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_select.yaml new file mode 100644 index 000000000000..b3be2e1559d4 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_select.yaml @@ -0,0 +1,110 @@ +interactions: +- request: + body: '{"TableName": "uttable25221524"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Fri, 24 Jul 2020 15:12:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Fri, 24 Jul 2020 15:12:18 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable25221524"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Fri, 24 Jul 2020 15:12:18 GMT + location: https://storagename.table.core.windows.net/Tables('uttable25221524') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstoragerbrqrhumwwkw.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk25221524", "RowKey": "rk25221524", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Fri, 24 Jul 2020 15:12:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Fri, 24 Jul 2020 15:12:18 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable25221524 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable25221524/@Element","odata.etag":"W/\"datetime''2020-07-24T15%3A12%3A19.0328764Z''\"","PartitionKey":"pk25221524","RowKey":"rk25221524","Timestamp":"2020-07-24T15:12:19.0328764Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Fri, 24 Jul 2020 15:12:18 GMT + etag: W/"datetime'2020-07-24T15%3A12%3A19.0328764Z'" + location: https://storagename.table.core.windows.net/uttable25221524(PartitionKey='pk25221524',RowKey='rk25221524') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstoragerbrqrhumwwkw.table.core.windows.net/uttable25221524 +- request: + body: null + headers: + Date: + - Fri, 24 Jul 2020 15:12:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Fri, 24 Jul 2020 15:12:18 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable25221524') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Fri, 24 Jul 2020 15:12:18 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstoragerbrqrhumwwkw.table.core.windows.net/Tables('uttable25221524') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_special_doubles.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_special_doubles.yaml new file mode 100644 index 000000000000..89bfa2a0b07c --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_with_special_doubles.yaml @@ -0,0 +1,139 @@ +interactions: +- request: + body: '{"TableName": "uttablef57d18d2"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:15 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablef57d18d2"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:14 GMT + location: https://storagename.table.core.windows.net/Tables('uttablef57d18d2') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkf57d18d2", "RowKey": "rkf57d18d2", "inf": "Infinity", + "inf@odata.type": "Edm.Double", "negativeinf": "-Infinity", "negativeinf@odata.type": + "Edm.Double", "nan": "NaN", "nan@odata.type": "Edm.Double"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '219' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:15 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablef57d18d2 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablef57d18d2/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A14.8799464Z''\"","PartitionKey":"pkf57d18d2","RowKey":"rkf57d18d2","Timestamp":"2020-07-30T13:33:14.8799464Z","inf@odata.type":"Edm.Double","inf":"Infinity","negativeinf@odata.type":"Edm.Double","negativeinf":"-Infinity","nan@odata.type":"Edm.Double","nan":"NaN"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:14 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A14.8799464Z'" + location: https://storagename.table.core.windows.net/uttablef57d18d2(PartitionKey='pkf57d18d2',RowKey='rkf57d18d2') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablef57d18d2 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:15 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:15 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablef57d18d2(PartitionKey='pkf57d18d2',RowKey='rkf57d18d2') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablef57d18d2/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A14.8799464Z''\"","PartitionKey":"pkf57d18d2","RowKey":"rkf57d18d2","Timestamp":"2020-07-30T13:33:14.8799464Z","inf@odata.type":"Edm.Double","inf":"Infinity","negativeinf@odata.type":"Edm.Double","negativeinf":"-Infinity","nan@odata.type":"Edm.Double","nan":"NaN"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:14 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A14.8799464Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablef57d18d2(PartitionKey='pkf57d18d2',RowKey='rkf57d18d2') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:16 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablef57d18d2') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:14 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablef57d18d2') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_conflict.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_conflict.yaml new file mode 100644 index 000000000000..1ab3026d9dc2 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_conflict.yaml @@ -0,0 +1,153 @@ +interactions: +- request: + body: '{"TableName": "uttable260d1530"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:16 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable260d1530"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:15 GMT + location: https://storagename.table.core.windows.net/Tables('uttable260d1530') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk260d1530", "RowKey": "rk260d1530", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:16 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable260d1530 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable260d1530/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A15.4517171Z''\"","PartitionKey":"pk260d1530","RowKey":"rk260d1530","Timestamp":"2020-07-30T13:33:15.4517171Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:15 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A15.4517171Z'" + location: https://storagename.table.core.windows.net/uttable260d1530(PartitionKey='pk260d1530',RowKey='rk260d1530') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable260d1530 +- request: + body: '{"PartitionKey": "pk260d1530", "RowKey": "rk260d1530", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:16 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable260d1530 + response: + body: + string: '{"odata.error":{"code":"EntityAlreadyExists","message":{"lang":"en-US","value":"The + specified entity already exists.\nRequestId:5786b892-3002-0003-3875-66090d000000\nTime:2020-07-30T13:33:15.5347750Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:15 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 409 + message: Conflict + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable260d1530 +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:16 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable260d1530') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:15 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable260d1530') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_dictionary.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_dictionary.yaml new file mode 100644 index 000000000000..6a44439fa684 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_dictionary.yaml @@ -0,0 +1,110 @@ +interactions: +- request: + body: '{"TableName": "uttable51a71614"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:16 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:16 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable51a71614"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:14 GMT + location: https://storagename.table.core.windows.net/Tables('uttable51a71614') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk51a71614", "RowKey": "rk51a71614", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:17 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable51a71614 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable51a71614/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A16.0395768Z''\"","PartitionKey":"pk51a71614","RowKey":"rk51a71614","Timestamp":"2020-07-30T13:33:16.0395768Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:15 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A16.0395768Z'" + location: https://storagename.table.core.windows.net/uttable51a71614(PartitionKey='pk51a71614',RowKey='rk51a71614') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable51a71614 +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:17 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable51a71614') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:15 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable51a71614') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_empty_string_pk.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_empty_string_pk.yaml new file mode 100644 index 000000000000..03513853ac48 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_empty_string_pk.yaml @@ -0,0 +1,104 @@ +interactions: +- request: + body: '{"TableName": "uttablec79a183d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:17 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablec79a183d"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:15 GMT + location: https://storagename.table.core.windows.net/Tables('uttablec79a183d') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"RowKey": "rk", "PartitionKey": ""}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:17 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablec79a183d + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablec79a183d/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A16.5337845Z''\"","PartitionKey":"","RowKey":"rk","Timestamp":"2020-07-30T13:33:16.5337845Z"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:15 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A16.5337845Z'" + location: https://storagename.table.core.windows.net/uttablec79a183d(PartitionKey='',RowKey='rk') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablec79a183d +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:17 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablec79a183d') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:15 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablec79a183d') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_empty_string_rk.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_empty_string_rk.yaml new file mode 100644 index 000000000000..6fa4f5a1f320 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_empty_string_rk.yaml @@ -0,0 +1,104 @@ +interactions: +- request: + body: '{"TableName": "uttablec79e183f"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:17 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablec79e183f"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:15 GMT + location: https://storagename.table.core.windows.net/Tables('uttablec79e183f') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk", "RowKey": ""}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:18 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablec79e183f + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablec79e183f/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A17.0466104Z''\"","PartitionKey":"pk","RowKey":"","Timestamp":"2020-07-30T13:33:17.0466104Z"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:16 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A17.0466104Z'" + location: https://storagename.table.core.windows.net/uttablec79e183f(PartitionKey='pk',RowKey='') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablec79e183f +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:18 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablec79e183f') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:16 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablec79e183f') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_missing_pk.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_missing_pk.yaml new file mode 100644 index 000000000000..7ea32dbb2b6b --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_missing_pk.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: '{"TableName": "uttable52411612"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:18 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable52411612"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:17 GMT + location: https://storagename.table.core.windows.net/Tables('uttable52411612') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:18 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable52411612') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:17 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable52411612') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_missing_rk.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_missing_rk.yaml new file mode 100644 index 000000000000..5dcbe0d947a5 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_missing_rk.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: '{"TableName": "uttable52451614"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:18 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable52451614"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:17 GMT + location: https://storagename.table.core.windows.net/Tables('uttable52451614') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:18 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable52451614') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:17 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable52451614') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_property_name_too_long.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_property_name_too_long.yaml new file mode 100644 index 000000000000..8eb10a0aaabd --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_property_name_too_long.yaml @@ -0,0 +1,104 @@ +interactions: +- request: + body: '{"TableName": "uttable7d0b1b23"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:19 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7d0b1b23"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:18 GMT + location: https://storagename.table.core.windows.net/Tables('uttable7d0b1b23') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk7d0b1b23", "RowKey": "rk7d0b1b23", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": + "badval"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '324' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:19 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable7d0b1b23 + response: + body: + string: '{"odata.error":{"code":"PropertyNameTooLong","message":{"lang":"en-US","value":"The + property name exceeds the maximum allowed length (255).\nRequestId:a90cc38a-9002-002c-2675-668837000000\nTime:2020-07-30T13:33:18.4270043Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:18 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 400 + message: Bad Request + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable7d0b1b23 +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:19 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable7d0b1b23') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:18 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable7d0b1b23') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_too_many_properties.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_too_many_properties.yaml new file mode 100644 index 000000000000..2d562e0e26df --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_too_many_properties.yaml @@ -0,0 +1,173 @@ +interactions: +- request: + body: '{"TableName": "uttable2c5919f0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:19 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable2c5919f0"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:18 GMT + location: https://storagename.table.core.windows.net/Tables('uttable2c5919f0') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk2c5919f0", "RowKey": "rk2c5919f0", "key0": "value0", + "key1": "value1", "key2": "value2", "key3": "value3", "key4": "value4", "key5": + "value5", "key6": "value6", "key7": "value7", "key8": "value8", "key9": "value9", + "key10": "value10", "key11": "value11", "key12": "value12", "key13": "value13", + "key14": "value14", "key15": "value15", "key16": "value16", "key17": "value17", + "key18": "value18", "key19": "value19", "key20": "value20", "key21": "value21", + "key22": "value22", "key23": "value23", "key24": "value24", "key25": "value25", + "key26": "value26", "key27": "value27", "key28": "value28", "key29": "value29", + "key30": "value30", "key31": "value31", "key32": "value32", "key33": "value33", + "key34": "value34", "key35": "value35", "key36": "value36", "key37": "value37", + "key38": "value38", "key39": "value39", "key40": "value40", "key41": "value41", + "key42": "value42", "key43": "value43", "key44": "value44", "key45": "value45", + "key46": "value46", "key47": "value47", "key48": "value48", "key49": "value49", + "key50": "value50", "key51": "value51", "key52": "value52", "key53": "value53", + "key54": "value54", "key55": "value55", "key56": "value56", "key57": "value57", + "key58": "value58", "key59": "value59", "key60": "value60", "key61": "value61", + "key62": "value62", "key63": "value63", "key64": "value64", "key65": "value65", + "key66": "value66", "key67": "value67", "key68": "value68", "key69": "value69", + "key70": "value70", "key71": "value71", "key72": "value72", "key73": "value73", + "key74": "value74", "key75": "value75", "key76": "value76", "key77": "value77", + "key78": "value78", "key79": "value79", "key80": "value80", "key81": "value81", + "key82": "value82", "key83": "value83", "key84": "value84", "key85": "value85", + "key86": "value86", "key87": "value87", "key88": "value88", "key89": "value89", + "key90": "value90", "key91": "value91", "key92": "value92", "key93": "value93", + "key94": "value94", "key95": "value95", "key96": "value96", "key97": "value97", + "key98": "value98", "key99": "value99", "key100": "value100", "key101": "value101", + "key102": "value102", "key103": "value103", "key104": "value104", "key105": + "value105", "key106": "value106", "key107": "value107", "key108": "value108", + "key109": "value109", "key110": "value110", "key111": "value111", "key112": + "value112", "key113": "value113", "key114": "value114", "key115": "value115", + "key116": "value116", "key117": "value117", "key118": "value118", "key119": + "value119", "key120": "value120", "key121": "value121", "key122": "value122", + "key123": "value123", "key124": "value124", "key125": "value125", "key126": + "value126", "key127": "value127", "key128": "value128", "key129": "value129", + "key130": "value130", "key131": "value131", "key132": "value132", "key133": + "value133", "key134": "value134", "key135": "value135", "key136": "value136", + "key137": "value137", "key138": "value138", "key139": "value139", "key140": + "value140", "key141": "value141", "key142": "value142", "key143": "value143", + "key144": "value144", "key145": "value145", "key146": "value146", "key147": + "value147", "key148": "value148", "key149": "value149", "key150": "value150", + "key151": "value151", "key152": "value152", "key153": "value153", "key154": + "value154", "key155": "value155", "key156": "value156", "key157": "value157", + "key158": "value158", "key159": "value159", "key160": "value160", "key161": + "value161", "key162": "value162", "key163": "value163", "key164": "value164", + "key165": "value165", "key166": "value166", "key167": "value167", "key168": + "value168", "key169": "value169", "key170": "value170", "key171": "value171", + "key172": "value172", "key173": "value173", "key174": "value174", "key175": + "value175", "key176": "value176", "key177": "value177", "key178": "value178", + "key179": "value179", "key180": "value180", "key181": "value181", "key182": + "value182", "key183": "value183", "key184": "value184", "key185": "value185", + "key186": "value186", "key187": "value187", "key188": "value188", "key189": + "value189", "key190": "value190", "key191": "value191", "key192": "value192", + "key193": "value193", "key194": "value194", "key195": "value195", "key196": + "value196", "key197": "value197", "key198": "value198", "key199": "value199", + "key200": "value200", "key201": "value201", "key202": "value202", "key203": + "value203", "key204": "value204", "key205": "value205", "key206": "value206", + "key207": "value207", "key208": "value208", "key209": "value209", "key210": + "value210", "key211": "value211", "key212": "value212", "key213": "value213", + "key214": "value214", "key215": "value215", "key216": "value216", "key217": + "value217", "key218": "value218", "key219": "value219", "key220": "value220", + "key221": "value221", "key222": "value222", "key223": "value223", "key224": + "value224", "key225": "value225", "key226": "value226", "key227": "value227", + "key228": "value228", "key229": "value229", "key230": "value230", "key231": + "value231", "key232": "value232", "key233": "value233", "key234": "value234", + "key235": "value235", "key236": "value236", "key237": "value237", "key238": + "value238", "key239": "value239", "key240": "value240", "key241": "value241", + "key242": "value242", "key243": "value243", "key244": "value244", "key245": + "value245", "key246": "value246", "key247": "value247", "key248": "value248", + "key249": "value249", "key250": "value250", "key251": "value251", "key252": + "value252", "key253": "value253", "key254": "value254"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '5444' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:19 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable2c5919f0 + response: + body: + string: '{"odata.error":{"code":"TooManyProperties","message":{"lang":"en-US","value":"The + entity contains more properties than allowed. Each entity can include up to + 252 properties to store data. Each entity also has 3 system properties.\nRequestId:ea5fadab-6002-0032-2a75-6652da000000\nTime:2020-07-30T13:33:18.9421142Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:18 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 400 + message: Bad Request + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable2c5919f0 +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:20 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable2c5919f0') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:18 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable2c5919f0') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_full_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_full_metadata.yaml new file mode 100644 index 000000000000..f2b0b22a505e --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_full_metadata.yaml @@ -0,0 +1,110 @@ +interactions: +- request: + body: '{"TableName": "uttable1172194c"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:20 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable1172194c"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:19 GMT + location: https://storagename.table.core.windows.net/Tables('uttable1172194c') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk1172194c", "RowKey": "rk1172194c", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=fullmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:20 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable1172194c + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable1172194c/@Element","odata.type":"storagename.uttable1172194c","odata.id":"https://storagename.table.core.windows.net/uttable1172194c(PartitionKey=''pk1172194c'',RowKey=''rk1172194c'')","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A19.4416834Z''\"","odata.editLink":"uttable1172194c(PartitionKey=''pk1172194c'',RowKey=''rk1172194c'')","PartitionKey":"pk1172194c","RowKey":"rk1172194c","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2020-07-30T13:33:19.4416834Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=fullmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:19 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A19.4416834Z'" + location: https://storagename.table.core.windows.net/uttable1172194c(PartitionKey='pk1172194c',RowKey='rk1172194c') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable1172194c +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:20 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable1172194c') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:19 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable1172194c') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_hook.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_hook.yaml new file mode 100644 index 000000000000..379da267200c --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_hook.yaml @@ -0,0 +1,110 @@ +interactions: +- request: + body: '{"TableName": "uttable3c3715aa"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:20 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable3c3715aa"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:19 GMT + location: https://storagename.table.core.windows.net/Tables('uttable3c3715aa') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk3c3715aa", "RowKey": "rk3c3715aa", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:20 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:20 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable3c3715aa + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable3c3715aa/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A19.9370096Z''\"","PartitionKey":"pk3c3715aa","RowKey":"rk3c3715aa","Timestamp":"2020-07-30T13:33:19.9370096Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:19 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A19.9370096Z'" + location: https://storagename.table.core.windows.net/uttable3c3715aa(PartitionKey='pk3c3715aa',RowKey='rk3c3715aa') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable3c3715aa +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:21 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable3c3715aa') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:19 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable3c3715aa') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_large_int32_value_throws.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_large_int32_value_throws.yaml new file mode 100644 index 000000000000..1589d29c968a --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_large_int32_value_throws.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: '{"TableName": "uttable3d151d95"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:21 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable3d151d95"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:19 GMT + location: https://storagename.table.core.windows.net/Tables('uttable3d151d95') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:21 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable3d151d95') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:20 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable3d151d95') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_large_int64_value_throws.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_large_int64_value_throws.yaml new file mode 100644 index 000000000000..06958c4d088a --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_large_int64_value_throws.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: '{"TableName": "uttable3d5e1d9a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:21 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable3d5e1d9a"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:20 GMT + location: https://storagename.table.core.windows.net/Tables('uttable3d5e1d9a') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:21 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable3d5e1d9a') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:20 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable3d5e1d9a') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_no_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_no_metadata.yaml new file mode 100644 index 000000000000..19a5e6b24ba0 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_entity_with_no_metadata.yaml @@ -0,0 +1,110 @@ +interactions: +- request: + body: '{"TableName": "uttabledefb1876"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:21 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttabledefb1876"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:20 GMT + location: https://storagename.table.core.windows.net/Tables('uttabledefb1876') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkdefb1876", "RowKey": "rkdefb1876", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=nometadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:22 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttabledefb1876 + response: + body: + string: '{"PartitionKey":"pkdefb1876","RowKey":"rkdefb1876","Timestamp":"2020-07-30T13:33:21.239417Z","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":"933311100","Birthday":"1973-10-04T00:00:00Z","birthday":"1970-10-04T00:00:00Z","binary":"YmluYXJ5","other":20,"clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=nometadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:20 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A21.239417Z'" + location: https://storagename.table.core.windows.net/uttabledefb1876(PartitionKey='pkdefb1876',RowKey='rkdefb1876') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttabledefb1876 +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:22 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttabledefb1876') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:20 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttabledefb1876') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_merge_entity_with_existing_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_merge_entity_with_existing_entity.yaml new file mode 100644 index 000000000000..4520acc7d1fa --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_merge_entity_with_existing_entity.yaml @@ -0,0 +1,179 @@ +interactions: +- request: + body: '{"TableName": "uttable42df1e0f"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:22 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable42df1e0f"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:20 GMT + location: https://storagename.table.core.windows.net/Tables('uttable42df1e0f') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk42df1e0f", "RowKey": "rk42df1e0f", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:22 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable42df1e0f + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable42df1e0f/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A21.7215424Z''\"","PartitionKey":"pk42df1e0f","RowKey":"rk42df1e0f","Timestamp":"2020-07-30T13:33:21.7215424Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:20 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A21.7215424Z'" + location: https://storagename.table.core.windows.net/uttable42df1e0f(PartitionKey='pk42df1e0f',RowKey='rk42df1e0f') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable42df1e0f +- request: + body: '{"PartitionKey": "pk42df1e0f", "RowKey": "rk42df1e0f", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:22 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable42df1e0f(PartitionKey='pk42df1e0f',RowKey='rk42df1e0f') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:20 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A21.7979671Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable42df1e0f(PartitionKey='pk42df1e0f',RowKey='rk42df1e0f') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:22 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable42df1e0f(PartitionKey='pk42df1e0f',RowKey='rk42df1e0f') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable42df1e0f/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A21.7979671Z''\"","PartitionKey":"pk42df1e0f","RowKey":"rk42df1e0f","Timestamp":"2020-07-30T13:33:21.7979671Z","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","age":"abc","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","deceased":false,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","married":true,"other":20,"ratio":3.1,"sex":"female","sign":"aquarius"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:20 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A21.7979671Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable42df1e0f(PartitionKey='pk42df1e0f',RowKey='rk42df1e0f') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:22 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable42df1e0f') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:21 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable42df1e0f') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_merge_entity_with_non_existing_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_merge_entity_with_non_existing_entity.yaml new file mode 100644 index 000000000000..d574267939a7 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_merge_entity_with_non_existing_entity.yaml @@ -0,0 +1,135 @@ +interactions: +- request: + body: '{"TableName": "uttablebeb51fb9"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:23 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablebeb51fb9"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:22 GMT + location: https://storagename.table.core.windows.net/Tables('uttablebeb51fb9') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkbeb51fb9", "RowKey": "rkbeb51fb9", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:23 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttablebeb51fb9(PartitionKey='pkbeb51fb9',RowKey='rkbeb51fb9') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:22 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A22.3793844Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablebeb51fb9(PartitionKey='pkbeb51fb9',RowKey='rkbeb51fb9') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:23 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablebeb51fb9(PartitionKey='pkbeb51fb9',RowKey='rkbeb51fb9') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablebeb51fb9/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A22.3793844Z''\"","PartitionKey":"pkbeb51fb9","RowKey":"rkbeb51fb9","Timestamp":"2020-07-30T13:33:22.3793844Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:22 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A22.3793844Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablebeb51fb9(PartitionKey='pkbeb51fb9',RowKey='rkbeb51fb9') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:23 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablebeb51fb9') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:22 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablebeb51fb9') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_replace_entity_with_existing_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_replace_entity_with_existing_entity.yaml new file mode 100644 index 000000000000..96bdf6ac19f6 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_replace_entity_with_existing_entity.yaml @@ -0,0 +1,179 @@ +interactions: +- request: + body: '{"TableName": "uttable7edf1edb"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:23 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7edf1edb"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:21 GMT + location: https://storagename.table.core.windows.net/Tables('uttable7edf1edb') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk7edf1edb", "RowKey": "rk7edf1edb", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:23 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:23 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable7edf1edb + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable7edf1edb/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A22.9650908Z''\"","PartitionKey":"pk7edf1edb","RowKey":"rk7edf1edb","Timestamp":"2020-07-30T13:33:22.9650908Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:21 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A22.9650908Z'" + location: https://storagename.table.core.windows.net/uttable7edf1edb(PartitionKey='pk7edf1edb',RowKey='rk7edf1edb') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable7edf1edb +- request: + body: '{"PartitionKey": "pk7edf1edb", "RowKey": "rk7edf1edb", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:24 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttable7edf1edb(PartitionKey='pk7edf1edb',RowKey='rk7edf1edb') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:22 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A23.0428641Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable7edf1edb(PartitionKey='pk7edf1edb',RowKey='rk7edf1edb') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:24 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable7edf1edb(PartitionKey='pk7edf1edb',RowKey='rk7edf1edb') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable7edf1edb/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A23.0428641Z''\"","PartitionKey":"pk7edf1edb","RowKey":"rk7edf1edb","Timestamp":"2020-07-30T13:33:23.0428641Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:22 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A23.0428641Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable7edf1edb(PartitionKey='pk7edf1edb',RowKey='rk7edf1edb') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:24 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable7edf1edb') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:22 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable7edf1edb') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_replace_entity_with_non_existing_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_replace_entity_with_non_existing_entity.yaml new file mode 100644 index 000000000000..8bf49e04586f --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_insert_or_replace_entity_with_non_existing_entity.yaml @@ -0,0 +1,135 @@ +interactions: +- request: + body: '{"TableName": "uttablefde52085"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:24 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablefde52085"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:23 GMT + location: https://storagename.table.core.windows.net/Tables('uttablefde52085') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkfde52085", "RowKey": "rkfde52085", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:24 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttablefde52085(PartitionKey='pkfde52085',RowKey='rkfde52085') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:23 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A23.6242812Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablefde52085(PartitionKey='pkfde52085',RowKey='rkfde52085') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:24 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablefde52085(PartitionKey='pkfde52085',RowKey='rkfde52085') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablefde52085/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A23.6242812Z''\"","PartitionKey":"pkfde52085","RowKey":"rkfde52085","Timestamp":"2020-07-30T13:33:23.6242812Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:23 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A23.6242812Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablefde52085(PartitionKey='pkfde52085',RowKey='rkfde52085') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:24 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablefde52085') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:23 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablefde52085') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity.yaml new file mode 100644 index 000000000000..8dc57b3a47bc --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity.yaml @@ -0,0 +1,181 @@ +interactions: +- request: + body: '{"TableName": "uttable641610fa"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:24 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:24 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable641610fa"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:23 GMT + location: https://storagename.table.core.windows.net/Tables('uttable641610fa') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk641610fa", "RowKey": "rk641610fa", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:25 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:25 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable641610fa + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable641610fa/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A24.1995293Z''\"","PartitionKey":"pk641610fa","RowKey":"rk641610fa","Timestamp":"2020-07-30T13:33:24.1995293Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:23 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A24.1995293Z'" + location: https://storagename.table.core.windows.net/uttable641610fa(PartitionKey='pk641610fa',RowKey='rk641610fa') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable641610fa +- request: + body: '{"PartitionKey": "pk641610fa", "RowKey": "rk641610fa", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:25 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:25 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable641610fa(PartitionKey='pk641610fa',RowKey='rk641610fa') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:23 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A24.2867548Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable641610fa(PartitionKey='pk641610fa',RowKey='rk641610fa') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:25 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:25 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable641610fa(PartitionKey='pk641610fa',RowKey='rk641610fa') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable641610fa/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A24.2867548Z''\"","PartitionKey":"pk641610fa","RowKey":"rk641610fa","Timestamp":"2020-07-30T13:33:24.2867548Z","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","age":"abc","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","deceased":false,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","married":true,"other":20,"ratio":3.1,"sex":"female","sign":"aquarius"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:23 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A24.2867548Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable641610fa(PartitionKey='pk641610fa',RowKey='rk641610fa') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:25 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:25 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable641610fa') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:23 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable641610fa') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_not_existing.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_not_existing.yaml new file mode 100644 index 000000000000..0b46ed07058d --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_not_existing.yaml @@ -0,0 +1,109 @@ +interactions: +- request: + body: '{"TableName": "uttable66e91674"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:25 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:25 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable66e91674"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:24 GMT + location: https://storagename.table.core.windows.net/Tables('uttable66e91674') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk66e91674", "RowKey": "rk66e91674", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:25 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:25 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable66e91674(PartitionKey='pk66e91674',RowKey='rk66e91674') + response: + body: + string: 'ResourceNotFoundThe specified resource does not exist. + + RequestId:ae81374a-8002-005e-7276-66f909000000 + + Time:2020-07-30T13:33:24.8775073Z' + headers: + cache-control: no-cache + content-type: application/xml;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:24 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 404 + message: Not Found + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable66e91674(PartitionKey='pk66e91674',RowKey='rk66e91674') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:25 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:25 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable66e91674') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:24 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable66e91674') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_with_if_doesnt_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_with_if_doesnt_match.yaml new file mode 100644 index 000000000000..348da17ccc4a --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_with_if_doesnt_match.yaml @@ -0,0 +1,153 @@ +interactions: +- request: + body: '{"TableName": "uttable279d199b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:26 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:26 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable279d199b"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:24 GMT + location: https://storagename.table.core.windows.net/Tables('uttable279d199b') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk279d199b", "RowKey": "rk279d199b", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:26 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:26 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable279d199b + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable279d199b/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A25.3681155Z''\"","PartitionKey":"pk279d199b","RowKey":"rk279d199b","Timestamp":"2020-07-30T13:33:25.3681155Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:25 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A25.3681155Z'" + location: https://storagename.table.core.windows.net/uttable279d199b(PartitionKey='pk279d199b',RowKey='rk279d199b') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable279d199b +- request: + body: '{"PartitionKey": "pk279d199b", "RowKey": "rk279d199b", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:26 GMT + If-Match: + - W/"datetime'2012-06-15T22%3A51%3A44.9662825Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:26 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttable279d199b(PartitionKey='pk279d199b',RowKey='rk279d199b') + response: + body: + string: 'UpdateConditionNotSatisfiedThe update condition specified in the request was not satisfied. + + RequestId:a318a23c-d002-0064-5c76-66baaa000000 + + Time:2020-07-30T13:33:25.4471689Z' + headers: + cache-control: no-cache + content-type: application/xml;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:25 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 412 + message: Precondition Failed + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable279d199b(PartitionKey='pk279d199b',RowKey='rk279d199b') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:26 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:26 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable279d199b') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:25 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable279d199b') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_with_if_matches.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_with_if_matches.yaml new file mode 100644 index 000000000000..d5fd83830dc2 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_merge_entity_with_if_matches.yaml @@ -0,0 +1,181 @@ +interactions: +- request: + body: '{"TableName": "uttableab731787"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:26 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:26 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttableab731787"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:25 GMT + location: https://storagename.table.core.windows.net/Tables('uttableab731787') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkab731787", "RowKey": "rkab731787", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:26 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:26 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttableab731787 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableab731787/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A25.9352892Z''\"","PartitionKey":"pkab731787","RowKey":"rkab731787","Timestamp":"2020-07-30T13:33:25.9352892Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:25 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A25.9352892Z'" + location: https://storagename.table.core.windows.net/uttableab731787(PartitionKey='pkab731787',RowKey='rkab731787') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttableab731787 +- request: + body: '{"PartitionKey": "pkab731787", "RowKey": "rkab731787", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:27 GMT + If-Match: + - W/"datetime'2020-07-30T13%3A33%3A25.9352892Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:27 GMT + x-ms-version: + - '2019-07-07' + method: PATCH + uri: https://storagename.table.core.windows.net/uttableab731787(PartitionKey='pkab731787',RowKey='rkab731787') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:25 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A26.0170037Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttableab731787(PartitionKey='pkab731787',RowKey='rkab731787') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:27 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttableab731787(PartitionKey='pkab731787',RowKey='rkab731787') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttableab731787/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A26.0170037Z''\"","PartitionKey":"pkab731787","RowKey":"rkab731787","Timestamp":"2020-07-30T13:33:26.0170037Z","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","age":"abc","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","deceased":false,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","married":true,"other":20,"ratio":3.1,"sex":"female","sign":"aquarius"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:25 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A26.0170037Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttableab731787(PartitionKey='pkab731787',RowKey='rkab731787') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:27 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttableab731787') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:26 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttableab731787') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_none_property_value.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_none_property_value.yaml new file mode 100644 index 000000000000..935b170b5dba --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_none_property_value.yaml @@ -0,0 +1,137 @@ +interactions: +- request: + body: '{"TableName": "uttablee7f813fe"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:27 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablee7f813fe"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:25 GMT + location: https://storagename.table.core.windows.net/Tables('uttablee7f813fe') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pke7f813fe", "RowKey": "rke7f813fe"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '54' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:27 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablee7f813fe + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee7f813fe/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A26.5834879Z''\"","PartitionKey":"pke7f813fe","RowKey":"rke7f813fe","Timestamp":"2020-07-30T13:33:26.5834879Z"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:25 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A26.5834879Z'" + location: https://storagename.table.core.windows.net/uttablee7f813fe(PartitionKey='pke7f813fe',RowKey='rke7f813fe') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablee7f813fe +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:27 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablee7f813fe(PartitionKey='pke7f813fe',RowKey='rke7f813fe') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee7f813fe/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A26.5834879Z''\"","PartitionKey":"pke7f813fe","RowKey":"rke7f813fe","Timestamp":"2020-07-30T13:33:26.5834879Z"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:25 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A26.5834879Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablee7f813fe(PartitionKey='pke7f813fe',RowKey='rke7f813fe') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:27 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablee7f813fe') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:25 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablee7f813fe') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_operations_on_entity_with_partition_key_having_single_quote.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_operations_on_entity_with_partition_key_having_single_quote.yaml new file mode 100644 index 000000000000..6b628ec2887d --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_operations_on_entity_with_partition_key_having_single_quote.yaml @@ -0,0 +1,151 @@ +interactions: +- request: + body: '{"TableName": "uttable5da124b0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Fri, 10 Jul 2020 13:55:21 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Fri, 10 Jul 2020 13:55:21 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable5da124b0"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Fri, 10 Jul 2020 13:55:20 GMT + location: https://storagename.table.core.windows.net/Tables('uttable5da124b0') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstoragebwq3yp5o6ygk.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "a''''''''b", "RowKey": "a''''''''b", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '529' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Fri, 10 Jul 2020 13:55:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Fri, 10 Jul 2020 13:55:22 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable5da124b0 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable5da124b0/@Element","odata.etag":"W/\"datetime''2020-07-10T13%3A55%3A21.1923413Z''\"","PartitionKey":"a''''''''b","RowKey":"a''''''''b","Timestamp":"2020-07-10T13:55:21.1923413Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Fri, 10 Jul 2020 13:55:20 GMT + etag: W/"datetime'2020-07-10T13%3A55%3A21.1923413Z'" + location: https://storagename.table.core.windows.net/uttable5da124b0(PartitionKey='a''''''''b',RowKey='a''''''''b') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstoragebwq3yp5o6ygk.table.core.windows.net/uttable5da124b0 +- request: + body: '{"PartitionKey": "a''''''''b", "RowKey": "a''''''''b", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '172' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Fri, 10 Jul 2020 13:55:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Fri, 10 Jul 2020 13:55:22 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttable5da124b0(PartitionKey='a''''b',RowKey='a''''b') + response: + body: + string: 'AuthenticationFailedServer failed to authenticate the request. Make sure the + value of Authorization header is formed correctly including the signature. + + RequestId:dc840ea1-1002-0035-50c1-56faa6000000 + + Time:2020-07-10T13:55:21.2723986Z' + headers: + content-length: '419' + content-type: application/xml + date: Fri, 10 Jul 2020 13:55:21 GMT + server: Microsoft-HTTPAPI/2.0 + x-ms-error-code: AuthenticationFailed + status: + code: 403 + message: Server failed to authenticate the request. Make sure the value of Authorization + header is formed correctly including the signature. + url: https://pyacrstoragebwq3yp5o6ygk.table.core.windows.net/uttable5da124b0(PartitionKey='a''''b',RowKey='a''''b') +- request: + body: null + headers: + Date: + - Fri, 10 Jul 2020 13:55:22 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Fri, 10 Jul 2020 13:55:22 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable5da124b0') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Fri, 10 Jul 2020 13:55:21 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstoragebwq3yp5o6ygk.table.core.windows.net/Tables('uttable5da124b0') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities.yaml new file mode 100644 index 000000000000..dcdeb04dde32 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities.yaml @@ -0,0 +1,250 @@ +interactions: +- request: + body: '{"TableName": "uttable88c411e8"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:27 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:27 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable88c411e8"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:26 GMT + location: https://storagename.table.core.windows.net/Tables('uttable88c411e8') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"TableName": "querytable88c411e8"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:28 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:28 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytable88c411e8"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:26 GMT + location: https://storagename.table.core.windows.net/Tables('querytable88c411e8') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk88c411e8", "RowKey": "rk88c411e81", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:28 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:28 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable88c411e8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable88c411e8/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A27.2270172Z''\"","PartitionKey":"pk88c411e8","RowKey":"rk88c411e81","Timestamp":"2020-07-30T13:33:27.2270172Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:26 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A27.2270172Z'" + location: https://storagename.table.core.windows.net/querytable88c411e8(PartitionKey='pk88c411e8',RowKey='rk88c411e81') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable88c411e8 +- request: + body: '{"PartitionKey": "pk88c411e8", "RowKey": "rk88c411e812", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:28 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:28 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable88c411e8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable88c411e8/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A27.3090776Z''\"","PartitionKey":"pk88c411e8","RowKey":"rk88c411e812","Timestamp":"2020-07-30T13:33:27.3090776Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:26 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A27.3090776Z'" + location: https://storagename.table.core.windows.net/querytable88c411e8(PartitionKey='pk88c411e8',RowKey='rk88c411e812') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable88c411e8 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:28 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:28 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable88c411e8() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable88c411e8","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A27.2270172Z''\"","PartitionKey":"pk88c411e8","RowKey":"rk88c411e81","Timestamp":"2020-07-30T13:33:27.2270172Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A27.3090776Z''\"","PartitionKey":"pk88c411e8","RowKey":"rk88c411e812","Timestamp":"2020-07-30T13:33:27.3090776Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:26 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable88c411e8() +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:28 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:28 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable88c411e8') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:27 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable88c411e8') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:28 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:28 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytable88c411e8') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:27 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('querytable88c411e8') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_full_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_full_metadata.yaml new file mode 100644 index 000000000000..f795f77d9bfb --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_full_metadata.yaml @@ -0,0 +1,250 @@ +interactions: +- request: + body: '{"TableName": "uttableae56179a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:28 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:28 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttableae56179a"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:27 GMT + location: https://storagename.table.core.windows.net/Tables('uttableae56179a') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"TableName": "querytableae56179a"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:28 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:28 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytableae56179a"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:27 GMT + location: https://storagename.table.core.windows.net/Tables('querytableae56179a') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkae56179a", "RowKey": "rkae56179a1", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:29 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:29 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytableae56179a + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytableae56179a/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A28.0729727Z''\"","PartitionKey":"pkae56179a","RowKey":"rkae56179a1","Timestamp":"2020-07-30T13:33:28.0729727Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:27 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A28.0729727Z'" + location: https://storagename.table.core.windows.net/querytableae56179a(PartitionKey='pkae56179a',RowKey='rkae56179a1') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytableae56179a +- request: + body: '{"PartitionKey": "pkae56179a", "RowKey": "rkae56179a12", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:29 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:29 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytableae56179a + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytableae56179a/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A28.1550282Z''\"","PartitionKey":"pkae56179a","RowKey":"rkae56179a12","Timestamp":"2020-07-30T13:33:28.1550282Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:27 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A28.1550282Z'" + location: https://storagename.table.core.windows.net/querytableae56179a(PartitionKey='pkae56179a',RowKey='rkae56179a12') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytableae56179a +- request: + body: null + headers: + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:29 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + accept: + - application/json;odata=fullmetadata + x-ms-date: + - Thu, 30 Jul 2020 13:33:29 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytableae56179a() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytableae56179a","value":[{"odata.type":"storagename.querytableae56179a","odata.id":"https://storagename.table.core.windows.net/querytableae56179a(PartitionKey=''pkae56179a'',RowKey=''rkae56179a1'')","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A28.0729727Z''\"","odata.editLink":"querytableae56179a(PartitionKey=''pkae56179a'',RowKey=''rkae56179a1'')","PartitionKey":"pkae56179a","RowKey":"rkae56179a1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2020-07-30T13:33:28.0729727Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"odata.type":"storagename.querytableae56179a","odata.id":"https://storagename.table.core.windows.net/querytableae56179a(PartitionKey=''pkae56179a'',RowKey=''rkae56179a12'')","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A28.1550282Z''\"","odata.editLink":"querytableae56179a(PartitionKey=''pkae56179a'',RowKey=''rkae56179a12'')","PartitionKey":"pkae56179a","RowKey":"rkae56179a12","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2020-07-30T13:33:28.1550282Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=fullmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:27 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytableae56179a() +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:29 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:29 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttableae56179a') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:27 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttableae56179a') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:29 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:29 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytableae56179a') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:27 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('querytableae56179a') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_no_metadata.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_no_metadata.yaml new file mode 100644 index 000000000000..b137d54d1715 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_no_metadata.yaml @@ -0,0 +1,250 @@ +interactions: +- request: + body: '{"TableName": "uttable7f5216c4"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:29 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:29 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7f5216c4"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:28 GMT + location: https://storagename.table.core.windows.net/Tables('uttable7f5216c4') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"TableName": "querytable7f5216c4"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:29 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:29 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytable7f5216c4"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:28 GMT + location: https://storagename.table.core.windows.net/Tables('querytable7f5216c4') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk7f5216c4", "RowKey": "rk7f5216c41", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:29 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:29 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable7f5216c4 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable7f5216c4/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A28.8912087Z''\"","PartitionKey":"pk7f5216c4","RowKey":"rk7f5216c41","Timestamp":"2020-07-30T13:33:28.8912087Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:28 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A28.8912087Z'" + location: https://storagename.table.core.windows.net/querytable7f5216c4(PartitionKey='pk7f5216c4',RowKey='rk7f5216c41') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable7f5216c4 +- request: + body: '{"PartitionKey": "pk7f5216c4", "RowKey": "rk7f5216c412", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:29 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:29 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable7f5216c4 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable7f5216c4/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A28.9752708Z''\"","PartitionKey":"pk7f5216c4","RowKey":"rk7f5216c412","Timestamp":"2020-07-30T13:33:28.9752708Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:28 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A28.9752708Z'" + location: https://storagename.table.core.windows.net/querytable7f5216c4(PartitionKey='pk7f5216c4',RowKey='rk7f5216c412') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable7f5216c4 +- request: + body: null + headers: + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:30 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + accept: + - application/json;odata=nometadata + x-ms-date: + - Thu, 30 Jul 2020 13:33:30 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable7f5216c4() + response: + body: + string: '{"value":[{"PartitionKey":"pk7f5216c4","RowKey":"rk7f5216c41","Timestamp":"2020-07-30T13:33:28.8912087Z","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":"933311100","Birthday":"1973-10-04T00:00:00Z","birthday":"1970-10-04T00:00:00Z","binary":"YmluYXJ5","other":20,"clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"PartitionKey":"pk7f5216c4","RowKey":"rk7f5216c412","Timestamp":"2020-07-30T13:33:28.9752708Z","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":"933311100","Birthday":"1973-10-04T00:00:00Z","birthday":"1970-10-04T00:00:00Z","binary":"YmluYXJ5","other":20,"clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=nometadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:28 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable7f5216c4() +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:30 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:30 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable7f5216c4') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:28 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable7f5216c4') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:30 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:30 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytable7f5216c4') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:29 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('querytable7f5216c4') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_filter.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_filter.yaml new file mode 100644 index 000000000000..62d2b7e7fb87 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_filter.yaml @@ -0,0 +1,142 @@ +interactions: +- request: + body: '{"TableName": "uttable800416e8"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:30 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:30 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable800416e8"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:28 GMT + location: https://storagename.table.core.windows.net/Tables('uttable800416e8') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk800416e8", "RowKey": "rk800416e8", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:30 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:30 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable800416e8 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable800416e8/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A29.6529072Z''\"","PartitionKey":"pk800416e8","RowKey":"rk800416e8","Timestamp":"2020-07-30T13:33:29.6529072Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:28 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A29.6529072Z'" + location: https://storagename.table.core.windows.net/uttable800416e8(PartitionKey='pk800416e8',RowKey='rk800416e8') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable800416e8 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:30 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:30 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable800416e8() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable800416e8","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A29.6529072Z''\"","PartitionKey":"pk800416e8","RowKey":"rk800416e8","Timestamp":"2020-07-30T13:33:29.6529072Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:28 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable800416e8() +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:30 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:30 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable800416e8') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:28 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable800416e8') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_select.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_select.yaml new file mode 100644 index 000000000000..3df27b738929 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_select.yaml @@ -0,0 +1,250 @@ +interactions: +- request: + body: '{"TableName": "uttable800f16e2"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:30 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:30 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable800f16e2"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:30 GMT + location: https://storagename.table.core.windows.net/Tables('uttable800f16e2') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"TableName": "querytable800f16e2"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:31 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:31 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytable800f16e2"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:30 GMT + location: https://storagename.table.core.windows.net/Tables('querytable800f16e2') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk800f16e2", "RowKey": "rk800f16e21", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:31 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:31 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable800f16e2 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable800f16e2/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A30.5282919Z''\"","PartitionKey":"pk800f16e2","RowKey":"rk800f16e21","Timestamp":"2020-07-30T13:33:30.5282919Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:30 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A30.5282919Z'" + location: https://storagename.table.core.windows.net/querytable800f16e2(PartitionKey='pk800f16e2',RowKey='rk800f16e21') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable800f16e2 +- request: + body: '{"PartitionKey": "pk800f16e2", "RowKey": "rk800f16e212", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:31 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:31 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable800f16e2 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable800f16e2/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A30.6073436Z''\"","PartitionKey":"pk800f16e2","RowKey":"rk800f16e212","Timestamp":"2020-07-30T13:33:30.6073436Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:30 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A30.6073436Z'" + location: https://storagename.table.core.windows.net/querytable800f16e2(PartitionKey='pk800f16e2',RowKey='rk800f16e212') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable800f16e2 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:31 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:31 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable800f16e2()?$select=age,%20sex + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable800f16e2&$select=age,%20sex","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A30.5282919Z''\"","age@odata.type":"Edm.Int64","age":"39","sex":"male"},{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A30.6073436Z''\"","age@odata.type":"Edm.Int64","age":"39","sex":"male"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:30 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable800f16e2()?$select=age,%20sex +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:31 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:31 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable800f16e2') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:30 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable800f16e2') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:31 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:31 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytable800f16e2') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:30 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('querytable800f16e2') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_top.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_top.yaml new file mode 100644 index 000000000000..af7f41dca97d --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_top.yaml @@ -0,0 +1,328 @@ +interactions: +- request: + body: '{"TableName": "uttable3ccf15b5"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:31 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:31 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable3ccf15b5"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:31 GMT + location: https://storagename.table.core.windows.net/Tables('uttable3ccf15b5') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"TableName": "querytable3ccf15b5"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:32 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:32 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytable3ccf15b5"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:31 GMT + location: https://storagename.table.core.windows.net/Tables('querytable3ccf15b5') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk3ccf15b5", "RowKey": "rk3ccf15b51", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:32 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:32 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable3ccf15b5 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable3ccf15b5/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A31.3262287Z''\"","PartitionKey":"pk3ccf15b5","RowKey":"rk3ccf15b51","Timestamp":"2020-07-30T13:33:31.3262287Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:31 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A31.3262287Z'" + location: https://storagename.table.core.windows.net/querytable3ccf15b5(PartitionKey='pk3ccf15b5',RowKey='rk3ccf15b51') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable3ccf15b5 +- request: + body: '{"PartitionKey": "pk3ccf15b5", "RowKey": "rk3ccf15b512", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:32 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:32 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable3ccf15b5 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable3ccf15b5/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A31.4082838Z''\"","PartitionKey":"pk3ccf15b5","RowKey":"rk3ccf15b512","Timestamp":"2020-07-30T13:33:31.4082838Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:31 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A31.4082838Z'" + location: https://storagename.table.core.windows.net/querytable3ccf15b5(PartitionKey='pk3ccf15b5',RowKey='rk3ccf15b512') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable3ccf15b5 +- request: + body: '{"PartitionKey": "pk3ccf15b5", "RowKey": "rk3ccf15b5123", "age": "39", + "age@odata.type": "Edm.Int64", "sex": "male", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", + "Birthday": "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": + "1970-10-04T00:00:00Z", "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", + "binary@odata.type": "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '540' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:32 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:32 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable3ccf15b5 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable3ccf15b5/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A31.4863362Z''\"","PartitionKey":"pk3ccf15b5","RowKey":"rk3ccf15b5123","Timestamp":"2020-07-30T13:33:31.4863362Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:31 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A31.4863362Z'" + location: https://storagename.table.core.windows.net/querytable3ccf15b5(PartitionKey='pk3ccf15b5',RowKey='rk3ccf15b5123') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable3ccf15b5 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:32 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:32 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable3ccf15b5()?$top=2 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable3ccf15b5","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A31.3262287Z''\"","PartitionKey":"pk3ccf15b5","RowKey":"rk3ccf15b51","Timestamp":"2020-07-30T13:33:31.3262287Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A31.4082838Z''\"","PartitionKey":"pk3ccf15b5","RowKey":"rk3ccf15b512","Timestamp":"2020-07-30T13:33:31.4082838Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:31 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-continuation-nextpartitionkey: 1!16!cGszY2NmMTViNQ-- + x-ms-continuation-nextrowkey: 1!20!cmszY2NmMTViNTEyMw-- + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable3ccf15b5()?$top=2 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:32 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:32 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable3ccf15b5()?$top=2&NextPartitionKey=1!16!cGszY2NmMTViNQ--&NextRowKey=1!20!cmszY2NmMTViNTEyMw-- + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable3ccf15b5","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A31.4863362Z''\"","PartitionKey":"pk3ccf15b5","RowKey":"rk3ccf15b5123","Timestamp":"2020-07-30T13:33:31.4863362Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:31 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable3ccf15b5()?$top=2&NextPartitionKey=1!16!cGszY2NmMTViNQ--&NextRowKey=1!20!cmszY2NmMTViNTEyMw-- +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:32 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:32 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable3ccf15b5') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:31 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable3ccf15b5') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:32 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:32 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytable3ccf15b5') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:31 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('querytable3ccf15b5') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_top_and_next.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_top_and_next.yaml new file mode 100644 index 000000000000..0fedde43bb5a --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_entities_with_top_and_next.yaml @@ -0,0 +1,450 @@ +interactions: +- request: + body: '{"TableName": "uttable121a1965"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:32 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:32 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable121a1965"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:31 GMT + location: https://storagename.table.core.windows.net/Tables('uttable121a1965') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"TableName": "querytable121a1965"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:33 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:33 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytable121a1965"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:31 GMT + location: https://storagename.table.core.windows.net/Tables('querytable121a1965') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk121a1965", "RowKey": "rk121a19651", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '538' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:33 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:33 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable121a1965 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable121a1965/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A32.3079379Z''\"","PartitionKey":"pk121a1965","RowKey":"rk121a19651","Timestamp":"2020-07-30T13:33:32.3079379Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A32.3079379Z'" + location: https://storagename.table.core.windows.net/querytable121a1965(PartitionKey='pk121a1965',RowKey='rk121a19651') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable121a1965 +- request: + body: '{"PartitionKey": "pk121a1965", "RowKey": "rk121a196512", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '539' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:33 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:33 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable121a1965 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable121a1965/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A32.3849929Z''\"","PartitionKey":"pk121a1965","RowKey":"rk121a196512","Timestamp":"2020-07-30T13:33:32.3849929Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A32.3849929Z'" + location: https://storagename.table.core.windows.net/querytable121a1965(PartitionKey='pk121a1965',RowKey='rk121a196512') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable121a1965 +- request: + body: '{"PartitionKey": "pk121a1965", "RowKey": "rk121a1965123", "age": "39", + "age@odata.type": "Edm.Int64", "sex": "male", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", + "Birthday": "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": + "1970-10-04T00:00:00Z", "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", + "binary@odata.type": "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '540' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:33 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:33 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable121a1965 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable121a1965/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A32.4630479Z''\"","PartitionKey":"pk121a1965","RowKey":"rk121a1965123","Timestamp":"2020-07-30T13:33:32.4630479Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A32.4630479Z'" + location: https://storagename.table.core.windows.net/querytable121a1965(PartitionKey='pk121a1965',RowKey='rk121a1965123') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable121a1965 +- request: + body: '{"PartitionKey": "pk121a1965", "RowKey": "rk121a19651234", "age": "39", + "age@odata.type": "Edm.Int64", "sex": "male", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", + "Birthday": "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": + "1970-10-04T00:00:00Z", "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", + "binary@odata.type": "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '541' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:33 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:33 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable121a1965 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable121a1965/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A32.5411024Z''\"","PartitionKey":"pk121a1965","RowKey":"rk121a19651234","Timestamp":"2020-07-30T13:33:32.5411024Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A32.5411024Z'" + location: https://storagename.table.core.windows.net/querytable121a1965(PartitionKey='pk121a1965',RowKey='rk121a19651234') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable121a1965 +- request: + body: '{"PartitionKey": "pk121a1965", "RowKey": "rk121a196512345", "age": "39", + "age@odata.type": "Edm.Int64", "sex": "male", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", + "Birthday": "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": + "1970-10-04T00:00:00Z", "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", + "binary@odata.type": "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '542' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:33 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:33 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/querytable121a1965 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable121a1965/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A32.6241603Z''\"","PartitionKey":"pk121a1965","RowKey":"rk121a196512345","Timestamp":"2020-07-30T13:33:32.6241603Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A32.6241603Z'" + location: https://storagename.table.core.windows.net/querytable121a1965(PartitionKey='pk121a1965',RowKey='rk121a196512345') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable121a1965 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:33 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:33 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable121a1965()?$top=2 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable121a1965","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A32.3079379Z''\"","PartitionKey":"pk121a1965","RowKey":"rk121a19651","Timestamp":"2020-07-30T13:33:32.3079379Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A32.3849929Z''\"","PartitionKey":"pk121a1965","RowKey":"rk121a196512","Timestamp":"2020-07-30T13:33:32.3849929Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-continuation-nextpartitionkey: 1!16!cGsxMjFhMTk2NQ-- + x-ms-continuation-nextrowkey: 1!20!cmsxMjFhMTk2NTEyMw-- + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable121a1965()?$top=2 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:33 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:33 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable121a1965()?$top=2&NextPartitionKey=1!16!cGsxMjFhMTk2NQ--&NextRowKey=1!20!cmsxMjFhMTk2NTEyMw-- + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable121a1965","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A32.4630479Z''\"","PartitionKey":"pk121a1965","RowKey":"rk121a1965123","Timestamp":"2020-07-30T13:33:32.4630479Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"},{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A32.5411024Z''\"","PartitionKey":"pk121a1965","RowKey":"rk121a19651234","Timestamp":"2020-07-30T13:33:32.5411024Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-continuation-nextpartitionkey: 1!16!cGsxMjFhMTk2NQ-- + x-ms-continuation-nextrowkey: 1!20!cmsxMjFhMTk2NTEyMzQ1 + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable121a1965()?$top=2&NextPartitionKey=1!16!cGsxMjFhMTk2NQ--&NextRowKey=1!20!cmsxMjFhMTk2NTEyMw-- +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:33 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:33 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytable121a1965()?$top=2&NextPartitionKey=1!16!cGsxMjFhMTk2NQ--&NextRowKey=1!20!cmsxMjFhMTk2NTEyMzQ1 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytable121a1965","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A32.6241603Z''\"","PartitionKey":"pk121a1965","RowKey":"rk121a196512345","Timestamp":"2020-07-30T13:33:32.6241603Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytable121a1965()?$top=2&NextPartitionKey=1!16!cGsxMjFhMTk2NQ--&NextRowKey=1!20!cmsxMjFhMTk2NTEyMzQ1 +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:33 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:33 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable121a1965') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:32 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable121a1965') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:34 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytable121a1965') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:32 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('querytable121a1965') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_zero_entities.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_zero_entities.yaml new file mode 100644 index 000000000000..e85ccf3abfcb --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_query_zero_entities.yaml @@ -0,0 +1,162 @@ +interactions: +- request: + body: '{"TableName": "uttablee8d41407"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:34 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablee8d41407"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + location: https://storagename.table.core.windows.net/Tables('uttablee8d41407') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"TableName": "querytablee8d41407"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '35' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:34 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"querytablee8d41407"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + location: https://storagename.table.core.windows.net/Tables('querytablee8d41407') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:34 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/querytablee8d41407() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#querytablee8d41407","value":[]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:32 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/querytablee8d41407() +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:34 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablee8d41407') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:33 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablee8d41407') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:34 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('querytablee8d41407') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:33 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('querytablee8d41407') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add.yaml new file mode 100644 index 000000000000..3b20767dc4cc --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add.yaml @@ -0,0 +1,143 @@ +interactions: +- request: + body: '{"TableName": "uttable13ae0ebd"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:34 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:34 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable13ae0ebd"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:33 GMT + location: https://storagename.table.core.windows.net/Tables('uttable13ae0ebd') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk13ae0ebd", "RowKey": "rk13ae0ebd", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:35 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable13ae0ebd?st=2020-07-30T13:32:35Z&se=2020-07-30T14:33:35Z&sp=a&sv=2019-07-07&tn=uttable13ae0ebd&sig=WxzHZgYHDTlzLoEOhOtqM2qCfpzt/sMOfTbaHPOn58s%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable13ae0ebd/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A34.3757525Z''\"","PartitionKey":"pk13ae0ebd","RowKey":"rk13ae0ebd","Timestamp":"2020-07-30T13:33:34.3757525Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:33 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A34.3757525Z'" + location: https://storagename.table.core.windows.net/uttable13ae0ebd(PartitionKey='pk13ae0ebd',RowKey='rk13ae0ebd') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable13ae0ebd?st=2020-07-30T13:32:35Z&se=2020-07-30T14:33:35Z&sp=a&sv=2019-07-07&tn=uttable13ae0ebd&sig=WxzHZgYHDTlzLoEOhOtqM2qCfpzt/sMOfTbaHPOn58s%3D +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:35 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable13ae0ebd(PartitionKey='pk13ae0ebd',RowKey='rk13ae0ebd') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable13ae0ebd/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A34.3757525Z''\"","PartitionKey":"pk13ae0ebd","RowKey":"rk13ae0ebd","Timestamp":"2020-07-30T13:33:34.3757525Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:33 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A34.3757525Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable13ae0ebd(PartitionKey='pk13ae0ebd',RowKey='rk13ae0ebd') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:35 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable13ae0ebd') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:33 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable13ae0ebd') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add_inside_range.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add_inside_range.yaml new file mode 100644 index 000000000000..24a27ff11755 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add_inside_range.yaml @@ -0,0 +1,143 @@ +interactions: +- request: + body: '{"TableName": "uttablef8471404"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:35 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablef8471404"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:34 GMT + location: https://storagename.table.core.windows.net/Tables('uttablef8471404') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "test", "RowKey": "test1", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '526' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:35 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:35 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablef8471404?se=2020-07-30T14:33:35Z&sp=a&sv=2019-07-07&tn=uttablef8471404&spk=test&srk=test1&epk=test&erk=test1&sig=7duoTvsLWKu/FhiLqPQM5VxWnCc/a4fARPfYUuPOqZw%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablef8471404/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A35.2671919Z''\"","PartitionKey":"test","RowKey":"test1","Timestamp":"2020-07-30T13:33:35.2671919Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:34 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A35.2671919Z'" + location: https://storagename.table.core.windows.net/uttablef8471404(PartitionKey='test',RowKey='test1') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablef8471404?se=2020-07-30T14:33:35Z&sp=a&sv=2019-07-07&tn=uttablef8471404&spk=test&srk=test1&epk=test&erk=test1&sig=7duoTvsLWKu/FhiLqPQM5VxWnCc/a4fARPfYUuPOqZw%3D +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:36 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:36 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablef8471404(PartitionKey='test',RowKey='test1') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablef8471404/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A35.2671919Z''\"","PartitionKey":"test","RowKey":"test1","Timestamp":"2020-07-30T13:33:35.2671919Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:34 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A35.2671919Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablef8471404(PartitionKey='test',RowKey='test1') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:36 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:36 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablef8471404') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:35 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablef8471404') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add_outside_range.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add_outside_range.yaml new file mode 100644 index 000000000000..b3ccdbcfd505 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_add_outside_range.yaml @@ -0,0 +1,109 @@ +interactions: +- request: + body: '{"TableName": "uttablede71485"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '31' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:36 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:36 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablede71485"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:35 GMT + location: https://storagename.table.core.windows.net/Tables('uttablede71485') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkde71485", "RowKey": "rkde71485", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '535' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:36 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:36 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablede71485?se=2020-07-30T14:33:36Z&sp=a&sv=2019-07-07&tn=uttablede71485&spk=test&srk=test1&epk=test&erk=test1&sig=TwwbtbiFSisOHC74dgcQHfcipNxl2Nw15ydMVKpJ9U4%3D + response: + body: + string: '{"odata.error":{"code":"AuthorizationFailure","message":{"lang":"en-US","value":"This + request is not authorized to perform this operation.\nRequestId:552d0ca1-f002-0073-1f76-667ac9000000\nTime:2020-07-30T13:33:36.0762491Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:35 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 403 + message: Forbidden + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablede71485?se=2020-07-30T14:33:36Z&sp=a&sv=2019-07-07&tn=uttablede71485&spk=test&srk=test1&epk=test&erk=test1&sig=TwwbtbiFSisOHC74dgcQHfcipNxl2Nw15ydMVKpJ9U4%3D +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:37 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablede71485') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:35 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablede71485') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_delete.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_delete.yaml new file mode 100644 index 000000000000..92a1f0000070 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_delete.yaml @@ -0,0 +1,174 @@ +interactions: +- request: + body: '{"TableName": "uttable42981007"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:37 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable42981007"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:35 GMT + location: https://storagename.table.core.windows.net/Tables('uttable42981007') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk42981007", "RowKey": "rk42981007", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:37 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable42981007 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable42981007/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A36.5681979Z''\"","PartitionKey":"pk42981007","RowKey":"rk42981007","Timestamp":"2020-07-30T13:33:36.5681979Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:35 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A36.5681979Z'" + location: https://storagename.table.core.windows.net/uttable42981007(PartitionKey='pk42981007',RowKey='rk42981007') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable42981007 +- request: + body: null + headers: + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:37 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:37 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/uttable42981007(PartitionKey='pk42981007',RowKey='rk42981007')?se=2020-07-30T14:33:37Z&sp=d&sv=2019-07-07&tn=uttable42981007&sig=4Z9kxh5oJNJvciPDm3x52tEKQ7RkjwQ6dz2/zZIBHAo%3D + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:36 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable42981007(PartitionKey='pk42981007',RowKey='rk42981007')?se=2020-07-30T14:33:37Z&sp=d&sv=2019-07-07&tn=uttable42981007&sig=4Z9kxh5oJNJvciPDm3x52tEKQ7RkjwQ6dz2/zZIBHAo%3D +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:37 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:37 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable42981007(PartitionKey='pk42981007',RowKey='rk42981007') + response: + body: + string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:ab8779d8-d002-004d-5a76-66cce8000000\nTime:2020-07-30T13:33:36.9524748Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:36 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 404 + message: Not Found + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable42981007(PartitionKey='pk42981007',RowKey='rk42981007') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:38 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable42981007') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:36 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable42981007') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_query.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_query.yaml new file mode 100644 index 000000000000..159f9d6cf355 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_query.yaml @@ -0,0 +1,142 @@ +interactions: +- request: + body: '{"TableName": "uttable331c0fca"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:38 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable331c0fca"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:36 GMT + location: https://storagename.table.core.windows.net/Tables('uttable331c0fca') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk331c0fca", "RowKey": "rk331c0fca", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:38 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable331c0fca + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable331c0fca/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A37.4490452Z''\"","PartitionKey":"pk331c0fca","RowKey":"rk331c0fca","Timestamp":"2020-07-30T13:33:37.4490452Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:36 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A37.4490452Z'" + location: https://storagename.table.core.windows.net/uttable331c0fca(PartitionKey='pk331c0fca',RowKey='rk331c0fca') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable331c0fca +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:38 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable331c0fca()?st=2020-07-30T13:32:38Z&se=2020-07-30T14:33:38Z&sp=r&sv=2019-07-07&tn=uttable331c0fca&sig=3rch/4gu9Mvfd4m3oaojF5iruQ8d4qQgSVcSD/GfRIw%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable331c0fca","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A37.4490452Z''\"","PartitionKey":"pk331c0fca","RowKey":"rk331c0fca","Timestamp":"2020-07-30T13:33:37.4490452Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:37 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable331c0fca()?st=2020-07-30T13:32:38Z&se=2020-07-30T14:33:38Z&sp=r&sv=2019-07-07&tn=uttable331c0fca&sig=3rch/4gu9Mvfd4m3oaojF5iruQ8d4qQgSVcSD/GfRIw%3D +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:38 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable331c0fca') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:37 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable331c0fca') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_signed_identifier.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_signed_identifier.yaml new file mode 100644 index 000000000000..7619d39d62fe --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_signed_identifier.yaml @@ -0,0 +1,175 @@ +interactions: +- request: + body: '{"TableName": "uttablee481490"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '31' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:38 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:38 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablee481490"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:37 GMT + location: https://storagename.table.core.windows.net/Tables('uttablee481490') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pke481490", "RowKey": "rke481490", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '535' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:39 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablee481490 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee481490/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A38.2608037Z''\"","PartitionKey":"pke481490","RowKey":"rke481490","Timestamp":"2020-07-30T13:33:38.2608037Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:37 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A38.2608037Z'" + location: https://storagename.table.core.windows.net/uttablee481490(PartitionKey='pke481490',RowKey='rke481490') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablee481490 +- request: + body: ' + + testid2011-10-11T00:00:00Z2020-10-12T00:00:00Zr' + headers: + Accept: + - application/xml + Content-Length: + - '257' + Content-Type: + - application/xml + Date: + - Thu, 30 Jul 2020 13:33:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:39 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttablee481490?comp=acl + response: + body: + string: '' + headers: + content-length: '0' + date: Thu, 30 Jul 2020 13:33:38 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablee481490?comp=acl +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:39 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablee481490()?sv=2019-07-07&si=testid&tn=uttablee481490&sig=RWZ1rGuXKKZLqORU0cZb%2BJNGhO3/2QlfMY0Osw1Ukmo%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablee481490","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A38.2608037Z''\"","PartitionKey":"pke481490","RowKey":"rke481490","Timestamp":"2020-07-30T13:33:38.2608037Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:38 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablee481490()?sv=2019-07-07&si=testid&tn=uttablee481490&sig=RWZ1rGuXKKZLqORU0cZb%2BJNGhO3/2QlfMY0Osw1Ukmo%3D +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:39 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablee481490') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:38 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablee481490') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_update.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_update.yaml new file mode 100644 index 000000000000..f224177c6b42 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_update.yaml @@ -0,0 +1,181 @@ +interactions: +- request: + body: '{"TableName": "uttable43091017"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:39 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:39 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable43091017"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:38 GMT + location: https://storagename.table.core.windows.net/Tables('uttable43091017') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk43091017", "RowKey": "rk43091017", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:40 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:40 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable43091017 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable43091017/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A39.2403647Z''\"","PartitionKey":"pk43091017","RowKey":"rk43091017","Timestamp":"2020-07-30T13:33:39.2403647Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:38 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A39.2403647Z'" + location: https://storagename.table.core.windows.net/uttable43091017(PartitionKey='pk43091017',RowKey='rk43091017') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable43091017 +- request: + body: '{"PartitionKey": "pk43091017", "RowKey": "rk43091017", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:40 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:40 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttable43091017(PartitionKey='pk43091017',RowKey='rk43091017')?se=2020-07-30T14:33:40Z&sp=u&sv=2019-07-07&tn=uttable43091017&sig=/M5WdeL2zW%2B%2Biy3EwaS/ceaedpQXFs0OMKWXRdfnaCs%3D + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:39 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A39.5627442Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable43091017(PartitionKey='pk43091017',RowKey='rk43091017')?se=2020-07-30T14:33:40Z&sp=u&sv=2019-07-07&tn=uttable43091017&sig=/M5WdeL2zW%2B%2Biy3EwaS/ceaedpQXFs0OMKWXRdfnaCs%3D +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:40 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:40 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable43091017(PartitionKey='pk43091017',RowKey='rk43091017') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable43091017/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A39.5627442Z''\"","PartitionKey":"pk43091017","RowKey":"rk43091017","Timestamp":"2020-07-30T13:33:39.5627442Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:39 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A39.5627442Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable43091017(PartitionKey='pk43091017',RowKey='rk43091017') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:40 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:40 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable43091017') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:39 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable43091017') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_upper_case_table_name.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_upper_case_table_name.yaml new file mode 100644 index 000000000000..5341421c5fe8 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_sas_upper_case_table_name.yaml @@ -0,0 +1,142 @@ +interactions: +- request: + body: '{"TableName": "uttable65261622"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:40 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:40 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable65261622"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:39 GMT + location: https://storagename.table.core.windows.net/Tables('uttable65261622') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk65261622", "RowKey": "rk65261622", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:41 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable65261622 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable65261622/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A40.1430638Z''\"","PartitionKey":"pk65261622","RowKey":"rk65261622","Timestamp":"2020-07-30T13:33:40.1430638Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:39 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A40.1430638Z'" + location: https://storagename.table.core.windows.net/uttable65261622(PartitionKey='pk65261622',RowKey='rk65261622') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable65261622 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:41 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable65261622()?st=2020-07-30T13:32:41Z&se=2020-07-30T14:33:41Z&sp=r&sv=2019-07-07&tn=UTTABLE65261622&sig=8sgKEU7fUTZ87pIwZNa7aZMUE6bs5YtrYTEBfgSa7Pc%3D + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable65261622","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A40.1430638Z''\"","PartitionKey":"pk65261622","RowKey":"rk65261622","Timestamp":"2020-07-30T13:33:40.1430638Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:39 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable65261622()?st=2020-07-30T13:32:41Z&se=2020-07-30T14:33:41Z&sp=r&sv=2019-07-07&tn=UTTABLE65261622&sig=8sgKEU7fUTZ87pIwZNa7aZMUE6bs5YtrYTEBfgSa7Pc%3D +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:41 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable65261622') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:40 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable65261622') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_timezone.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_timezone.yaml new file mode 100644 index 000000000000..b0c69c3ce162 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_timezone.yaml @@ -0,0 +1,138 @@ +interactions: +- request: + body: '{"TableName": "uttable23a30f59"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:41 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable23a30f59"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:40 GMT + location: https://storagename.table.core.windows.net/Tables('uttable23a30f59') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk23a30f59", "RowKey": "rk23a30f59", "date": "2003-09-27T09:52:43Z", + "date@odata.type": "Edm.DateTime"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '121' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:41 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable23a30f59 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable23a30f59/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A40.9211942Z''\"","PartitionKey":"pk23a30f59","RowKey":"rk23a30f59","Timestamp":"2020-07-30T13:33:40.9211942Z","date@odata.type":"Edm.DateTime","date":"2003-09-27T09:52:43Z"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:40 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A40.9211942Z'" + location: https://storagename.table.core.windows.net/uttable23a30f59(PartitionKey='pk23a30f59',RowKey='rk23a30f59') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable23a30f59 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:41 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:41 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable23a30f59(PartitionKey='pk23a30f59',RowKey='rk23a30f59') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable23a30f59/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A40.9211942Z''\"","PartitionKey":"pk23a30f59","RowKey":"rk23a30f59","Timestamp":"2020-07-30T13:33:40.9211942Z","date@odata.type":"Edm.DateTime","date":"2003-09-27T09:52:43Z"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:40 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A40.9211942Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable23a30f59(PartitionKey='pk23a30f59',RowKey='rk23a30f59') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:42 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable23a30f59') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:40 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable23a30f59') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_unicode_property_name.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_unicode_property_name.yaml new file mode 100644 index 000000000000..088e51bb0e13 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_unicode_property_name.yaml @@ -0,0 +1,176 @@ +interactions: +- request: + body: '{"TableName": "uttable103b14b9"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:42 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable103b14b9"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:40 GMT + location: https://storagename.table.core.windows.net/Tables('uttable103b14b9') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk103b14b9", "RowKey": "rk103b14b9", "\u554a\u9f44\u4e02\u72db\u72dc": + "\ua015"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '98' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:42 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable103b14b9 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable103b14b9/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A41.4943173Z''\"","PartitionKey":"pk103b14b9","RowKey":"rk103b14b9","Timestamp":"2020-07-30T13:33:41.4943173Z","\u554a\u9f44\u4e02\u72db\u72dc":"\ua015"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:40 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A41.4943173Z'" + location: https://storagename.table.core.windows.net/uttable103b14b9(PartitionKey='pk103b14b9',RowKey='rk103b14b9') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable103b14b9 +- request: + body: '{"PartitionKey": "pk103b14b9", "RowKey": "test2", "\u554a\u9f44\u4e02\u72db\u72dc": + "hello"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '92' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:42 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable103b14b9 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable103b14b9/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A41.5763716Z''\"","PartitionKey":"pk103b14b9","RowKey":"test2","Timestamp":"2020-07-30T13:33:41.5763716Z","\u554a\u9f44\u4e02\u72db\u72dc":"hello"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:40 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A41.5763716Z'" + location: https://storagename.table.core.windows.net/uttable103b14b9(PartitionKey='pk103b14b9',RowKey='test2') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable103b14b9 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:42 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable103b14b9() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable103b14b9","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A41.4943173Z''\"","PartitionKey":"pk103b14b9","RowKey":"rk103b14b9","Timestamp":"2020-07-30T13:33:41.4943173Z","\u554a\u9f44\u4e02\u72db\u72dc":"\ua015"},{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A41.5763716Z''\"","PartitionKey":"pk103b14b9","RowKey":"test2","Timestamp":"2020-07-30T13:33:41.5763716Z","\u554a\u9f44\u4e02\u72db\u72dc":"hello"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:41 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable103b14b9() +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:42 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable103b14b9') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:41 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable103b14b9') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_unicode_property_value.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_unicode_property_value.yaml new file mode 100644 index 000000000000..779fda5149a2 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_unicode_property_value.yaml @@ -0,0 +1,174 @@ +interactions: +- request: + body: '{"TableName": "uttable259e1535"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:42 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:42 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable259e1535"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:41 GMT + location: https://storagename.table.core.windows.net/Tables('uttable259e1535') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk259e1535", "RowKey": "rk259e1535", "Description": "\ua015"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '79' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:43 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable259e1535 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable259e1535/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A42.1455988Z''\"","PartitionKey":"pk259e1535","RowKey":"rk259e1535","Timestamp":"2020-07-30T13:33:42.1455988Z","Description":"\ua015"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:41 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A42.1455988Z'" + location: https://storagename.table.core.windows.net/uttable259e1535(PartitionKey='pk259e1535',RowKey='rk259e1535') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable259e1535 +- request: + body: '{"PartitionKey": "pk259e1535", "RowKey": "test2", "Description": "\ua015"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '74' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:43 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable259e1535 + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable259e1535/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A42.2226551Z''\"","PartitionKey":"pk259e1535","RowKey":"test2","Timestamp":"2020-07-30T13:33:42.2226551Z","Description":"\ua015"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:42 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A42.2226551Z'" + location: https://storagename.table.core.windows.net/uttable259e1535(PartitionKey='pk259e1535',RowKey='test2') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable259e1535 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:43 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable259e1535() + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable259e1535","value":[{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A42.1455988Z''\"","PartitionKey":"pk259e1535","RowKey":"rk259e1535","Timestamp":"2020-07-30T13:33:42.1455988Z","Description":"\ua015"},{"odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A42.2226551Z''\"","PartitionKey":"pk259e1535","RowKey":"test2","Timestamp":"2020-07-30T13:33:42.2226551Z","Description":"\ua015"}]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:42 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable259e1535() +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:43 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable259e1535') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:42 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable259e1535') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity.yaml new file mode 100644 index 000000000000..0d134f54739d --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity.yaml @@ -0,0 +1,181 @@ +interactions: +- request: + body: '{"TableName": "uttable75d9116d"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:43 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable75d9116d"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:42 GMT + location: https://storagename.table.core.windows.net/Tables('uttable75d9116d') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk75d9116d", "RowKey": "rk75d9116d", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:43 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable75d9116d + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable75d9116d/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A42.8016945Z''\"","PartitionKey":"pk75d9116d","RowKey":"rk75d9116d","Timestamp":"2020-07-30T13:33:42.8016945Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:42 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A42.8016945Z'" + location: https://storagename.table.core.windows.net/uttable75d9116d(PartitionKey='pk75d9116d',RowKey='rk75d9116d') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable75d9116d +- request: + body: '{"PartitionKey": "pk75d9116d", "RowKey": "rk75d9116d", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:43 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:43 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttable75d9116d(PartitionKey='pk75d9116d',RowKey='rk75d9116d') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:42 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A42.8821308Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable75d9116d(PartitionKey='pk75d9116d',RowKey='rk75d9116d') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:43 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:43 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttable75d9116d(PartitionKey='pk75d9116d',RowKey='rk75d9116d') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable75d9116d/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A42.8821308Z''\"","PartitionKey":"pk75d9116d","RowKey":"rk75d9116d","Timestamp":"2020-07-30T13:33:42.8821308Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:42 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A42.8821308Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable75d9116d(PartitionKey='pk75d9116d',RowKey='rk75d9116d') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:44 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable75d9116d') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:42 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable75d9116d') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_not_existing.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_not_existing.yaml new file mode 100644 index 000000000000..3c820f4b0c60 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_not_existing.yaml @@ -0,0 +1,109 @@ +interactions: +- request: + body: '{"TableName": "uttable7e8316e7"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:44 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7e8316e7"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:43 GMT + location: https://storagename.table.core.windows.net/Tables('uttable7e8316e7') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk7e8316e7", "RowKey": "rk7e8316e7", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:44 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:44 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttable7e8316e7(PartitionKey='pk7e8316e7',RowKey='rk7e8316e7') + response: + body: + string: 'ResourceNotFoundThe specified resource does not exist. + + RequestId:7fdb0557-b002-0012-6176-663e16000000 + + Time:2020-07-30T13:33:43.4765134Z' + headers: + cache-control: no-cache + content-type: application/xml;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:43 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 404 + message: Not Found + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable7e8316e7(PartitionKey='pk7e8316e7',RowKey='rk7e8316e7') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:44 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable7e8316e7') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:43 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable7e8316e7') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_with_if_doesnt_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_with_if_doesnt_match.yaml new file mode 100644 index 000000000000..d6aa209277db --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_with_if_doesnt_match.yaml @@ -0,0 +1,153 @@ +interactions: +- request: + body: '{"TableName": "uttable42cf1a0e"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:44 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable42cf1a0e"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:43 GMT + location: https://storagename.table.core.windows.net/Tables('uttable42cf1a0e') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk42cf1a0e", "RowKey": "rk42cf1a0e", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:44 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:44 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttable42cf1a0e + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable42cf1a0e/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A43.9720295Z''\"","PartitionKey":"pk42cf1a0e","RowKey":"rk42cf1a0e","Timestamp":"2020-07-30T13:33:43.9720295Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:43 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A43.9720295Z'" + location: https://storagename.table.core.windows.net/uttable42cf1a0e(PartitionKey='pk42cf1a0e',RowKey='rk42cf1a0e') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable42cf1a0e +- request: + body: '{"PartitionKey": "pk42cf1a0e", "RowKey": "rk42cf1a0e", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:45 GMT + If-Match: + - W/"datetime'2012-06-15T22%3A51%3A44.9662825Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:45 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttable42cf1a0e(PartitionKey='pk42cf1a0e',RowKey='rk42cf1a0e') + response: + body: + string: 'UpdateConditionNotSatisfiedThe update condition specified in the request was not satisfied. + + RequestId:d60563e1-d002-006f-1976-66a2de000000 + + Time:2020-07-30T13:33:44.0560854Z' + headers: + cache-control: no-cache + content-type: application/xml;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:43 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 412 + message: Precondition Failed + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttable42cf1a0e(PartitionKey='pk42cf1a0e',RowKey='rk42cf1a0e') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:45 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:45 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttable42cf1a0e') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:43 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttable42cf1a0e') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_with_if_matches.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_with_if_matches.yaml new file mode 100644 index 000000000000..2451cec2d1ef --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_update_entity_with_if_matches.yaml @@ -0,0 +1,181 @@ +interactions: +- request: + body: '{"TableName": "uttablec46617fa"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:45 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:45 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablec46617fa"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:43 GMT + location: https://storagename.table.core.windows.net/Tables('uttablec46617fa') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkc46617fa", "RowKey": "rkc46617fa", "age": "39", "age@odata.type": + "Edm.Int64", "sex": "male", "married": true, "deceased": false, "ratio": 3.1, + "evenratio": 3.0, "large": "933311100", "large@odata.type": "Edm.Int64", "Birthday": + "1973-10-04T00:00:00Z", "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '537' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:45 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:45 GMT + x-ms-version: + - '2019-07-07' + method: POST + uri: https://storagename.table.core.windows.net/uttablec46617fa + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablec46617fa/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A44.565449Z''\"","PartitionKey":"pkc46617fa","RowKey":"rkc46617fa","Timestamp":"2020-07-30T13:33:44.565449Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:43 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A44.565449Z'" + location: https://storagename.table.core.windows.net/uttablec46617fa(PartitionKey='pkc46617fa',RowKey='rkc46617fa') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 201 + message: Created + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablec46617fa +- request: + body: '{"PartitionKey": "pkc46617fa", "RowKey": "rkc46617fa", "age": "abc", "sex": + "female", "sign": "aquarius", "birthday": "1991-10-04T00:00:00Z", "birthday@odata.type": + "Edm.DateTime"}' + headers: + Content-Length: + - '180' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:45 GMT + If-Match: + - W/"datetime'2020-07-30T13%3A33%3A44.565449Z'" + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:45 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/uttablec46617fa(PartitionKey='pkc46617fa',RowKey='rkc46617fa') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:43 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A44.6504014Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablec46617fa(PartitionKey='pkc46617fa',RowKey='rkc46617fa') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 30 Jul 2020 13:33:45 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:45 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/uttablec46617fa(PartitionKey='pkc46617fa',RowKey='rkc46617fa') + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttablec46617fa/@Element","odata.etag":"W/\"datetime''2020-07-30T13%3A33%3A44.6504014Z''\"","PartitionKey":"pkc46617fa","RowKey":"rkc46617fa","Timestamp":"2020-07-30T13:33:44.6504014Z","age":"abc","birthday@odata.type":"Edm.DateTime","birthday":"1991-10-04T00:00:00Z","sex":"female","sign":"aquarius"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 30 Jul 2020 13:33:43 GMT + etag: W/"datetime'2020-07-30T13%3A33%3A44.6504014Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 200 + message: OK + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/uttablec46617fa(PartitionKey='pkc46617fa',RowKey='rkc46617fa') +- request: + body: null + headers: + Date: + - Thu, 30 Jul 2020 13:33:45 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 30 Jul 2020 13:33:45 GMT + x-ms-version: + - '2019-07-07' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('uttablec46617fa') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Jul 2020 13:33:44 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-07-07' + status: + code: 204 + message: No Content + url: https://pyacrstorageubqarxe6dhep.table.core.windows.net/Tables('uttablec46617fa') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_retention_too_long.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_retention_too_long.yaml new file mode 100644 index 000000000000..2261cd4e7fdf --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_retention_too_long.yaml @@ -0,0 +1,51 @@ +interactions: +- request: + body: ' + + 1.0truetruetrue366' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '273' + Content-Type: + - application/xml + Date: + - Mon, 27 Jul 2020 14:13:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:13:17 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: 'InvalidXmlDocumentXML specified is not syntactically valid. + + RequestId:64885058-b002-006e-2a20-647748000000 + + Time:2020-07-27T14:13:17.6459931Z' + headers: + content-length: + - '327' + content-type: + - application/xml + date: + - Mon, 27 Jul 2020 14:13:17 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: + - InvalidXmlDocument + x-ms-version: + - '2019-07-07' + status: + code: 400 + message: XML specified is not syntactically valid. +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_cors.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_cors.yaml new file mode 100644 index 000000000000..0d783e68fc65 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_cors.yaml @@ -0,0 +1,82 @@ +interactions: +- request: + body: ' + + www.xyz.comGET0www.xyz.com,www.ab.com,www.bc.comGET,PUTx-ms-meta-data*,x-ms-meta-target*,x-ms-meta-xyz,x-ms-meta-foox-ms-meta-data*,x-ms-meta-source*,x-ms-meta-abc,x-ms-meta-bcd500' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '631' + Content-Type: + - application/xml + Date: + - Mon, 27 Jul 2020 14:13:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:13:17 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: '' + headers: + date: + - Mon, 27 Jul 2020 14:13:17 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 27 Jul 2020 14:13:48 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:13:48 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalseGETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500" + headers: + content-type: + - application/xml + date: + - Mon, 27 Jul 2020 14:13:47 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + vary: + - Origin + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_hour_metrics.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_hour_metrics.yaml new file mode 100644 index 000000000000..2869e4fcbb32 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_hour_metrics.yaml @@ -0,0 +1,81 @@ +interactions: +- request: + body: ' + + 1.0truetruetrue5' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '267' + Content-Type: + - application/xml + Date: + - Mon, 27 Jul 2020 14:13:48 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:13:48 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: '' + headers: + date: + - Mon, 27 Jul 2020 14:13:48 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 27 Jul 2020 14:14:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:14:18 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue51.0falsefalseGETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500" + headers: + content-type: + - application/xml + date: + - Mon, 27 Jul 2020 14:14:18 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + vary: + - Origin + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_logging.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_logging.yaml new file mode 100644 index 000000000000..3cf3b29b2d6b --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_logging.yaml @@ -0,0 +1,81 @@ +interactions: +- request: + body: ' + + 1.0truetruetruetrue5' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '262' + Content-Type: + - application/xml + Date: + - Mon, 27 Jul 2020 14:14:18 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:14:18 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: '' + headers: + date: + - Mon, 27 Jul 2020 14:14:18 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 27 Jul 2020 14:14:49 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:14:49 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0truetruetruetrue51.0truetruetrue51.0falsefalseGETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500" + headers: + content-type: + - application/xml + date: + - Mon, 27 Jul 2020 14:14:48 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + vary: + - Origin + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_minute_metrics.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_minute_metrics.yaml new file mode 100644 index 000000000000..fbb969d64816 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_set_minute_metrics.yaml @@ -0,0 +1,81 @@ +interactions: +- request: + body: ' + + 1.0truetruetrue5' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '271' + Content-Type: + - application/xml + Date: + - Mon, 27 Jul 2020 14:14:49 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:14:49 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: '' + headers: + date: + - Mon, 27 Jul 2020 14:14:49 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 27 Jul 2020 14:15:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:15:19 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0truetruetruetrue51.0truetruetrue51.0truetruetrue5GETwww.xyz.com0GET,PUTwww.xyz.com,www.ab.com,www.bc.comx-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*x-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*500" + headers: + content-type: + - application/xml + date: + - Mon, 27 Jul 2020 14:15:19 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + vary: + - Origin + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_table_service_properties.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_table_service_properties.yaml new file mode 100644 index 000000000000..7ead60c10ac1 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_table_service_properties.yaml @@ -0,0 +1,80 @@ +interactions: +- request: + body: ' + + 1.0falsefalsefalsefalse1.0falsefalse1.0falsefalse' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '528' + Content-Type: + - application/xml + Date: + - Mon, 27 Jul 2020 14:15:19 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:15:19 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: '' + headers: + date: + - Mon, 27 Jul 2020 14:15:19 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 27 Jul 2020 14:15:50 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:15:50 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0falsefalsefalsefalse1.0falsefalse1.0falsefalse" + headers: + content-type: + - application/xml + date: + - Mon, 27 Jul 2020 14:15:49 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_too_many_cors_rules.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_too_many_cors_rules.yaml new file mode 100644 index 000000000000..19c947aaa589 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties.test_too_many_cors_rules.yaml @@ -0,0 +1,57 @@ +interactions: +- request: + body: ' + + www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1143' + Content-Type: + - application/xml + Date: + - Mon, 27 Jul 2020 14:15:50 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:15:50 GMT + x-ms-version: + - '2019-07-07' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: 'InvalidXmlDocumentXML specified is not syntactically valid. + + RequestId:2f02f88a-4002-0016-0920-641fff000000 + + Time:2020-07-27T14:15:50.7668519Z' + headers: + content-length: + - '327' + content-type: + - application/xml + date: + - Mon, 27 Jul 2020 14:15:49 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: + - InvalidXmlDocument + x-ms-version: + - '2019-07-07' + status: + code: 400 + message: XML specified is not syntactically valid. +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_service_stats.test_table_service_stats_f.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_stats.test_table_service_stats_f.yaml new file mode 100644 index 000000000000..a0d6be6a6532 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_stats.test_table_service_stats_f.yaml @@ -0,0 +1,38 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 27 Jul 2020 14:26:52 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:26:52 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://pyacrstoragestorname-secondary.table.core.windows.net/?restype=service&comp=stats + response: + body: + string: "\uFEFFunavailable" + headers: + content-type: + - application/xml + date: + - Mon, 27 Jul 2020 14:26:52 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_service_stats.test_table_service_stats_when_unavailable.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_stats.test_table_service_stats_when_unavailable.yaml new file mode 100644 index 000000000000..9dc1202b85e1 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_stats.test_table_service_stats_when_unavailable.yaml @@ -0,0 +1,38 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 27 Jul 2020 14:27:17 GMT + User-Agent: + - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 27 Jul 2020 14:27:17 GMT + x-ms-version: + - '2019-07-07' + method: GET + uri: https://pyacrstoragestorname-secondary.table.core.windows.net/?restype=service&comp=stats + response: + body: + string: "\uFEFFunavailable" + headers: + content-type: + - application/xml + date: + - Mon, 27 Jul 2020 14:27:17 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-07-07' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/test_table.py b/sdk/tables/azure-data-tables/tests/test_table.py new file mode 100644 index 000000000000..63a76c8dc315 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_table.py @@ -0,0 +1,489 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +import sys +import locale +import os +from azure.data.tables import TableServiceClient +from datetime import ( + datetime, + timedelta, +) + +from azure.data.tables._models import TableSasPermissions, UpdateMode, AccessPolicy, TableAnalyticsLogging, Metrics, CorsRule, \ + RetentionPolicy +from azure.data.tables._shared.models import ResourceTypes, AccountSasPermissions +from azure.core.pipeline import Pipeline +from azure.core.pipeline.policies import ( + HeadersPolicy, + ContentDecodePolicy, +) + +from _shared.testcase import TableTestCase, GlobalStorageAccountPreparer +from azure.data.tables._shared.authentication import SharedKeyCredentialPolicy +from azure.core.pipeline.transport import RequestsTransport +from azure.core.exceptions import ( + HttpResponseError, + ResourceNotFoundError, + ResourceExistsError) + +# ------------------------------------------------------------------------------ +from azure.data.tables._shared.table_shared_access_signature import generate_account_sas + +TEST_TABLE_PREFIX = 'pytablesync' + + +# ------------------------------------------------------------------------------ + +def _create_pipeline(account, credential, **kwargs): + # type: (Any, **Any) -> Tuple[Configuration, Pipeline] + credential_policy = SharedKeyCredentialPolicy(account_name=account.name, account_key=credential) + transport = RequestsTransport(**kwargs) + policies = [ + HeadersPolicy(), + credential_policy, + ContentDecodePolicy(response_encoding="utf-8")] + return Pipeline(transport, policies=policies) + + +class StorageTableTest(TableTestCase): + + # --Helpers----------------------------------------------------------------- + def _get_table_reference(self, prefix=TEST_TABLE_PREFIX): + table_name = self.get_resource_name(prefix) + return table_name + + def _create_table(self, ts, prefix=TEST_TABLE_PREFIX, table_list=None): + table_name = self._get_table_reference(prefix) + try: + table = ts.create_table(table_name) + if table_list is not None: + table_list.append(table) + except ResourceExistsError: + table = ts.get_table_client(table_name) + return table + + def _delete_table(self, ts, table): + if table is None: + return + try: + ts.delete_table(table.table_name) + except ResourceNotFoundError: + pass + + # --Test cases for tables -------------------------------------------------- + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_properties(self, resource_group, location, storage_account, storage_account_key): + # # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table_name = self._get_table_reference() + # Act + created = ts.create_table(table_name) + + # Assert + assert created.table_name == table_name + + properties = ts.get_service_properties() + print(properties) + ts.set_service_properties(analytics_logging=TableAnalyticsLogging(write=True)) + # have to wait for return to service + p = ts.get_service_properties() + # have to wait for return to service + ts.set_service_properties(minute_metrics= Metrics(enabled=True, include_apis=True, + retention_policy=RetentionPolicy(enabled=True, days=5))) + + ps = ts.get_service_properties() + print(ps) + print(p) + ts.delete_table(table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_table(self, resource_group, location, storage_account, storage_account_key): + # # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + + table_name = self._get_table_reference() + + # Act + created = ts.create_table(table_name) + + # Assert + assert created.table_name == table_name + ts.delete_table(table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_table_fail_on_exist(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table_name = self._get_table_reference() + # btable_client = ts.get_table_client(table_name) + + # Act + created = ts.create_table(table_name) + with self.assertRaises(ResourceExistsError): + ts.create_table(table_name) + + # Assert + self.assertTrue(created) + # existing = list(ts.query_tables(query_options=QueryOptions(filter="TableName eq '{}'".format(table_name)))) + # self.assertEqual(existing[0], [table_name]) + ts.delete_table(table_name) + + @GlobalStorageAccountPreparer() + def test_create_table_invalid_name(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + invalid_table_name = "my_table" + + with pytest.raises(ValueError) as excinfo: + ts.create_table(table_name=invalid_table_name) + + assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( + excinfo) + + @GlobalStorageAccountPreparer() + def test_delete_table_invalid_name(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + invalid_table_name = "my_table" + + with pytest.raises(ValueError) as excinfo: + ts.create_table(invalid_table_name) + + assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( + excinfo) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_tables(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table = self._create_table(ts) + + # Act + tables = list(ts.list_tables()) + + # Assert + self.assertIsNotNone(tables) + self.assertGreaterEqual(len(tables), 1) + self.assertIsNotNone(tables[0]) + # self.assertNamedItemInContainer(tables, table.table_name) + ts.delete_table(table.table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_tables_with_filter(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table = self._create_table(ts) + + # Act + name_filter = "TableName eq '{}'".format(table.table_name) + tables = list(ts.query_tables(filter=name_filter)) + # Assert + self.assertIsNotNone(tables) + self.assertEqual(len(tables), 1) + # self.assertEqual(tables[0].table_name, [table.table_name]) + # table.delete_table() + ts.delete_table(table.table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_tables_with_num_results(self, resource_group, location, storage_account, storage_account_key): + # Arrange + prefix = 'listtable' + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table_list = [] + for i in range(0, 4): + self._create_table(ts, prefix + str(i), table_list) + + # Act + small_page = [] + big_page = [] + for s in next(ts.list_tables(results_per_page=3).by_page()): + small_page.append(s) + for t in next(ts.list_tables().by_page()): + big_page.append(t) + # big_page = (next(ts.query_tables().by_page())) + # small_page = (next(ts.query_tables(results_per_page=3).by_page())) + + # Assert + self.assertEqual(len(small_page), 3) + self.assertGreaterEqual(len(big_page), 4) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_tables_with_marker(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + prefix = 'listtable' + table_names = [] + for i in range(0, 4): + self._create_table(ts, prefix + str(i), table_names) + + # table_names.sort() + + # Act + generator1 = ts.list_tables(results_per_page=2).by_page() + next(generator1) + generator2 = ts.list_tables(results_per_page=2).by_page( + continuation_token=generator1.continuation_token) + next(generator2) + + tables1 = generator1._current_page + tables2 = generator2._current_page + + # Assert + self.assertEqual(len(tables1), 2) + self.assertEqual(len(tables2), 2) + self.assertNotEqual(tables1, tables2) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_delete_table_with_existing_table(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table = self._create_table(ts) + + # Act + # deleted = table.delete_table() + deleted = ts.delete_table(table_name=table.table_name) + + # Assert + self.assertIsNone(deleted) + # existing = list(ts.query_tables("TableName eq '{}'".format(table.table_name))) + # self.assertEqual(existing, []) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_delete_table_with_non_existing_table_fail_not_exist(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table_name = self._get_table_reference() + + # Act + with self.assertRaises(HttpResponseError): + ts.delete_table(table_name) + + # Assert + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_unicode_create_table_unicode_name(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos URLs support unicode table names") + ts = TableServiceClient(url, storage_account_key) + table_name = u'啊齄丂狛狜' + + # Act + with self.assertRaises(HttpResponseError): + # not supported - table name must be alphanumeric, lowercase + ts.create_table(table_name) + + # Assert + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_get_table_acl(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos endpoint does not support this") + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table = self._create_table(ts) + try: + # Act + acl = table.get_table_access_policy() + # acl = table.get_table_access_policy() + + # Assert + self.assertIsNotNone(acl) + self.assertEqual(len(acl), 0) + finally: + # self._delete_table(table) + ts.delete_table(table.table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_set_table_acl_with_empty_signed_identifiers(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos endpoint does not support this") + ts = TableServiceClient(url, storage_account_key) + table = self._create_table(ts) + try: + # Act + table.set_table_access_policy(signed_identifiers={}) + + # Assert + acl = table.get_table_access_policy() + self.assertIsNotNone(acl) + self.assertEqual(len(acl), 0) + finally: + # self._delete_table(table) + ts.delete_table(table.table_name) + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_set_table_acl_with_empty_signed_identifier(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos endpoint does not support this") + ts = TableServiceClient(url, storage_account_key) + table = self._create_table(ts) + try: + # Act + table.set_table_access_policy(signed_identifiers={'empty': None}) + # Assert + acl = table.get_table_access_policy() + self.assertIsNotNone(acl) + self.assertEqual(len(acl), 1) + self.assertIsNotNone(acl['empty']) + self.assertIsNone(acl['empty'].permission) + self.assertIsNone(acl['empty'].expiry) + self.assertIsNone(acl['empty'].start) + finally: + # self._delete_table(table) + ts.delete_table(table.table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_set_table_acl_with_signed_identifiers(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos endpoint does not support this") + ts = TableServiceClient(url, storage_account_key) + table = self._create_table(ts) + client = ts.get_table_client(table_name=table.table_name) + + # Act + identifiers = dict() + identifiers['testid'] = AccessPolicy(start=datetime.utcnow() - timedelta(minutes=5), + expiry=datetime.utcnow() + timedelta(hours=1), + permission='r') + try: + client.set_table_access_policy(signed_identifiers=identifiers) + # Assert + acl = client.get_table_access_policy() + self.assertIsNotNone(acl) + self.assertEqual(len(acl), 1) + self.assertTrue('testid' in acl) + finally: + # self._delete_table(table) + ts.delete_table(table.table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_set_table_acl_too_many_ids(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos endpoint does not support this") + ts = TableServiceClient(url, storage_account_key) + table = self._create_table(ts) + try: + # Act + identifiers = dict() + for i in range(0, 6): + identifiers['id{}'.format(i)] = None + + # Assert + with self.assertRaises(ValueError): + table.set_table_access_policy(table_name=table.table_name, signed_identifiers=identifiers) + finally: + ts.delete_table(table.table_name) + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + def test_account_sas(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + tsc = TableServiceClient(url, storage_account_key) + table = self._create_table(tsc) + try: + entity = { + 'PartitionKey': 'test', + 'RowKey': 'test1', + 'text': 'hello', + } + table.upsert_entity(mode=UpdateMode.MERGE, entity=entity) + + entity['RowKey'] = 'test2' + table.upsert_entity(mode=UpdateMode.MERGE, entity=entity) + + token = generate_account_sas( + storage_account.name, + storage_account_key, + resource_types=ResourceTypes(object=True), + permission=AccountSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start=datetime.utcnow() - timedelta(minutes=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + sas_table = service.get_table_client(table.table_name) + entities = list(sas_table.list_entities()) + + # Assert + self.assertEqual(len(entities), 2) + self.assertEqual(entities[0].text, 'hello') + self.assertEqual(entities[1].text, 'hello') + finally: + self._delete_table(table=table, ts=tsc) + + @pytest.mark.skip("msrest fails deserialization: https://github.com/Azure/msrest-for-python/issues/192") + @GlobalStorageAccountPreparer() + def test_locale(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table = (self._get_table_reference()) + init_locale = locale.getlocale() + if os.name is "nt": + culture = "Spanish_Spain" + elif os.name is 'posix': + culture = 'es_ES.UTF-8' + else: + culture = 'es_ES.utf8' + + try: + locale.setlocale(locale.LC_ALL, culture) + e = None + + # Act + table.create_table() + try: + resp = ts.query_tables() + except: + e = sys.exc_info()[0] + + # Assert + self.assertIsNone(e) + finally: + ts.delete_table(table.table_name) + locale.setlocale(locale.LC_ALL, init_locale[0] or 'en_US') diff --git a/sdk/tables/azure-data-tables/tests/test_table_async.py b/sdk/tables/azure-data-tables/tests/test_table_async.py new file mode 100644 index 000000000000..5b6de7387b22 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_table_async.py @@ -0,0 +1,435 @@ +import locale +import os +import sys +from datetime import datetime, timedelta + +import pytest +from azure.core.exceptions import ResourceNotFoundError, ResourceExistsError, HttpResponseError +from _shared.asynctestcase import AsyncTableTestCase +from _shared.testcase import GlobalStorageAccountPreparer +from azure.data.tables import AccessPolicy, TableSasPermissions, ResourceTypes, AccountSasPermissions +from azure.data.tables.aio import TableServiceClient +from azure.data.tables._generated.models import QueryOptions +from azure.data.tables._shared.table_shared_access_signature import generate_account_sas + +TEST_TABLE_PREFIX = 'pytableasync' + + +# ------------------------------------------------------------------------------ + +class TableTestAsync(AsyncTableTestCase): + # --Helpers----------------------------------------------------------------- + def _get_table_reference(self, prefix=TEST_TABLE_PREFIX): + table_name = self.get_resource_name(prefix) + return table_name + + async def _create_table(self, ts, prefix=TEST_TABLE_PREFIX, table_list=None): + table_name = self._get_table_reference(prefix) + try: + table = await ts.create_table(table_name) + if table_list is not None: + table_list.append(table) + except ResourceExistsError: + table = await ts.get_table_client(table_name) + return table + + async def _delete_table(self, ts, table): + if table is None: + return + try: + await ts.delete_table(table.table_name) + except ResourceNotFoundError: + pass + + # --Test cases for tables -------------------------------------------------- + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_create_table(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table_name = self._get_table_reference() + + # Act + created = await ts.create_table(table_name=table_name) + + # Assert + assert created.table_name == table_name + + await ts.delete_table(table_name=table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_create_table_fail_on_exist(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table_name = self._get_table_reference() + + # Act + created = await ts.create_table(table_name=table_name) + with self.assertRaises(ResourceExistsError): + await ts.create_table(table_name=table_name) + + # Assert + self.assertTrue(created) + await ts.delete_table(table_name=table_name) + + @GlobalStorageAccountPreparer() + async def test_create_table_invalid_name(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + invalid_table_name = "my_table" + + with pytest.raises(ValueError) as excinfo: + await ts.create_table(table_name=invalid_table_name) + + assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( + excinfo) + + @GlobalStorageAccountPreparer() + async def test_delete_table_invalid_name(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + invalid_table_name = "my_table" + + with pytest.raises(ValueError) as excinfo: + await ts.create_table(invalid_table_name) + + assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( + excinfo) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_list_tables(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table = await self._create_table(ts) + + # Act + tables = [] + async for t in ts.list_tables(): + tables.append(t) + + # Assert + self.assertIsNotNone(tables) + self.assertGreaterEqual(len(tables), 1) + self.assertIsNotNone(tables[0]) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_query_tables_with_filter(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table = await self._create_table(ts) + + # Act + name_filter = "TableName eq '{}'".format(table.table_name) + tables = [] + async for t in ts.query_tables(filter=name_filter): + tables.append(t) + + # Assert + self.assertIsNotNone(tables) + self.assertEqual(len(tables), 1) + # self.assertEqual(tables[0].table_name, [table.table_name]) + # table.delete_table() + await ts.delete_table(table.table_name) + + # @pytest.mark.skip("pending") + # TODO: the small_page is getting 16, can't figure it out, skipping for now + @GlobalStorageAccountPreparer() + async def test_list_tables_with_num_results(self, resource_group, location, storage_account, storage_account_key): + # Arrange + prefix = 'listtable' + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table_list = [] + for i in range(0, 4): + await self._create_table(ts, prefix + str(i), table_list) + + # Act + big_page = [] + async for t in ts.list_tables(): + big_page.append(t) + + small_page = [] + async for s in ts.list_tables(results_per_page=3).by_page(): + small_page.append(s) + + self.assertEqual(len(small_page), 2) + self.assertGreaterEqual(len(big_page), 4) + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_list_tables_with_marker(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + prefix = 'listtable' + table_names = [] + for i in range(0, 4): + await self._create_table(ts, prefix + str(i), table_names) + + # table_names.sort() + + # Act + generator1 = ts.list_tables(query_options=QueryOptions(top=2)).by_page() + tables1 = [] + async for el in await generator1: #.__anext__(): + tables1.append(el) + generator2 = ts.list_tables(query_options=QueryOptions(top=2)).by_page( + continuation_token=generator1.continuation_token) + tables2 = [] + async for el in await generator2:# .__anext__(): + tables2.append(el) + + # Assert + self.assertEqual(len(tables1), 2) + self.assertEqual(len(tables2), 2) + self.assertNotEqual(tables1, tables2) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_delete_table_with_existing_table(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table = await self._create_table(ts) + + # Act + # deleted = table.delete_table() + deleted = await ts.delete_table(table_name=table.table_name) + + # Assert + self.assertIsNone(deleted) + # existing = list(ts.query_tables("TableName eq '{}'".format(table.table_name))) + # self.assertEqual(existing, []) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_delete_table_with_non_existing_table_fail_not_exist(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table_name = self._get_table_reference() + + # Act + with self.assertRaises(ResourceNotFoundError): + await ts.delete_table(table_name) + + # Assert + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_unicode_create_table_unicode_name(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos URLs support unicode table names") + ts = TableServiceClient(url, storage_account_key) + table_name = u'啊齄丂狛狜' + + # Act + # with self.assertRaises(HttpResponseError): + + with pytest.raises(ValueError) as excinfo: + await ts.create_table(table_name=table_name) + + assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( + excinfo) + + # Assert + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_get_table_acl(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos endpoint does not support this") + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table = await self._create_table(ts) + try: + # Act + acl = await table.get_table_access_policy() + # acl = table.get_table_access_policy() + + # Assert + self.assertIsNotNone(acl) + self.assertEqual(len(acl), 0) + finally: + # self._delete_table(table) + await ts.delete_table(table.table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_set_table_acl_with_empty_signed_identifiers(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos endpoint does not support this") + ts = TableServiceClient(url, storage_account_key) + table = await self._create_table(ts) + try: + # Act + await table.set_table_access_policy(signed_identifiers={}) + + # Assert + acl = await table.get_table_access_policy() + self.assertIsNotNone(acl) + self.assertEqual(len(acl), 0) + finally: + # self._delete_table(table) + await ts.delete_table(table.table_name) + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_set_table_acl_with_empty_signed_identifier(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos endpoint does not support this") + ts = TableServiceClient(url, storage_account_key) + table = await self._create_table(ts) + try: + # Act + await table.set_table_access_policy(signed_identifiers={'empty': None}) + # Assert + acl = await table.get_table_access_policy() + self.assertIsNotNone(acl) + self.assertEqual(len(acl), 1) + self.assertIsNotNone(acl['empty']) + self.assertIsNone(acl['empty'].permission) + self.assertIsNone(acl['empty'].expiry) + self.assertIsNone(acl['empty'].start) + finally: + # self._delete_table(table) + await ts.delete_table(table.table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_set_table_acl_with_signed_identifiers(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos endpoint does not support this") + ts = TableServiceClient(url, storage_account_key) + table = await self._create_table(ts) + client = ts.get_table_client(table=table.table_name) + + # Act + identifiers = dict() + identifiers['testid'] = AccessPolicy(start=datetime.utcnow() - timedelta(minutes=5), + expiry=datetime.utcnow() + timedelta(hours=1), + permission=TableSasPermissions(read=True)) + try: + await client.set_table_access_policy(signed_identifiers=identifiers) + # Assert + acl = await client.get_table_access_policy() + self.assertIsNotNone(acl) + self.assertEqual(len(acl), 1) + self.assertTrue('testid' in acl) + finally: + # self._delete_table(table) + await ts.delete_table(table.table_name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_set_table_acl_too_many_ids(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos endpoint does not support this") + ts = TableServiceClient(url, storage_account_key) + table = await self._create_table(ts) + try: + # Act + identifiers = dict() + for i in range(0, 6): + identifiers['id{}'.format(i)] = None + + # Assert + with self.assertRaises(ValueError): + await table.set_table_access_policy(table_name=table.table_name, signed_identifiers=identifiers) + finally: + await ts.delete_table(table.table_name) + + @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + async def test_account_sas(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + tsc = TableServiceClient(url, storage_account_key) + table = await self._create_table(tsc) + try: + entity = { + 'PartitionKey': 'test', + 'RowKey': 'test1', + 'text': 'hello', + } + await table.upsert_insert_merge_entity(table_entity_properties=entity) + + entity['RowKey'] = 'test2' + await table.upsert_insert_merge_entity(table_entity_properties=entity) + + token = generate_account_sas( + storage_account.name, + storage_account_key, + resource_types=ResourceTypes(container=True), + permission=AccountSasPermissions(list=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start=datetime.utcnow() - timedelta(minutes=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + entities = [] + async for e in service.list_tables(): + entities.append(e) + + # Assert + self.assertEqual(len(entities), 1) + # self.assertEqual(entities[0].text, 'hello') + # self.assertEqual(entities[1].text, 'hello') + finally: + await self._delete_table(table=table, ts=tsc) + + @pytest.mark.skip("msrest fails deserialization: https://github.com/Azure/msrest-for-python/issues/192") + @GlobalStorageAccountPreparer() + async def test_locale(self, resource_group, location, storage_account, storage_account_key): + # Arrange + ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + table = (self._get_table_reference()) + init_locale = locale.getlocale() + if os.name == "nt": + culture = "Spanish_Spain" + elif os.name == 'posix': + culture = 'es_ES.UTF-8' + else: + culture = 'es_ES.utf8' + + try: + locale.setlocale(locale.LC_ALL, culture) + e = None + + # Act + await table.create_table() + try: + resp = ts.list_tables() + except: + e = sys.exc_info()[0] + + # Assert + self.assertIsNone(e) + finally: + await ts.delete_table(table.table_name) + locale.setlocale(locale.LC_ALL, init_locale[0] or 'en_US') diff --git a/sdk/tables/azure-data-tables/tests/test_table_batch.py b/sdk/tables/azure-data-tables/tests/test_table_batch.py new file mode 100644 index 000000000000..62d20bd42bd3 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_table_batch.py @@ -0,0 +1,646 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import unittest +import pytest + +import uuid +from datetime import datetime +from dateutil.tz import tzutc + +from azure.core import MatchConditions +from azure.core.exceptions import ( + ResourceExistsError) + +from _shared.testcase import GlobalStorageAccountPreparer, TableTestCase, LogCaptured + +#------------------------------------------------------------------------------ +TEST_TABLE_PREFIX = 'table' +#------------------------------------------------------------------------------ + +class StorageTableBatchTest(TableTestCase): + + def _set_up(self, storage_account, storage_account_key): + self.ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + self.table_name = self.get_resource_name('uttable') + self.table = self.ts.get_table_client(self.table_name) + if self.is_live: + try: + self.ts.create_table(self.table_name) + except ResourceExistsError: + pass + + self.test_tables = [] + + def _tear_down(self): + if self.is_live: + try: + self.ts.delete_table(self.table_name) + except: + pass + + for table_name in self.test_tables: + try: + self.ts.delete_table(table_name) + except: + pass + + #--Helpers----------------------------------------------------------------- + + def _get_table_reference(self, prefix=TEST_TABLE_PREFIX): + table_name = self.get_resource_name(prefix) + self.test_tables.append(table_name) + return self.ts.get_table_client(table_name) + + def _create_random_entity_dict(self, pk=None, rk=None): + ''' + Creates a dictionary-based entity with fixed values, using all + of the supported data types. + ''' + partition = pk if pk is not None else self.get_resource_name('pk') + row = rk if rk is not None else self.get_resource_name('rk') + properties = { + 'PartitionKey': partition, + 'RowKey': row, + 'age': 39, + 'sex': 'male', + 'married': True, + 'deceased': False, + 'optional': None, + 'ratio': 3.1, + 'evenratio': 3.0, + 'large': 933311100, + 'Birthday': datetime(1973, 10, 4, tzinfo=tzutc()), + 'birthday': datetime(1970, 10, 4, tzinfo=tzutc()), + 'binary': b'binary', + 'other': EntityProperty(EdmType.INT32, 20), + 'clsid': uuid.UUID('c9da6455-213d-42c9-9a79-3e9149a57833') + } + return Entity(**properties) + + def _create_updated_entity_dict(self, partition, row): + ''' + Creates a dictionary-based entity with fixed values, with a + different set of values than the default entity. It + adds fields, changes field values, changes field types, + and removes fields when compared to the default entity. + ''' + return { + 'PartitionKey': partition, + 'RowKey': row, + 'age': 'abc', + 'sex': 'female', + 'sign': 'aquarius', + 'birthday': datetime(1991, 10, 4, tzinfo=tzutc()) + } + + def _assert_default_entity(self, entity, headers=None): + ''' + Asserts that the entity passed in matches the default entity. + ''' + self.assertEqual(entity['age'], 39) + self.assertEqual(entity['sex'], 'male') + self.assertEqual(entity['married'], True) + self.assertEqual(entity['deceased'], False) + self.assertFalse("optional" in entity) + self.assertFalse("aquarius" in entity) + self.assertEqual(entity['ratio'], 3.1) + self.assertEqual(entity['evenratio'], 3.0) + self.assertEqual(entity['large'], 933311100) + self.assertEqual(entity['Birthday'], datetime(1973, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity['birthday'], datetime(1970, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity['binary'], b'binary') + self.assertIsInstance(entity['other'], EntityProperty) + self.assertEqual(entity['other'].type, EdmType.INT32) + self.assertEqual(entity['other'].value, 20) + self.assertEqual(entity['clsid'], uuid.UUID('c9da6455-213d-42c9-9a79-3e9149a57833')) + self.assertTrue('metadata' in entity.odata) + self.assertIsNotNone(entity.timestamp) + self.assertIsInstance(entity.timestamp, datetime) + if headers: + self.assertTrue("etag" in headers) + self.assertIsNotNone(headers['etag']) + + def _assert_updated_entity(self, entity): + ''' + Asserts that the entity passed in matches the updated entity. + ''' + self.assertEqual(entity.age, 'abc') + self.assertEqual(entity.sex, 'female') + self.assertFalse(hasattr(entity, "married")) + self.assertFalse(hasattr(entity, "deceased")) + self.assertEqual(entity.sign, 'aquarius') + self.assertFalse(hasattr(entity, "optional")) + self.assertFalse(hasattr(entity, "ratio")) + self.assertFalse(hasattr(entity, "evenratio")) + self.assertFalse(hasattr(entity, "large")) + self.assertFalse(hasattr(entity, "Birthday")) + self.assertEqual(entity.birthday, datetime(1991, 10, 4, tzinfo=tzutc())) + self.assertFalse(hasattr(entity, "other")) + self.assertFalse(hasattr(entity, "clsid")) + self.assertIsNotNone(entity.odata['etag']) + self.assertIsNotNone(entity.timestamp) + self.assertIsInstance(entity.timestamp, datetime) + + #--Test cases for batch --------------------------------------------- + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_insert(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + entity = Entity() + entity.PartitionKey = '001' + entity.RowKey = 'batch_insert' + entity.test = EntityProperty(EdmType.BOOLEAN, 'true') + entity.test2 = 'value' + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime.utcnow() + + batch = self.table.create_batch() + batch.create_item(entity) + resp = self.table.commit_batch(batch) + + # Assert + self.assertIsNotNone(resp) + result, headers = self.table.read_item('001', 'batch_insert', response_hook=lambda e, h: (e, h)) + self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_update(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + entity = Entity() + entity.PartitionKey = '001' + entity.RowKey = 'batch_update' + entity.test = EntityProperty(EdmType.BOOLEAN, 'true') + entity.test2 = 'value' + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime.utcnow() + self.table.create_item(entity) + + entity = self.table.read_item('001', 'batch_update') + self.assertEqual(3, entity.test3) + entity.test2 = 'value1' + + batch = self.table.create_batch() + batch.update_item(entity) + resp = self.table.commit_batch(batch) + + # Assert + self.assertIsNotNone(resp) + result, headers = self.table.read_item('001', 'batch_update', response_hook=lambda e, h: (e, h)) + self.assertEqual('value1', result.test2) + self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_merge(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + entity = Entity() + entity.PartitionKey = '001' + entity.RowKey = 'batch_merge' + entity.test = EntityProperty(EdmType.BOOLEAN, 'true') + entity.test2 = 'value' + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime.utcnow() + self.table.create_item(entity) + + entity = self.table.read_item('001', 'batch_merge') + self.assertEqual(3, entity.test3) + entity = Entity() + entity.PartitionKey = '001' + entity.RowKey = 'batch_merge' + entity.test2 = 'value1' + + batch = self.table.create_batch() + batch.update_item(entity, mode='MERGE') + resp = self.table.commit_batch(batch) + + # Assert + self.assertIsNotNone(resp) + entity, headers = self.table.read_item('001', 'batch_merge', response_hook=lambda e, h: (e, h)) + self.assertEqual('value1', entity.test2) + self.assertEqual(1234567890, entity.test4) + self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_update_if_match(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + etag = self.table.create_item(entity, response_hook=lambda e, h: h['etag']) + + # Act + sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) + batch = self.table.create_batch() + batch.update_item(sent_entity, etag=etag, match_condition=MatchConditions.IfNotModified) + resp = self.table.commit_batch(batch) + + # Assert + self.assertIsNotNone(resp) + entity, headers = self.table.read_item(entity['PartitionKey'], entity['RowKey'], response_hook=lambda e, h: (e, h)) + self._assert_updated_entity(entity) + self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_update_if_doesnt_match(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + self.table.create_item(entity) + + # Act + sent_entity1 = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) + + batch = self.table.create_batch() + batch.update_item( + sent_entity1, + etag=u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', + match_condition=MatchConditions.IfNotModified) + try: + self.table.commit_batch(batch) + except PartialBatchErrorException as error: + pass # TODO + #self.assertEqual(error.code, 'UpdateConditionNotSatisfied') + #self.assertTrue('The update condition specified in the request was not satisfied.' in str(error)) + else: + self.fail('AzureBatchOperationError was expected') + + # Assert + received_entity = self.table.read_item(entity['PartitionKey'], entity['RowKey']) + self._assert_default_entity(received_entity) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_insert_replace(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + entity = Entity() + entity.PartitionKey = '001' + entity.RowKey = 'batch_insert_replace' + entity.test = True + entity.test2 = 'value' + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime.utcnow() + + batch = self.table.create_batch() + batch.upsert_item(entity) + resp = self.table.commit_batch(batch) + + # Assert + self.assertIsNotNone(resp) + entity, headers = self.table.read_item('001', 'batch_insert_replace', response_hook=lambda e, h: (e, h)) + self.assertIsNotNone(entity) + self.assertEqual('value', entity.test2) + self.assertEqual(1234567890, entity.test4) + self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_insert_merge(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + entity = Entity() + entity.PartitionKey = '001' + entity.RowKey = 'batch_insert_merge' + entity.test = True + entity.test2 = 'value' + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime.utcnow() + + batch = self.table.create_batch() + batch.upsert_item(entity, mode='MERGE') + resp = self.table.commit_batch(batch) + + # Assert + self.assertIsNotNone(resp) + entity, headers = self.table.read_item('001', 'batch_insert_merge', response_hook=lambda e, h: (e, h)) + self.assertIsNotNone(entity) + self.assertEqual('value', entity.test2) + self.assertEqual(1234567890, entity.test4) + self.assertEqual(list(resp)[0].headers['Etag'], headers['etag']) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_delete(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + entity = Entity() + entity.PartitionKey = '001' + entity.RowKey = 'batch_delete' + entity.test = EntityProperty(EdmType.BOOLEAN, 'true') + entity.test2 = 'value' + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime.utcnow() + self.table.create_item(entity) + + entity = self.table.read_item('001', 'batch_delete') + self.assertEqual(3, entity.test3) + + batch = self.table.create_batch() + batch.delete_item('001', 'batch_delete') + resp = self.table.commit_batch(batch) + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(list(resp)[0].status_code, 204) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_inserts(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + entity = Entity() + entity.PartitionKey = 'batch_inserts' + entity.test = EntityProperty(EdmType.BOOLEAN, 'true') + entity.test2 = 'value' + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + + batch = self.table.create_batch() + for i in range(100): + entity.RowKey = str(i) + batch.create_item(entity) + self.table.commit_batch(batch) + + entities = list(self.table.query_items("PartitionKey eq 'batch_inserts'")) + + # Assert + self.assertIsNotNone(entities) + self.assertEqual(100, len(entities)) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_all_operations_together(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + entity = Entity() + entity.PartitionKey = '003' + entity.RowKey = 'batch_all_operations_together-1' + entity.test = EntityProperty(EdmType.BOOLEAN, 'true') + entity.test2 = 'value' + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime.utcnow() + self.table.create_item(entity) + entity.RowKey = 'batch_all_operations_together-2' + self.table.create_item(entity) + entity.RowKey = 'batch_all_operations_together-3' + self.table.create_item(entity) + entity.RowKey = 'batch_all_operations_together-4' + self.table.create_item(entity) + + batch = self.table.create_batch() + entity.RowKey = 'batch_all_operations_together' + batch.create_item(entity) + entity.RowKey = 'batch_all_operations_together-1' + batch.delete_item(entity.PartitionKey, entity.RowKey) + entity.RowKey = 'batch_all_operations_together-2' + entity.test3 = 10 + batch.update_item(entity) + entity.RowKey = 'batch_all_operations_together-3' + entity.test3 = 100 + batch.update_item(entity, mode='MERGE') + entity.RowKey = 'batch_all_operations_together-4' + entity.test3 = 10 + batch.upsert_item(entity) + entity.RowKey = 'batch_all_operations_together-5' + batch.upsert_item(entity, mode='MERGE') + resp = self.table.commit_batch(batch) + + # Assert + self.assertEqual(6, len(list(resp))) + entities = list(self.table.query_items("PartitionKey eq '003'")) + self.assertEqual(5, len(entities)) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_all_operations_together_context_manager(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + entity = Entity() + entity.PartitionKey = '003' + entity.RowKey = 'batch_all_operations_together-1' + entity.test = EntityProperty(EdmType.BOOLEAN, 'true') + entity.test2 = 'value' + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime.utcnow() + self.table.create_item(entity) + entity.RowKey = 'batch_all_operations_together-2' + self.table.create_item(entity) + entity.RowKey = 'batch_all_operations_together-3' + self.table.create_item(entity) + entity.RowKey = 'batch_all_operations_together-4' + self.table.create_item(entity) + + with self.table.create_batch() as batch: + entity.RowKey = 'batch_all_operations_together' + batch.create_item(entity) + entity.RowKey = 'batch_all_operations_together-1' + batch.delete_item(entity.PartitionKey, entity.RowKey) + entity.RowKey = 'batch_all_operations_together-2' + entity.test3 = 10 + batch.update_item(entity) + entity.RowKey = 'batch_all_operations_together-3' + entity.test3 = 100 + batch.update_item(entity, mode='MERGE') + entity.RowKey = 'batch_all_operations_together-4' + entity.test3 = 10 + batch.upsert_item(entity) + entity.RowKey = 'batch_all_operations_together-5' + batch.upsert_item(entity, mode='MERGE') + + # Assert + entities = list(self.table.query_items("PartitionKey eq '003'")) + self.assertEqual(5, len(entities)) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_reuse(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + table2 = self._get_table_reference('table2') + table2.create_table() + + # Act + entity = Entity() + entity.PartitionKey = '003' + entity.RowKey = 'batch_all_operations_together-1' + entity.test = EntityProperty(EdmType.BOOLEAN, 'true') + entity.test2 = 'value' + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime.utcnow() + + batch = TableBatchClient() + batch.create_item(entity) + entity.RowKey = 'batch_all_operations_together-2' + batch.create_item(entity) + entity.RowKey = 'batch_all_operations_together-3' + batch.create_item(entity) + entity.RowKey = 'batch_all_operations_together-4' + batch.create_item(entity) + + self.table.commit_batch(batch) + table2.commit_batch(batch) + + batch = TableBatchClient() + entity.RowKey = 'batch_all_operations_together' + batch.create_item(entity) + entity.RowKey = 'batch_all_operations_together-1' + batch.delete_item(entity.PartitionKey, entity.RowKey) + entity.RowKey = 'batch_all_operations_together-2' + entity.test3 = 10 + batch.update_item(entity) + entity.RowKey = 'batch_all_operations_together-3' + entity.test3 = 100 + batch.update_item(entity, mode='MERGE') + entity.RowKey = 'batch_all_operations_together-4' + entity.test3 = 10 + batch.upsert_item(entity) + entity.RowKey = 'batch_all_operations_together-5' + batch.upsert_item(entity, mode='MERGE') + + self.table.commit_batch(batch) + resp = table2.commit_batch(batch) + + # Assert + self.assertEqual(6, len(list(resp))) + entities = list(self.table.query_items("PartitionKey eq '003'")) + self.assertEqual(5, len(entities)) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_same_row_operations_fail(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict('001', 'batch_negative_1') + self.table.create_item(entity) + + # Act + batch = self.table.create_batch() + + entity = self._create_updated_entity_dict( + '001', 'batch_negative_1') + batch.update_item(entity) + entity = self._create_random_entity_dict( + '001', 'batch_negative_1') + + # Assert + with self.assertRaises(ValueError): + batch.update_item(entity, mode='MERGE') + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_different_partition_operations_fail(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict('001', 'batch_negative_1') + self.table.create_item(entity) + + # Act + batch = self.table.create_batch() + + entity = self._create_updated_entity_dict( + '001', 'batch_negative_1') + batch.update_item(entity) + + entity = self._create_random_entity_dict( + '002', 'batch_negative_1') + + # Assert + with self.assertRaises(ValueError): + batch.create_item(entity) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_batch_too_many_ops(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict('001', 'batch_negative_1') + self.table.create_item(entity) + + # Act + with self.assertRaises(ValueError): + batch = self.table.create_batch() + for i in range(0, 101): + entity = Entity() + entity.PartitionKey = 'large' + entity.RowKey = 'item{0}'.format(i) + batch.create_item(entity) + + # Assert + finally: + self._tear_down() + +#------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main() diff --git a/sdk/tables/azure-data-tables/tests/test_table_client.py b/sdk/tables/azure-data-tables/tests/test_table_client.py new file mode 100644 index 000000000000..34ba05da9fb6 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_table_client.py @@ -0,0 +1,567 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import unittest +import pytest +import platform + +from azure.data.tables import TableServiceClient, TableClient +from azure.data.tables._version import VERSION +from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer +# from azure.data.tabless import ( +# VERSION, +# TableServiceClient, +# TableClient, +# ) +from _shared.testcase import GlobalStorageAccountPreparer, TableTestCase + +from azure.core.exceptions import HttpResponseError +# ------------------------------------------------------------------------------ +SERVICES = { + #TableServiceClient: 'table', + #TableClient: 'table', + #TableServiceClient: 'cosmos', + #TableClient: 'cosmos', +} + +_CONNECTION_ENDPOINTS = {'table': 'TableEndpoint', 'cosmos': 'TableEndpoint'} + +_CONNECTION_ENDPOINTS_SECONDARY = {'table': 'TableSecondaryEndpoint', 'cosmos': 'TableSecondaryEndpoint'} + +class StorageTableClientTest(TableTestCase): + def setUp(self): + super(StorageTableClientTest, self).setUp() + self.sas_token = self.generate_sas_token() + self.token_credential = self.generate_oauth_token() + + # --Helpers----------------------------------------------------------------- + def validate_standard_account_endpoints(self, service, account_name, account_key): + self.assertIsNotNone(service) + self.assertEqual(service.account_name, account_name) + self.assertEqual(service.credential.account_name, account_name) + self.assertEqual(service.credential.account_key, account_key) + self.assertTrue( + ('{}.{}'.format(account_name, 'table.core.windows.net') in service.url) or + ('{}.{}'.format(account_name, 'table.cosmos.azure.com') in service.url)) + self.assertTrue( + ('{}-secondary.{}'.format(account_name, 'table.core.windows.net') in service.secondary_endpoint) or + ('{}-secondary.{}'.format(account_name, 'table.cosmos.azure.com') in service.secondary_endpoint)) + + # --Direct Parameters Test Cases -------------------------------------------- + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_key(self, resource_group, location, storage_account, storage_account_key): + # Arrange + + for client, url in SERVICES.items(): + # Act + service = client( + self.account_url(storage_account, url), credential=storage_account_key, table_name='foo') + + # Assert + self.validate_standard_account_endpoints(service, storage_account.name, storage_account_key) + self.assertEqual(service.scheme, 'https') + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_connection_string(self, resource_group, location, storage_account, storage_account_key): + + for service_type in SERVICES.items(): + # Act + service = service_type[0].from_connection_string( + self.connection_string(storage_account, storage_account_key), table_name="test") + + # Assert + self.validate_standard_account_endpoints(service, storage_account.name, storage_account_key) + self.assertEqual(service.scheme, 'https') + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_sas(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + suffix = '.table.core.windows.net' + if 'cosmos' in url: + suffix = '.table.cosmos.azure.com' + for service_type in SERVICES: + # Act + service = service_type( + self.account_url(storage_account, "table"), credential=self.sas_token, table_name='foo') + + # Assert + self.assertIsNotNone(service) + self.assertEqual(service.account_name, storage_account.name) + self.assertTrue(service.url.startswith('https://' + storage_account.name + suffix)) + self.assertTrue(service.url.endswith(self.sas_token)) + self.assertIsNone(service.credential) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_token(self, resource_group, location, storage_account, storage_account_key): + url = self.account_url(storage_account, "table") + suffix = '.table.core.windows.net' + if 'cosmos' in url: + suffix = '.table.cosmos.azure.com' + for service_type in SERVICES: + # Act + service = service_type(url, credential=self.token_credential, table_name='foo') + + # Assert + self.assertIsNotNone(service) + self.assertEqual(service.account_name, storage_account.name) + self.assertTrue(service.url.startswith('https://' + storage_account.name + suffix)) + self.assertEqual(service.credential, self.token_credential) + self.assertFalse(hasattr(service.credential, 'account_key')) + self.assertTrue(hasattr(service.credential, 'get_token')) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_token_and_http(self, resource_group, location, storage_account, storage_account_key): + for service_type in SERVICES: + # Act + with self.assertRaises(ValueError): + url = self.account_url(storage_account, "table").replace('https', 'http') + service_type(url, credential=self.token_credential, table_name='foo') + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_china(self, resource_group, location, storage_account, storage_account_key): + # Arrange + # TODO: Confirm regional cloud cosmos URLs + for service_type in SERVICES.items(): + # Act + url = self.account_url(storage_account, "table").replace('core.windows.net', 'core.chinacloudapi.cn') + if 'cosmos.azure' in url: + pytest.skip("Confirm cosmos national cloud URLs") + service = service_type[0]( + url, credential=storage_account_key, table_name='foo') + + # Assert + self.assertIsNotNone(service) + self.assertEqual(service.account_name, storage_account.name) + self.assertEqual(service.credential.account_name, storage_account.name) + self.assertEqual(service.credential.account_key, storage_account_key) + self.assertTrue(service.primary_endpoint.startswith( + 'https://{}.{}.core.chinacloudapi.cn'.format(storage_account.name, "table"))) + self.assertTrue(service.secondary_endpoint.startswith( + 'https://{}-secondary.{}.core.chinacloudapi.cn'.format(storage_account.name, "table"))) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_protocol(self, resource_group, location, storage_account, storage_account_key): + # Arrange + + for service_type in SERVICES.items(): + # Act + url = self.account_url(storage_account, "table").replace('https', 'http') + service = service_type[0]( + url, credential=storage_account_key, table_name='foo') + + # Assert + self.validate_standard_account_endpoints(service, storage_account.name, storage_account_key) + self.assertEqual(service.scheme, 'http') + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_empty_key(self, resource_group, location, storage_account, storage_account_key): + # Arrange + TABLE_SERVICES = [TableServiceClient, TableClient] + + for service_type in TABLE_SERVICES: + # Act + with self.assertRaises(ValueError) as e: + test_service = service_type('testaccount', credential='', table_name='foo') + + self.assertEqual( + str(e.exception), "You need to provide either a SAS token or an account shared key to authenticate.") + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_socket_timeout(self, resource_group, location, storage_account, storage_account_key): + # Arrange + + for service_type in SERVICES.items(): + # Act + default_service = service_type[0]( + self.account_url(storage_account, "table"), credential=storage_account_key, table_name='foo') + service = service_type[0]( + self.account_url(storage_account, "table"), credential=storage_account_key, + table_name='foo', connection_timeout=22) + + # Assert + self.validate_standard_account_endpoints(service, storage_account.name, storage_account_key) + assert service._client._client._pipeline._transport.connection_config.timeout == 22 + assert default_service._client._client._pipeline._transport.connection_config.timeout in [20, (20, 2000)] + + # --Connection String Test Cases -------------------------------------------- + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_connection_string_key(self, resource_group, location, storage_account, storage_account_key): + # Arrange + conn_string = 'AccountName={};AccountKey={};'.format(storage_account.name, storage_account_key) + + for service_type in SERVICES.items(): + # Act + service = service_type[0].from_connection_string(conn_string, table_name='foo') + + # Assert + self.validate_standard_account_endpoints(service, storage_account.name, storage_account_key) + self.assertEqual(service.scheme, 'https') + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_connection_string_sas(self, resource_group, location, storage_account, storage_account_key): + # Arrange + conn_string = 'AccountName={};SharedAccessSignature={};'.format(storage_account.name, self.sas_token) + + for service_type in SERVICES: + # Act + service = service_type.from_connection_string(conn_string, table_name='foo') + + # Assert + self.assertIsNotNone(service) + self.assertEqual(service.account_name, storage_account.name) + self.assertTrue(service.url.startswith('https://' + storage_account.name + '.table.core.windows.net')) + self.assertTrue(service.url.endswith(self.sas_token)) + self.assertIsNone(service.credential) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() # TODO: Prepare Cosmos tables account + def test_create_service_with_connection_string_cosmos(self, resource_group, location, storage_account, storage_account_key): + # Arrange + conn_string = 'DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1};TableEndpoint=https://{0}.table.cosmos.azure.com:443/;'.format( + storage_account.name, storage_account_key) + + for service_type in SERVICES: + # Act + service = service_type.from_connection_string(conn_string, table_name='foo') + + # Assert + self.assertIsNotNone(service) + self.assertEqual(service.account_name, storage_account.name) + self.assertTrue(service.url.startswith('https://' + storage_account.name + '.table.cosmos.azure.com')) + self.assertEqual(service.credential.account_name, storage_account.name) + self.assertEqual(service.credential.account_key, storage_account_key) + self.assertTrue(service.primary_endpoint.startswith('https://' + storage_account.name + '.table.cosmos.azure.com')) + self.assertTrue(service.secondary_endpoint.startswith('https://' + storage_account.name + '-secondary.table.cosmos.azure.com')) + self.assertEqual(service.scheme, 'https') + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_connection_string_endpoint_protocol(self, resource_group, location, storage_account, storage_account_key): + # Arrange + conn_string = 'AccountName={};AccountKey={};DefaultEndpointsProtocol=http;EndpointSuffix=core.chinacloudapi.cn;'.format( + storage_account.name, storage_account_key) + + for service_type in SERVICES.items(): + # Act + service = service_type[0].from_connection_string(conn_string, table_name="foo") + + # Assert + self.assertIsNotNone(service) + self.assertEqual(service.account_name, storage_account.name) + self.assertEqual(service.credential.account_name, storage_account.name) + self.assertEqual(service.credential.account_key, storage_account_key) + self.assertTrue( + service.primary_endpoint.startswith( + 'http://{}.{}.core.chinacloudapi.cn'.format(storage_account.name, "table"))) + self.assertTrue( + service.secondary_endpoint.startswith( + 'http://{}-secondary.{}.core.chinacloudapi.cn'.format(storage_account.name, "table"))) + self.assertEqual(service.scheme, 'http') + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_connection_string_emulated(self, resource_group, location, storage_account, storage_account_key): + # Arrange + for service_type in SERVICES.items(): + conn_string = 'UseDevelopmentStorage=true;'.format(storage_account.name, storage_account_key) + + # Act + with self.assertRaises(ValueError): + service = service_type[0].from_connection_string(conn_string, table_name="foo") + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_connection_string_custom_domain(self, resource_group, location, storage_account, storage_account_key): + # Arrange + for service_type in SERVICES.items(): + conn_string = 'AccountName={};AccountKey={};TableEndpoint=www.mydomain.com;'.format( + storage_account.name, storage_account_key) + + # Act + service = service_type[0].from_connection_string(conn_string, table_name="foo") + + # Assert + self.assertIsNotNone(service) + self.assertEqual(service.account_name, storage_account.name) + self.assertEqual(service.credential.account_name, storage_account.name) + self.assertEqual(service.credential.account_key, storage_account_key) + self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com')) + self.assertTrue(service.secondary_endpoint.startswith('https://' + storage_account.name + '-secondary.table.core.windows.net')) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_conn_str_custom_domain_trailing_slash(self, resource_group, location, storage_account, storage_account_key): + # Arrange + for service_type in SERVICES.items(): + conn_string = 'AccountName={};AccountKey={};TableEndpoint=www.mydomain.com/;'.format( + storage_account.name, storage_account_key) + + # Act + service = service_type[0].from_connection_string(conn_string, table_name="foo") + + # Assert + self.assertIsNotNone(service) + self.assertEqual(service.account_name, storage_account.name) + self.assertEqual(service.credential.account_name, storage_account.name) + self.assertEqual(service.credential.account_key, storage_account_key) + self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com')) + self.assertTrue(service.secondary_endpoint.startswith('https://' + storage_account.name + '-secondary.table.core.windows.net')) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_conn_str_custom_domain_sec_override(self, resource_group, location, storage_account, storage_account_key): + # Arrange + for service_type in SERVICES.items(): + conn_string = 'AccountName={};AccountKey={};TableEndpoint=www.mydomain.com/;'.format( + storage_account.name, storage_account_key) + + # Act + service = service_type[0].from_connection_string( + conn_string, secondary_hostname="www-sec.mydomain.com", table_name="foo") + + # Assert + self.assertIsNotNone(service) + self.assertEqual(service.account_name, storage_account.name) + self.assertEqual(service.credential.account_name, storage_account.name) + self.assertEqual(service.credential.account_key, storage_account_key) + self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com')) + self.assertTrue(service.secondary_endpoint.startswith('https://www-sec.mydomain.com')) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_conn_str_fails_if_sec_without_primary(self, resource_group, location, storage_account, storage_account_key): + for service_type in SERVICES.items(): + # Arrange + conn_string = 'AccountName={};AccountKey={};{}=www.mydomain.com;'.format( + storage_account.name, storage_account_key, + _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) + + # Act + + # Fails if primary excluded + with self.assertRaises(ValueError): + service = service_type[0].from_connection_string(conn_string, table_name="foo") + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_conn_str_succeeds_if_sec_with_primary(self, resource_group, location, storage_account, storage_account_key): + for service_type in SERVICES.items(): + # Arrange + conn_string = 'AccountName={};AccountKey={};{}=www.mydomain.com;{}=www-sec.mydomain.com;'.format( + storage_account.name, + storage_account_key, + _CONNECTION_ENDPOINTS.get(service_type[1]), + _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) + + # Act + service = service_type[0].from_connection_string(conn_string, table_name="foo") + + # Assert + self.assertIsNotNone(service) + self.assertEqual(service.account_name, storage_account.name) + self.assertEqual(service.credential.account_name, storage_account.name) + self.assertEqual(service.credential.account_key, storage_account_key) + self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com')) + self.assertTrue(service.secondary_endpoint.startswith('https://www-sec.mydomain.com')) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_service_with_custom_account_endpoint_path(self, resource_group, location, storage_account, storage_account_key): + custom_account_url = "http://local-machine:11002/custom/account/path/" + self.sas_token + for service_type in SERVICES.items(): + conn_string = 'DefaultEndpointsProtocol=http;AccountName={};AccountKey={};TableEndpoint={};'.format( + storage_account.name, storage_account_key, custom_account_url) + + # Act + service = service_type[0].from_connection_string(conn_string, table_name="foo") + + # Assert + self.assertEqual(service.account_name, storage_account.name) + self.assertEqual(service.credential.account_name, storage_account.name) + self.assertEqual(service.credential.account_key, storage_account_key) + self.assertEqual(service.primary_hostname, 'local-machine:11002/custom/account/path') + + service = TableServiceClient(account_url=custom_account_url) + self.assertEqual(service.account_name, None) + self.assertEqual(service.credential, None) + self.assertEqual(service._primary_hostname, 'local-machine:11002/custom/account/path') + # mine doesnt have a question mark at the end + self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path')) + + service = TableClient(account_url=custom_account_url, table_name="foo") + self.assertEqual(service.account_name, None) + self.assertEqual(service.table_name, "foo") + self.assertEqual(service.credential, None) + self.assertEqual(service._primary_hostname, 'local-machine:11002/custom/account/path') + self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path')) + + service = TableClient.from_table_url("http://local-machine:11002/custom/account/path/foo" + self.sas_token) + self.assertEqual(service.account_name, None) + self.assertEqual(service.table_name, "foo") + self.assertEqual(service.credential, None) + self.assertEqual(service._primary_hostname, 'local-machine:11002/custom/account/path') + self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path')) + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_user_agent_default(self, resource_group, location, storage_account, storage_account_key): + service = TableServiceClient(self.account_url(storage_account, "table"), credential=storage_account_key) + + def callback(response): + self.assertTrue('User-Agent' in response.http_request.headers) + self.assertEqual( + response.http_request.headers['User-Agent'], + "azsdk-python-storage-table/{} Python/{} ({})".format( + VERSION, + platform.python_version(), + platform.platform())) + + tables = list(service.list_tables(raw_response_hook=callback)) + self.assertIsInstance(tables, list) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_user_agent_custom(self, resource_group, location, storage_account, storage_account_key): + custom_app = "TestApp/v1.0" + service = TableServiceClient( + self.account_url(storage_account, "table"), credential=storage_account_key, user_agent=custom_app) + + def callback(response): + self.assertTrue('User-Agent' in response.http_request.headers) + self.assertIn( + "TestApp/v1.0 azsdk-python-storage-table/{} Python/{} ({})".format( + VERSION, + platform.python_version(), + platform.platform()), + response.http_request.headers['User-Agent'] + ) + + tables = list(service.list_tables(raw_response_hook=callback)) + self.assertIsInstance(tables, list) + + def callback(response): + self.assertTrue('User-Agent' in response.http_request.headers) + self.assertIn( + "TestApp/v2.0 TestApp/v1.0 azsdk-python-storage-table/{} Python/{} ({})".format( + VERSION, + platform.python_version(), + platform.platform()), + response.http_request.headers['User-Agent'] + ) + + tables = list(service.list_tables(raw_response_hook=callback, user_agent="TestApp/v2.0")) + self.assertIsInstance(tables, list) + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_user_agent_append(self, resource_group, location, storage_account, storage_account_key): + service = TableServiceClient(self.account_url(storage_account, "table"), credential=storage_account_key) + + def callback(response): + self.assertTrue('User-Agent' in response.http_request.headers) + self.assertEqual( + response.http_request.headers['User-Agent'], + "azsdk-python-storage-table/{} Python/{} ({}) customer_user_agent".format( + VERSION, + platform.python_version(), + platform.platform()) +) + + custom_headers = {'User-Agent': 'customer_user_agent'} + tables = list(service.list_tables(raw_response_hook=callback, headers=custom_headers)) + self.assertIsInstance(tables, list) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_table_client_with_complete_table_url(self, resource_group, location, storage_account, storage_account_key): + # Arrange + table_url = self.account_url(storage_account, "table") + "/foo" + service = TableClient(table_url, table_name='bar', credential=storage_account_key) + + # Assert + self.assertEqual(service.scheme, 'https') + self.assertEqual(service.table_name, 'bar') + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_table_client_with_complete_url(self, resource_group, location, storage_account, storage_account_key): + # Arrange + table_url = "https://{}.table.core.windows.net:443/foo".format(storage_account.name) + service = TableClient(account_url=table_url, table_name='bar', credential=storage_account_key) + + # Assert + self.assertEqual(service.scheme, 'https') + self.assertEqual(service.table_name, 'bar') + self.assertEqual(service.account_name, storage_account.name) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_create_table_client_with_invalid_name(self, resource_group, location, storage_account, storage_account_key): + # Arrange + table_url = "https://{}.table.core.windows.net:443/foo".format(storage_account.name) + invalid_table_name = "my_table" + + # Assert + with pytest.raises(ValueError) as excinfo: + service = TableClient(account_url=table_url, table_name=invalid_table_name, credential=storage_account_key) + + assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str(excinfo) + + + #@pytest.mark.skip("pending") + def test_error_with_malformed_conn_str(self): + # Arrange + + for conn_str in ["", "foobar", "foobar=baz=foo", "foo;bar;baz", "foo=;bar=;", "=", ";", "=;=="]: + for service_type in SERVICES.items(): + # Act + with self.assertRaises(ValueError) as e: + service = service_type[0].from_connection_string(conn_str, table_name="test") + + if conn_str in("", "foobar", "foo;bar;baz", ";"): + self.assertEqual( + str(e.exception), "Connection string is either blank or malformed.") + elif conn_str in ("foobar=baz=foo" , "foo=;bar=;", "=", "=;=="): + self.assertEqual( + str(e.exception), "Connection string missing required connection details.") + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_closing_pipeline_client(self, resource_group, location, storage_account, storage_account_key): + # Arrange + for client, url in SERVICES.items(): + # Act + service = client( + self.account_url(storage_account, "table"), credential=storage_account_key, table_name='table') + + # Assert + with service: + assert hasattr(service, 'close') + service.close() + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_closing_pipeline_client_simple(self, resource_group, location, storage_account, storage_account_key): + # Arrange + for client, url in SERVICES.items(): + # Act + service = client( + self.account_url(storage_account, "table"), credential=storage_account_key, table_name='table') + service.close() +# ------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main() diff --git a/sdk/tables/azure-data-tables/tests/test_table_encryption.py b/sdk/tables/azure-data-tables/tests/test_table_encryption.py new file mode 100644 index 000000000000..008f0ea3743c --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_table_encryption.py @@ -0,0 +1,977 @@ +# # coding: utf-8 +# +# # ------------------------------------------------------------------------- +# # Copyright (c) Microsoft Corporation. All rights reserved. +# # Licensed under the MIT License. See License.txt in the project root for +# # license information. +# # -------------------------------------------------------------------------- +# +# import unittest +# +# import pytest +# from datetime import datetime +# +# from azure.common import AzureException +# from azure.core.exceptions import ResourceExistsError +# from azure.data.tables import TableServiceClient +# from azure.data.tables._entity import EntityProperty, EdmType, Entity +# from azure.data.tables._models import TablePayloadFormat, AccessPolicy, TableSasPermissions, TableServices +# from azure.data.tables._shared._common_conversion import _encode_base64 +# from azure.data.tables._shared.encryption import _dict_to_encryption_data, _generate_AES_CBC_cipher +# from dateutil.tz import tzutc +# from os import urandom +# from json import loads +# from copy import deepcopy +# +# # from encryption_test_helper import KeyWrapper, KeyResolver, RSAKeyWrapper +# from testutils.common_recordingtestcase import TestMode +# +# pytestmark = pytest.mark.skip +# +# # from testcase import ( +# # TableTestCase, +# # TestMode, +# # record, +# # ) +# # from azure.data.tables import ( +# # Entity, +# # EntityProperty, +# # TableService, +# # EdmType, +# # TableBatch, +# # ) +# # from azure.storage.models import( +# # AccessPolicy, +# # ) +# # from tests.test_encryption_helper import( +# # KeyWrapper, +# # KeyResolver, +# # RSAKeyWrapper, +# # ) +# # from azure.storage.table.models import( +# # TablePayloadFormat, +# # TablePermissions, +# # ) +# from azure.data.tables._shared._error import ( +# _ERROR_UNSUPPORTED_TYPE_FOR_ENCRYPTION, +# ) +# from azure.data.tables._shared._error import ( +# _ERROR_OBJECT_INVALID, +# _ERROR_DECRYPTION_FAILURE, +# ) +# #Encyption not supported yet +# # from cryptography.hazmat.backends import default_backend +# # from cryptography.hazmat.primitives.ciphers.algorithms import AES +# # from cryptography.hazmat.primitives.ciphers.modes import CBC +# # from cryptography.hazmat.primitives.padding import PKCS7 +# # from cryptography.hazmat.primitives.ciphers import Cipher +# # from cryptography.hazmat.primitives.hashes import ( +# # Hash, +# # SHA256, +# # ) +# +# from _shared.testcase import GlobalStorageAccountPreparer, TableTestCase, LogCaptured +# +# +# class StorageTableEncryptionTest(TableTestCase): +# +# def _set_up(self, storage_account, storage_account_key): +# self.ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) +# self.table_name = self.get_resource_name('uttable') +# self.table = self.ts.get_table_client(self.table_name) +# if self.is_live: +# try: +# self.ts.create_table(table_name=self.table_name) +# except ResourceExistsError: +# pass +# +# self.query_tables = [] +# +# def _tear_down(self): +# if self.is_live: +# try: +# self.ts.delete_table(self.table_name) +# except: +# pass +# +# for table_name in self.query_tables: +# try: +# self.ts.delete_table(table_name) +# except: +# pass +# +# # --Helpers----------------------------------------------------------------- +# +# def _create_query_table_encrypted(self, entity_count): +# ''' +# Creates a table with the specified name and adds entities with the +# default set of values. PartitionKey is set to 'MyPartition' and RowKey +# is set to a unique counter value starting at 1 (as a string). The +# 'sex' attribute is set to be encrypted. +# ''' +# table_name = self.get_resource_name('querytable') +# self.ts.create_table(table_name, True) +# self.query_tables.append(table_name) +# self.ts.require_encryption = True +# +# entity = self._create_default_entity_for_encryption() +# self.table.create_entity(table_entity_properties=entity) +# # with self.ts.batch(table_name) as batch: +# # for i in range(1, entity_count + 1): +# # entity['RowKey'] = entity['RowKey'] + str(i) +# # batch.insert_entity(entity) +# return table_name +# +# def _create_random_base_entity_class(self): +# ''' +# Creates a class-based entity with only pk and rk. +# ''' +# partition = self.get_resource_name('pk') +# row = self.get_resource_name('rk') +# entity = Entity() +# entity.PartitionKey = partition +# entity.RowKey = row +# return entity +# +# def _create_random_base_entity_dict(self): +# ''' +# Creates a dict-based entity with only pk and rk. +# ''' +# partition = self.get_resource_name('pk') +# row = self.get_resource_name('rk') +# return {'PartitionKey': partition, +# 'RowKey': row, +# } +# +# def _create_random_entity_class(self, pk=None, rk=None): +# ''' +# Creates a class-based entity with fixed values, using all +# of the supported data types. +# ''' +# partition = pk if pk is not None else self.get_resource_name('pk') +# row = rk if rk is not None else self.get_resource_name('rk') +# entity = Entity() +# entity.PartitionKey = partition +# entity.RowKey = row +# entity.age = 39 +# entity.sex = 'male' +# entity.name = 'John Doe' +# entity.married = True +# entity.deceased = False +# entity.optional = None +# entity.evenratio = 3.0 +# entity.ratio = 3.1 +# entity.large = 933311100 +# entity.Birthday = datetime(1973, 10, 4) +# entity.birthday = datetime(1970, 10, 4) +# entity.binary = EntityProperty(EdmType.BINARY, b'binary') +# entity.other = EntityProperty(EdmType.INT32, 20) +# entity.clsid = EntityProperty( +# EdmType.GUID, 'c9da6455-213d-42c9-9a79-3e9149a57833') +# return entity +# +# def _create_default_entity_for_encryption(self): +# entity = self._create_random_entity_class() +# entity['sex'] = EntityProperty(EdmType.STRING, entity['sex'], True) +# entity['name'] = EntityProperty(EdmType.STRING, entity['name'], True) +# return entity +# +# def _create_default_entity_dict(self, pk=None, rk=None): +# ''' +# Creates a dictionary-based entity with fixed values, using all +# of the supported data types. +# ''' +# partition = pk if pk is not None else self.get_resource_name('pk') +# row = rk if rk is not None else self.get_resource_name('rk') +# return {'PartitionKey': partition, +# 'RowKey': row, +# 'age': 39, +# 'sex': 'male', +# 'name': 'John Doe', +# 'married': True, +# 'deceased': False, +# 'optional': None, +# 'ratio': 3.1, +# 'evenratio': 3.0, +# 'large': 933311100, +# 'Birthday': datetime(1973, 10, 4), +# 'birthday': datetime(1970, 10, 4), +# 'binary': EntityProperty(EdmType.BINARY, b'binary'), +# 'other': EntityProperty(EdmType.INT32, 20), +# 'clsid': EntityProperty( +# EdmType.GUID, +# 'c9da6455-213d-42c9-9a79-3e9149a57833')} +# +# def _assert_default_entity(self, entity): +# ''' +# Asserts that the entity passed in matches the default entity. +# ''' +# self.assertEqual(entity.age, 39) +# self.assertEqual(entity.sex, 'male') +# self.assertEqual(entity.name, 'John Doe') +# self.assertEqual(entity.married, True) +# self.assertEqual(entity.deceased, False) +# self.assertFalse(hasattr(entity, "optional")) +# self.assertFalse(hasattr(entity, "aquarius")) +# self.assertEqual(entity.ratio, 3.1) +# self.assertEqual(entity.evenratio, 3.0) +# self.assertEqual(entity.large, 933311100) +# self.assertEqual(entity.Birthday, datetime(1973, 10, 4, tzinfo=tzutc())) +# self.assertEqual(entity.birthday, datetime(1970, 10, 4, tzinfo=tzutc())) +# self.assertIsInstance(entity.binary, EntityProperty) +# self.assertEqual(entity.binary.type, EdmType.BINARY) +# self.assertEqual(entity.binary.value, b'binary') +# self.assertIsInstance(entity.other, EntityProperty) +# self.assertEqual(entity.other.type, EdmType.INT32) +# self.assertEqual(entity.other.value, 20) +# self.assertIsInstance(entity.clsid, EntityProperty) +# self.assertEqual(entity.clsid.type, EdmType.GUID) +# self.assertEqual(entity.clsid.value, +# 'c9da6455-213d-42c9-9a79-3e9149a57833') +# self.assertTrue(hasattr(entity, "Timestamp")) +# self.assertIsInstance(entity.Timestamp, datetime) +# self.assertIsNotNone(entity.etag) +# +# def _assert_default_entity_json_no_metadata(self, entity): +# ''' +# Asserts that the entity passed in matches the default entity. +# ''' +# self.assertEqual(entity.age, '39') +# self.assertEqual(entity.sex, 'male') +# self.assertEqual(entity.name, 'John Doe') +# self.assertEqual(entity.married, True) +# self.assertEqual(entity.deceased, False) +# self.assertFalse(hasattr(entity, "optional")) +# self.assertFalse(hasattr(entity, "aquarius")) +# self.assertEqual(entity.ratio, 3.1) +# self.assertEqual(entity.evenratio, 3.0) +# self.assertEqual(entity.large, '933311100') +# self.assertEqual(entity.Birthday, '1973-10-04T00:00:00Z') +# self.assertEqual(entity.birthday, '1970-10-04T00:00:00Z') +# self.assertEqual(entity.binary, _encode_base64(b'binary')) +# self.assertIsInstance(entity.other, EntityProperty) +# self.assertEqual(entity.other.type, EdmType.INT32) +# self.assertEqual(entity.other.value, 20) +# self.assertEqual(entity.clsid, 'c9da6455-213d-42c9-9a79-3e9149a57833') +# self.assertTrue(hasattr(entity, "Timestamp")) +# self.assertIsInstance(entity.Timestamp, datetime) +# self.assertIsNotNone(entity.etag) +# +# def _default_encryption_resolver(self, x, y, property): +# return (property == 'sex' or property == 'name') +# +# # @record +# def test_get_encrypted_dict(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_dict() +# entity['sex'] = EntityProperty(EdmType.STRING, entity['sex'], True) +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.table.create_entity(table_entity_properties=entity) +# +# # Act +# new_entity = self.table.get_entity(entity['PartitionKey'], entity['RowKey']) +# +# # Assert +# self._assert_default_entity(new_entity) +# +# # @record +# def test_get_encrypted_entity(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# # Only want to encrypt one property in this test +# entity['name'] = 'John Doe' +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.table.insert_entity(self.table_name, entity) +# +# # Act +# new_entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # Assert +# self._assert_default_entity(new_entity) +# +# # @record +# def test_get_encrypt_multiple_properties(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.create_entity(table_entity_properties=entity) +# +# # Act +# new_entity = self.ts.get_entity(entity['PartitionKey'], entity['RowKey']) +# +# # Assert +# self._assert_default_entity(new_entity) +# +# # @record +# def test_get_encrypted_entity_key_resolver(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = KeyWrapper('key1') +# key_resolver = KeyResolver() +# key_resolver.put_key(self.ts.key_encryption_key) +# self.ts.key_resolver_function = key_resolver.resolve_key +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# self.ts.key_encryption_key = None +# new_entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # Assert +# self._assert_default_entity(new_entity) +# +# # @record +# def test_get_encrypted_entity_encryption_resolver(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_random_entity_class() +# self.ts.encryption_resolver_function = self._default_encryption_resolver +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# new_entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# self.ts.key_encryption_key = None +# self.ts.require_encryption = False +# # Retrive a second copy without decrypting to ensure properties were encrypted. +# new_entity2 = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # Assert +# self._assert_default_entity(new_entity) +# self.assertEqual(EdmType.BINARY, new_entity2['sex'].type) +# self.assertEqual(EdmType.BINARY, new_entity2['name'].type) +# +# # @record +# def test_get_encrypted_entity_properties_and_resolver(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# self.ts.encryption_resolver_function = self._default_encryption_resolver +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# new_entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # Assert +# self._assert_default_entity(new_entity) +# +# def _get_with_payload_format(self, format): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# entity['RowKey'] = entity['RowKey'] + format[len('application/json;odata='):] +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# new_entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey'], +# accept=format) +# +# # Assert +# if format == TablePayloadFormat.JSON_NO_METADATA: +# self._assert_default_entity_json_no_metadata(new_entity) +# else: +# self._assert_default_entity(new_entity) +# +# # @record +# def test_get_payload_formats(self): +# self._get_with_payload_format(TablePayloadFormat.JSON_FULL_METADATA) +# self._get_with_payload_format(TablePayloadFormat.JSON_MINIMAL_METADATA) +# self._get_with_payload_format(TablePayloadFormat.JSON_NO_METADATA) +# +# def test_get_entity_kek_RSA(self): +# # We can only generate random RSA keys, so this must be run live or +# # the playback test will fail due to a change in kek values. +# if TestMode.need_recording_file(self.test_mode): +# return +# +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = RSAKeyWrapper('key2') +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# new_entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # Assert +# self._assert_default_entity(new_entity) +# +# # @record +# def test_get_entity_nonmatching_kid(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_random_entity_class() +# self.ts.encryption_resolver_function = self._default_encryption_resolver +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# self.ts.key_encryption_key.kid = 'Invalid' +# +# # Assert +# try: +# self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# self.fail() +# except AzureException as e: +# self.assertEqual(str(e), _ERROR_DECRYPTION_FAILURE) +# +# # @record +# def test_get_entity_invalid_value_kek_wrap(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = KeyWrapper('key1') +# +# self.ts.key_encryption_key.get_key_wrap_algorithm = None +# try: +# self.ts.insert_entity(self.table_name, entity) +# self.fail() +# except AttributeError as e: +# self.assertEqual(str(e), _ERROR_OBJECT_INVALID.format('key encryption key', 'get_key_wrap_algorithm')) +# +# self.ts.key_encryption_key = KeyWrapper('key1') +# +# self.ts.key_encryption_key.get_kid = None +# with self.assertRaises(AttributeError): +# self.ts.insert_entity(self.table_name, entity) +# +# self.ts.key_encryption_key = KeyWrapper('key1') +# +# self.ts.key_encryption_key.wrap_key = None +# with self.assertRaises(AttributeError): +# self.ts.insert_entity(self.table_name, entity) +# +# # @record +# def test_get_entity_invalid_value_kek_unwrap(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# self.ts.key_encryption_key.unwrap_key = None +# try: +# self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# self.fail() +# except AzureException as e: +# self.assertEqual(str(e), _ERROR_DECRYPTION_FAILURE) +# +# self.ts.key_encryption_key = KeyWrapper('key1') +# +# self.ts.key_encryption_key.get_kid = None +# with self.assertRaises(AzureException): +# self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # @record +# def test_insert_entity_missing_attribute_kek_wrap(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# valid_key = KeyWrapper('key1') +# +# # Act +# invalid_key_1 = lambda: None # functions are objects, so this effectively creates an empty object +# invalid_key_1.get_key_wrap_algorithm = valid_key.get_key_wrap_algorithm +# invalid_key_1.get_kid = valid_key.get_kid +# # No attribute wrap_key +# self.ts.key_encryption_key = invalid_key_1 +# with self.assertRaises(AttributeError): +# self.ts.insert_entity(self.table_name, entity) +# +# invalid_key_2 = lambda: None # functions are objects, so this effectively creates an empty object +# invalid_key_2.wrap_key = valid_key.wrap_key +# invalid_key_2.get_kid = valid_key.get_kid +# # No attribute get_key_wrap_algorithm +# self.ts.key_encryption_key = invalid_key_2 +# with self.assertRaises(AttributeError): +# self.ts.insert_entity(self.table_name, entity) +# +# invalid_key_3 = lambda: None # functions are objects, so this effectively creates an empty object +# invalid_key_3.get_key_wrap_algorithm = valid_key.get_key_wrap_algorithm +# invalid_key_3.wrap_key = valid_key.wrap_key +# # No attribute get_kid +# self.ts.key_encryption_key = invalid_key_3 +# with self.assertRaises(AttributeError): +# self.ts.insert_entity(self.table_name, entity) +# +# # @record +# def test_get_entity_missing_attribute_kek_unwrap(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# valid_key = KeyWrapper('key1') +# self.ts.key_encryption_key = valid_key +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# invalid_key_1 = lambda: None # functions are objects, so this effectively creates an empty object +# invalid_key_1.get_kid = valid_key.get_kid +# # No attribute unwrap_key +# self.ts.key_encryption_key = invalid_key_1 +# with self.assertRaises(AzureException): +# self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# invalid_key_2 = lambda: None # functions are objects, so this effectively creates an empty object +# invalid_key_2.unwrap_key = valid_key.unwrap_key +# # No attribute get_kid +# self.ts.key_encryption_key = invalid_key_2 +# with self.assertRaises(AzureException): +# self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # @record +# def test_get_entity_no_decryption(self): +# # Arrange +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# self.ts.key_encryption_key = None +# new_entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # Assert +# # Access the properties to ensure they are still on the entity +# new_entity['_ClientEncryptionMetadata1'] +# new_entity['_ClientEncryptionMetadata2'] +# +# value = new_entity['sex'] +# self.assertEqual(value.type, EdmType.BINARY) +# +# # @record +# def test_replace_entity(self): +# # Arrange +# entity = self._create_random_entity_class() +# self.ts.insert_entity(self.table_name, entity) +# entity['sex'] = EntityProperty(EdmType.STRING, 'female', True) +# self.ts.key_encryption_key = KeyWrapper('key1') +# +# # Act +# self.ts.require_encryption = True +# self.ts.update_entity(self.table_name, entity) +# new_entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # Assert +# self.assertEqual(new_entity['sex'], entity['sex'].value) +# +# # @record +# def test_insert_strict_mode(self): +# # Arrange +# entity = self._create_default_entity_for_encryption() +# self.ts.require_encryption = True +# +# # Assert +# with self.assertRaises(ValueError): +# self.ts.insert_entity(self.table_name, entity) +# +# # @record +# def test_strict_mode_policy_no_encrypted_properties(self): +# # Arrange +# entity = self._create_random_entity_class() +# self.ts.require_encryption = True +# self.ts.key_encryption_key = KeyWrapper('key1') +# +# # Act +# # Even when require encryption is true, it should be possilbe to insert +# # an entity that happens to not have any properties marked for encyrption. +# self.ts.insert_entity(self.table_name, entity) +# new_entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # Assert +# self._assert_default_entity(new_entity) +# +# # @record +# def test_get_strict_mode_no_key(self): +# # Arrange +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# self.ts.key_encryption_key = None +# self.ts.require_encryption = True +# +# # Assert +# with self.assertRaises(AzureException): +# self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # @record +# def test_get_strict_mode_unencrypted_entity(self): +# # Arrange +# entity = self._create_random_base_entity_class() +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# self.ts.require_encryption = True +# self.ts.key_encryption_key = KeyWrapper('key1') +# +# # Assert +# with self.assertRaises(AzureException): +# self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # @record +# @pytest.mark.skip("pending") +# def test_batch_entity_inserts_context_manager(self): +# # Arrange +# self.ts.require_encryption = True +# entity1 = self._create_random_entity_class() +# entity2 = self._create_random_entity_class(rk='Entity2') +# entity3 = self._create_random_entity_class(rk='Entity3') +# entity2['PartitionKey'] = entity1['PartitionKey'] +# entity3['PartitionKey'] = entity1['PartitionKey'] +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.require_encryption = True +# self.ts.encryption_resolver_function = self._default_encryption_resolver +# self.ts.insert_entity(self.table_name, entity3) +# entity3['sex'] = 'female' +# +# # Act +# with self.ts.batch(self.table_name) as batch: +# batch.insert_entity(entity1) +# batch.insert_or_replace_entity(entity2) +# batch.update_entity(entity3) +# +# new_entity1 = self.ts.get_entity(self.table_name, entity1['PartitionKey'], entity1['RowKey']) +# new_entity2 = self.ts.get_entity(self.table_name, entity2['PartitionKey'], entity2['RowKey']) +# new_entity3 = self.ts.get_entity(self.table_name, entity3['PartitionKey'], entity3['RowKey']) +# +# # Assert +# self.assertEqual(new_entity1['sex'], entity1['sex']) +# self.assertEqual(new_entity2['sex'], entity2['sex']) +# self.assertEqual(new_entity3['sex'], entity3['sex']) +# +# # @record +# @pytest.mark.skip("pending") +# def test_batch_strict_mode(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# +# # Act +# batch = TableBatch(require_encryption=True) +# +# # Assert +# with self.assertRaises(ValueError): +# batch.insert_entity(entity) +# +# # @record +# def test_property_resolver_decrypt_conflict(self): +# # Tests that the encrypted properties list is given priorty +# # over the property resolver when deserializng (i.e. the +# # EdmType should be binary, not the result of the resolver) +# +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# property_resolver = lambda x, y, name, a, b: EdmType.STRING if name == 'sex' else None +# +# # Act +# new_entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey'], +# property_resolver=property_resolver) +# +# # Assert +# # If the encrypted property list correctly took priority, this field will have been +# # properly decrypted +# self.assertEqual(new_entity['sex'], 'male') +# +# # @record +# def test_validate_encryption(self): +# # Arrange +# entity = self._create_default_entity_for_encryption() +# key_encryption_key = KeyWrapper('key1') +# self.ts.key_encryption_key = key_encryption_key +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# self.ts.key_encryption_key = None +# entity = self.ts.get_entity(self.table_name, entity['PartitionKey'], entity['RowKey']) +# +# # Note the minor discrepancy from the normal decryption process: because the entity was retrieved +# # without being decrypted, the encrypted_properties list is now stored in an EntityProperty object +# # and is already raw bytes. +# encrypted_properties_list = entity['_ClientEncryptionMetadata2'].value +# encryption_data = entity['_ClientEncryptionMetadata1'] +# encryption_data = _dict_to_encryption_data(loads(encryption_data)) +# +# content_encryption_key = key_encryption_key.unwrap_key(encryption_data.wrapped_content_key.encrypted_key, +# encryption_data.wrapped_content_key.algorithm) +# +# digest = Hash(SHA256(), default_backend()) +# digest.update(encryption_data.content_encryption_IV + +# (entity['RowKey'] + entity['PartitionKey'] + '_ClientEncryptionMetadata2').encode('utf-8')) +# metadataIV = digest.finalize() +# metadataIV = metadataIV[:16] +# +# cipher = _generate_AES_CBC_cipher(content_encryption_key, metadataIV) +# +# # Decrypt the data. +# decryptor = cipher.decryptor() +# encrypted_properties_list = decryptor.update(encrypted_properties_list) + decryptor.finalize() +# +# # Unpad the data. +# unpadder = PKCS7(128).unpadder() +# encrypted_properties_list = unpadder.update(encrypted_properties_list) + unpadder.finalize() +# +# encrypted_properties_list = encrypted_properties_list.decode('utf-8') +# +# # Strip the square braces from the ends and split string into list. +# encrypted_properties_list = loads(encrypted_properties_list) +# +# entity_iv, encrypted_properties, content_encryption_key = \ +# (encryption_data.content_encryption_IV, encrypted_properties_list, content_encryption_key) +# +# decrypted_entity = deepcopy(entity) +# +# for property in encrypted_properties_list: +# value = entity[property] +# +# digest = Hash(SHA256(), default_backend()) +# digest.update(entity_iv + +# (entity['RowKey'] + entity['PartitionKey'] + property).encode('utf-8')) +# propertyIV = digest.finalize() +# propertyIV = propertyIV[:16] +# +# cipher = _generate_AES_CBC_cipher(content_encryption_key, +# propertyIV) +# +# # Decrypt the property. +# decryptor = cipher.decryptor() +# decrypted_data = (decryptor.update(value.value) + decryptor.finalize()) +# +# # Unpad the data. +# unpadder = PKCS7(128).unpadder() +# decrypted_data = (unpadder.update(decrypted_data) + unpadder.finalize()) +# +# decrypted_data = decrypted_data.decode('utf-8') +# +# decrypted_entity[property] = decrypted_data +# +# decrypted_entity.pop('_ClientEncryptionMetadata1') +# decrypted_entity.pop('_ClientEncryptionMetadata2') +# +# # Assert +# self.assertEqual(decrypted_entity['sex'], 'male') +# +# # @record +# def test_insert_encrypt_invalid_types(self): +# # Arrange +# self.ts.require_encryption = True +# entity_binary = self._create_random_entity_class() +# entity_binary['bytes'] = EntityProperty(EdmType.BINARY, urandom(10), True) +# entity_boolean = self._create_random_entity_class() +# entity_boolean['married'] = EntityProperty(EdmType.BOOLEAN, True, True) +# entity_date_time = self._create_random_entity_class() +# entity_date_time['birthday'] = EntityProperty(EdmType.DATETIME, entity_date_time['birthday'], True) +# entity_double = self._create_random_entity_class() +# entity_double['ratio'] = EntityProperty(EdmType.DATETIME, entity_double['ratio'], True) +# entity_guid = self._create_random_entity_class() +# entity_guid['clsid'].encrypt = True +# entity_int32 = self._create_random_entity_class() +# entity_int32['other'].encrypt = True +# entity_int64 = self._create_random_entity_class() +# entity_int64['large'] = EntityProperty(EdmType.INT64, entity_int64['large'], True) +# self.ts.key_encryption_key = KeyWrapper('key1') +# entity_none_str = self._create_random_entity_class() +# entity_none_str['none_str'] = EntityProperty(EdmType.STRING, None, True) +# +# # Act +# +# # Assert +# try: +# self.ts.insert_entity(self.table_name, entity_binary) +# self.fail() +# except ValueError as e: +# self.assertEqual(str(e), _ERROR_UNSUPPORTED_TYPE_FOR_ENCRYPTION) +# with self.assertRaises(ValueError): +# self.ts.insert_entity(self.table_name, entity_boolean) +# with self.assertRaises(ValueError): +# self.ts.insert_entity(self.table_name, entity_date_time) +# with self.assertRaises(ValueError): +# self.ts.insert_entity(self.table_name, entity_double) +# with self.assertRaises(ValueError): +# self.ts.insert_entity(self.table_name, entity_guid) +# with self.assertRaises(ValueError): +# self.ts.insert_entity(self.table_name, entity_int32) +# with self.assertRaises(ValueError): +# self.ts.insert_entity(self.table_name, entity_int64) +# with self.assertRaises(ValueError): +# self.ts.insert_entity(self.table_name, entity_none_str) +# +# # @record +# def test_invalid_encryption_operations_fail(self): +# # Arrange +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# # Assert +# with self.assertRaises(ValueError): +# self.ts.merge_entity(self.table_name, entity) +# +# with self.assertRaises(ValueError): +# self.ts.insert_or_merge_entity(self.table_name, entity) +# +# self.ts.require_encryption = True +# self.ts.key_encryption_key = None +# +# with self.assertRaises(ValueError): +# self.ts.merge_entity(self.table_name, entity) +# +# with self.assertRaises(ValueError): +# self.ts.insert_or_merge_entity(self.table_name, entity) +# +# # @record +# @pytest.mark.skip("pending") +# def test_invalid_encryption_operations_fail_batch(self): +# # Arrange +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# batch = TableBatch(require_encryption=True, key_encryption_key=self.ts.key_encryption_key) +# +# # Assert +# with self.assertRaises(ValueError): +# batch.merge_entity(entity) +# +# with self.assertRaises(ValueError): +# batch.insert_or_merge_entity(entity) +# +# # @record +# def test_query_entities_all_properties(self): +# # Arrange +# self.ts.require_encryption = True +# self.ts.key_encryption_key = KeyWrapper('key1') +# table_name = self._create_query_table_encrypted(5) +# default_entity = self._create_random_entity_class() +# +# # Act +# resp = self.ts.query_entities(table_name, num_results=5) +# +# # Assert +# self.assertEqual(len(resp.items), 5) +# for entity in resp.items: +# self.assertEqual(default_entity['sex'], entity['sex']) +# +# # @record +# def test_query_entities_projection(self): +# # Arrange +# self.ts.require_encryption = True +# self.ts.key_encryption_key = KeyWrapper('key1') +# table_name = self._create_query_table_encrypted(5) +# default_entity = self._create_random_entity_class() +# +# # Act +# resp = self.ts.query_entities(table_name, num_results=5, select='PartitionKey,RowKey,sex') +# +# # Assert +# for entity in resp.items: +# self.assertEqual(default_entity['sex'], entity['sex']) +# self.assertFalse(hasattr(entity, '_ClientEncryptionMetadata1')) +# self.assertFalse(hasattr(entity, '_ClientEncryptionMetadata2')) +# +# # @record +# def test_query_entities_mixed_mode(self): +# # Arrange +# entity = self._create_random_entity_class(rk='unencrypted') +# entity['RowKey'] += 'unencrypted' +# self.ts.insert_entity(self.table_name, entity) +# entity = self._create_default_entity_for_encryption() +# self.ts.key_encryption_key = KeyWrapper('key1') +# self.ts.insert_entity(self.table_name, entity) +# +# # Act +# # Pass with out encryption_required +# self.ts.query_entities(self.table_name) +# +# # Assert +# # Fail with encryption_required because not all returned entities +# # will be encrypted. +# self.ts.require_encryption = True +# with self.assertRaises(AzureException): +# self.ts.query_entities(self.table_name) +# +# # @record +# def test_insert_entity_too_many_properties(self): +# # Arrange +# self.ts.require_encryption = True +# entity = self._create_random_base_entity_dict() +# self.ts.key_encryption_key = KeyWrapper('key1') +# for i in range(251): +# entity['key{0}'.format(i)] = 'value{0}'.format(i) +# +# # Act +# with self.assertRaises(ValueError): +# resp = self.ts.insert_entity(self.table_name, entity) +# +# # @record +# def test_validate_swapping_properties_fails(self): +# # Arrange +# entity1 = self._create_random_entity_class(rk='entity1') +# entity2 = self._create_random_entity_class(rk='entity2') +# kek = KeyWrapper('key1') +# self.ts.key_encryption_key = kek +# self.ts.encryption_resolver_function = self._default_encryption_resolver +# self.ts.insert_entity(self.table_name, entity1) +# self.ts.insert_entity(self.table_name, entity2) +# +# # Act +# self.ts.key_encryption_key = None +# new_entity1 = self.ts.get_entity(self.table_name, entity1['PartitionKey'], entity1['RowKey']) +# new_entity2 = deepcopy(new_entity1) +# new_entity2['PartitionKey'] = entity2['PartitionKey'] +# new_entity2['RowKey'] = entity2['RowKey'] +# self.ts.update_entity(self.table_name, new_entity2) +# self.ts.key_encryption_key = kek +# +# # Assert +# with self.assertRaises(AzureException): +# self.ts.get_entity(self.table_name, new_entity2['PartitionKey'], new_entity2['RowKey']) +# +# # @record +# def test_table_ops_ignore_encryption(self): +# table_name = self.get_resource_name('EncryptionTableOps') +# try: +# # Arrange +# self.ts.require_encryption = True +# self.ts.key_encryption_key = KeyWrapper('key1') +# +# # Act +# self.assertTrue(self.ts.create_table(table_name)) +# +# self.assertTrue(self.ts.exists(table_name)) +# +# list_tables = self.ts.list_tables() +# test_table_exists = False +# for table in list_tables: +# if table.name == table_name: +# test_table_exists = True +# self.assertTrue(test_table_exists) +# +# permissions = self.ts.get_table_acl(table_name) +# new_policy = AccessPolicy(TableSasPermissions(_str='r'), expiry=datetime(2017, 9, 9)) +# permissions['samplePolicy'] = new_policy +# self.ts.set_table_acl(table_name, permissions) +# permissions = self.ts.get_table_acl(table_name) +# permissions['samplePolicy'] +# self.ts.key_encryption_key = None +# permissions = self.ts.get_table_acl(table_name) +# permissions['samplePolicy'] +# +# self.ts.delete_table(table_name) +# self.assertFalse(self.ts.exists(table_name)) +# finally: +# self.ts.delete_table(table_name) +# +# +# # ------------------------------------------------------------------------------ +# if __name__ == '__main__': +# unittest.main() diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity.py b/sdk/tables/azure-data-tables/tests/test_table_entity.py new file mode 100644 index 000000000000..c199a57d506f --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_table_entity.py @@ -0,0 +1,1714 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import unittest + +import pytest + +import uuid +from base64 import b64encode +from datetime import datetime, timedelta + +from azure.data.tables import TableServiceClient, TableClient, generate_table_sas +from dateutil.tz import tzutc, tzoffset +from math import isnan + +from azure.core import MatchConditions +from azure.core.exceptions import ( + HttpResponseError, + ResourceNotFoundError, + ResourceExistsError) + +from azure.data.tables._entity import TableEntity, EntityProperty, EdmType +from azure.data.tables._models import TableSasPermissions, AccessPolicy, UpdateMode + +from _shared.testcase import GlobalStorageAccountPreparer, TableTestCase, LogCaptured + + +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ + +class StorageTableEntityTest(TableTestCase): + + def _set_up(self, storage_account, storage_account_key): + self.ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + self.table_name = self.get_resource_name('uttable') + self.table = self.ts.get_table_client(self.table_name) + if self.is_live: + try: + self.ts.create_table(self.table_name) + except ResourceExistsError: + pass + + self.query_tables = [] + + def _tear_down(self): + if self.is_live: + try: + self.ts.delete_table(self.table_name) + except: + pass + + for table_name in self.query_tables: + try: + self.ts.delete_table(table_name) + except: + pass + + # --Helpers----------------------------------------------------------------- + + def _create_query_table(self, entity_count): + """ + Creates a table with the specified name and adds entities with the + default set of values. PartitionKey is set to 'MyPartition' and RowKey + is set to a unique counter value starting at 1 (as a string). + """ + table_name = self.get_resource_name('querytable') + table = self.ts.create_table(table_name) + self.query_tables.append(table_name) + client = self.ts.get_table_client(table_name) + entity = self._create_random_entity_dict() + for i in range(1, entity_count + 1): + entity['RowKey'] = entity['RowKey'] + str(i) + client.create_entity(entity) + # with self.ts.batch(table_name) as batch: + # for i in range(1, entity_count + 1): + # entity['RowKey'] = entity['RowKey'] + str(i) + # batch.create_entity(entity) + return client + + def _create_random_base_entity_dict(self): + """ + Creates a dict-based entity with only pk and rk. + """ + partition = self.get_resource_name('pk') + row = self.get_resource_name('rk') + return { + 'PartitionKey': partition, + 'RowKey': row, + } + + def _create_random_entity_dict(self, pk=None, rk=None): + """ + Creates a dictionary-based entity with fixed values, using all + of the supported data types. + """ + partition = pk if pk is not None else self.get_resource_name('pk') + row = rk if rk is not None else self.get_resource_name('rk') + properties = { + 'PartitionKey': partition, + 'RowKey': row, + 'age': 39, + 'sex': 'male', + 'married': True, + 'deceased': False, + 'optional': None, + 'ratio': 3.1, + 'evenratio': 3.0, + 'large': 933311100, + 'Birthday': datetime(1973, 10, 4, tzinfo=tzutc()), + 'birthday': datetime(1970, 10, 4, tzinfo=tzutc()), + 'binary': b'binary', + 'other': EntityProperty(type=EdmType.INT32, value=20), + 'clsid': uuid.UUID('c9da6455-213d-42c9-9a79-3e9149a57833') + } + return TableEntity(**properties) + + def _insert_random_entity(self, pk=None, rk=None): + entity = self._create_random_entity_dict(pk, rk) + # etag = self.table.create_item(entity, response_hook=lambda e, h: h['etag']) + e = self.table.create_entity(entity) + metadata = e.metadata() + return entity, metadata['etag'] + + def _create_updated_entity_dict(self, partition, row): + """ + Creates a dictionary-based entity with fixed values, with a + different set of values than the default entity. It + adds fields, changes field values, changes field types, + and removes fields when compared to the default entity. + """ + return { + 'PartitionKey': partition, + 'RowKey': row, + 'age': 'abc', + 'sex': 'female', + 'sign': 'aquarius', + 'birthday': datetime(1991, 10, 4, tzinfo=tzutc()) + } + + def _assert_default_entity(self, entity, headers=None): + ''' + Asserts that the entity passed in matches the default entity. + ''' + self.assertEqual(entity['age'], 39) + self.assertEqual(entity['sex'], 'male') + self.assertEqual(entity['married'], True) + self.assertEqual(entity['deceased'], False) + self.assertFalse("optional" in entity) + self.assertFalse("aquarius" in entity) + self.assertEqual(entity['ratio'], 3.1) + self.assertEqual(entity['evenratio'], 3.0) + self.assertEqual(entity['large'], 933311100) + self.assertEqual(entity['Birthday'], datetime(1973, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity['birthday'], datetime(1970, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity['binary'].value, b'binary') + self.assertIsInstance(entity['other'], EntityProperty) + self.assertEqual(entity['other'].type, EdmType.INT32) + self.assertEqual(entity['other'].value, 20) + self.assertEqual(entity['clsid'], uuid.UUID('c9da6455-213d-42c9-9a79-3e9149a57833')) + # self.assertTrue('metadata' in entity.odata) + # self.assertIsNotNone(entity.metadata['timestamp']) + # self.assertIsInstance(entity.metadata['timestamp'], datetime) + # if headers: + # self.assertTrue("etag" in headers) + + # self.assertIsNotNone(headers['etag']) + + def _assert_default_entity_json_full_metadata(self, entity, headers=None): + ''' + Asserts that the entity passed in matches the default entity. + ''' + self.assertEqual(entity['age'], 39) + self.assertEqual(entity['sex'], 'male') + self.assertEqual(entity['married'], True) + self.assertEqual(entity['deceased'], False) + self.assertFalse("optional" in entity) + self.assertFalse("aquarius" in entity) + self.assertEqual(entity['ratio'], 3.1) + self.assertEqual(entity['evenratio'], 3.0) + self.assertEqual(entity['large'], 933311100) + self.assertEqual(entity['Birthday'], datetime(1973, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity['birthday'], datetime(1970, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity['binary'].value, b'binary') + self.assertIsInstance(entity['other'], EntityProperty) + self.assertEqual(entity['other'].type, EdmType.INT32) + self.assertEqual(entity['other'].value, 20) + self.assertEqual(entity['clsid'], uuid.UUID('c9da6455-213d-42c9-9a79-3e9149a57833')) + # self.assertTrue('metadata' in entity.odata) + # self.assertTrue('id' in entity.odata) + # self.assertTrue('type' in entity.odata) + # self.assertTrue('etag' in entity.odata) + # self.assertTrue('editLink' in entity.odata) + + # self.assertIsNotNone(entity.Timestamp) + # self.assertIsInstance(entity.Timestamp, datetime) + # if headers: + # self.assertTrue("etag" in headers) + # self.assertIsNotNone(headers['etag']) + + def _assert_default_entity_json_no_metadata(self, entity, headers=None): + ''' + Asserts that the entity passed in matches the default entity. + ''' + self.assertEqual(entity['age'], '39') + self.assertEqual(entity['sex'], 'male') + self.assertEqual(entity['married'], True) + self.assertEqual(entity['deceased'], False) + self.assertFalse("optional" in entity) + self.assertFalse("aquarius" in entity) + self.assertEqual(entity['ratio'], 3.1) + self.assertEqual(entity['evenratio'], 3.0) + self.assertEqual(entity['large'], '933311100') + self.assertTrue(entity['Birthday'].startswith('1973-10-04T00:00:00')) + self.assertTrue(entity['birthday'].startswith('1970-10-04T00:00:00')) + self.assertTrue(entity['Birthday'].endswith('00Z')) + self.assertTrue(entity['birthday'].endswith('00Z')) + self.assertEqual(entity['binary'], b64encode(b'binary').decode('utf-8')) + self.assertIsInstance(entity['other'], EntityProperty) + self.assertEqual(entity['other'].type, EdmType.INT32) + self.assertEqual(entity['other'].value, 20) + self.assertEqual(entity['clsid'], 'c9da6455-213d-42c9-9a79-3e9149a57833') + # self.assertIsNone(entity.odata) + # self.assertIsNotNone(entity.Timestamp) + + # self.assertIsInstance(entity.Timestamp, datetime) + # if headers: + # self.assertTrue("etag" in headers) + # self.assertIsNotNone(headers['etag']) + + def _assert_updated_entity(self, entity): + ''' + Asserts that the entity passed in matches the updated entity. + ''' + self.assertEqual(entity.age, 'abc') + self.assertEqual(entity.sex, 'female') + self.assertFalse(hasattr(entity, "married")) + self.assertFalse(hasattr(entity, "deceased")) + self.assertEqual(entity.sign, 'aquarius') + self.assertFalse(hasattr(entity, "optional")) + self.assertFalse(hasattr(entity, "ratio")) + self.assertFalse(hasattr(entity, "evenratio")) + self.assertFalse(hasattr(entity, "large")) + self.assertFalse(hasattr(entity, "Birthday")) + # self.assertEqual(entity.birthday, "1991-10-04 00:00:00+00:00") + self.assertEqual(entity.birthday, datetime(1991, 10, 4, tzinfo=tzutc())) + self.assertFalse(hasattr(entity, "other")) + self.assertFalse(hasattr(entity, "clsid")) + # self.assertIsNotNone(entity.odata.etag) + + # self.assertIsNotNone(entity.Timestamp) + # self.assertIsInstance(entity.timestamp, datetime) + + def _assert_merged_entity(self, entity): + ''' + Asserts that the entity passed in matches the default entity + merged with the updated entity. + ''' + self.assertEqual(entity.age, 'abc') + self.assertEqual(entity.sex, 'female') + self.assertEqual(entity.sign, 'aquarius') + self.assertEqual(entity.married, True) + self.assertEqual(entity.deceased, False) + self.assertEqual(entity.sign, 'aquarius') + self.assertEqual(entity.ratio, 3.1) + self.assertEqual(entity.evenratio, 3.0) + self.assertEqual(entity.large, 933311100) + self.assertEqual(entity.Birthday, datetime(1973, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity.birthday, datetime(1991, 10, 4, tzinfo=tzutc())) + self.assertIsInstance(entity.other, EntityProperty) + self.assertEqual(entity.other.type, EdmType.INT32) + self.assertEqual(entity.other.value, 20) + self.assertIsInstance(entity.clsid, uuid.UUID) + self.assertEqual(str(entity.clsid), 'c9da6455-213d-42c9-9a79-3e9149a57833') + # self.assertIsNotNone(entity.etag) + # self.assertIsNotNone(entity.odata['etag']) + # self.assertIsNotNone(entity.Timestamp) + # self.assertIsInstance(entity.Timestamp, datetime) + + # --Test cases for entities ------------------------------------------ + @GlobalStorageAccountPreparer() + def test_insert_etag(self, resource_group, location, storage_account, storage_account_key): + self._set_up(storage_account, storage_account_key) + + entity, _ = self._insert_random_entity() + + entity1 = self.table.get_entity(row_key=entity.RowKey, partition_key=entity.PartitionKey) + + with self.assertRaises(AttributeError): + etag = entity1.etag + + + self.assertIsNotNone(entity1.metadata()) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_user_filter(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._insert_random_entity() + + # Act + # resp = self.table.create_item(entity) + resp = self.table.query_entities(filter="married eq @my_param", parameters={'my_param': 'True'}) + + # Assert --- Does this mean insert returns nothing? + self.assertIsNotNone(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_dictionary(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + + # Act + # resp = self.table.create_item(entity) + resp = self.table.create_entity(entity=entity) + + # Assert --- Does this mean insert returns nothing? + self.assertIsNotNone(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_with_hook(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + + # Act + # , response_hook=lambda e, h: (e, h) + resp = self.table.create_entity(entity=entity) + + # Assert + self.assertIsNotNone(resp) + self._assert_default_entity(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_with_no_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + + # Act + # response_hook=lambda e, h: (e, h) + resp = self.table.create_entity( + entity=entity, + headers={'Accept': 'application/json;odata=nometadata'}, + ) + + # Assert + self.assertIsNotNone(resp) + self._assert_default_entity_json_no_metadata(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_with_full_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + + # Act + # response_hook=lambda e, h: (e, h) + resp = self.table.create_entity( + entity=entity, + headers={'Accept': 'application/json;odata=fullmetadata'}, + ) + + # Assert + self.assertIsNotNone(resp) + self._assert_default_entity_json_full_metadata(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_conflict(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + with self.assertRaises(ResourceExistsError): + # self.table.create_item(entity) + self.table.create_entity(entity=entity) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_with_large_int32_value_throws(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + dict32 = self._create_random_base_entity_dict() + dict32['large'] = EntityProperty(EdmType.INT32, 2 ** 31) + + # Assert + with self.assertRaises(TypeError): + self.table.create_entity(entity=dict32) + + dict32['large'] = EntityProperty(EdmType.INT32, -(2 ** 31 + 1)) + with self.assertRaises(TypeError): + self.table.create_entity(entity=dict32) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_with_large_int64_value_throws(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + # Act + dict64 = self._create_random_base_entity_dict() + dict64['large'] = EntityProperty(EdmType.INT64, 2 ** 63) + + # Assert + with self.assertRaises(TypeError): + self.table.create_entity(entity=dict64) + + dict64['large'] = EntityProperty(EdmType.INT64, -(2 ** 63 + 1)) + with self.assertRaises(TypeError): + self.table.create_entity(entity=dict64) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_missing_pk(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = {'RowKey': 'rk'} + + # Act + with self.assertRaises(ValueError): + # resp = self.table.create_item(entity) + resp = self.table.create_entity(entity=entity) + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_empty_string_pk(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = {'RowKey': 'rk', 'PartitionKey': ''} + + # Act + if 'cosmos' in self.table.url: + with self.assertRaises(HttpResponseError): + self.table.create_entity(entity=entity) + else: + resp = self.table.create_entity(entity=entity) + + # Assert + # self.assertIsNone(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_missing_rk(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = {'PartitionKey': 'pk'} + + # Act + with self.assertRaises(ValueError): + resp = self.table.create_entity(entity=entity) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_empty_string_rk(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = {'PartitionKey': 'pk', 'RowKey': ''} + + # Act + if 'cosmos' in self.table.url: + with self.assertRaises(HttpResponseError): + self.table.create_entity(entity=entity) + else: + resp = self.table.create_entity(entity=entity) + + # Assert + # self.assertIsNone(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_too_many_properties(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + if 'cosmos' in self.table.url: + pytest.skip("Cosmos supports large number of properties.") + try: + entity = self._create_random_base_entity_dict() + for i in range(255): + entity['key{0}'.format(i)] = 'value{0}'.format(i) + + # Act + with self.assertRaises(HttpResponseError): + resp = self.table.create_entity(entity=entity) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_entity_property_name_too_long(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + if 'cosmos' in self.table.url: + pytest.skip("Cosmos supports large property names.") + try: + entity = self._create_random_base_entity_dict() + entity['a' * 256] = 'badval' + + # Act + with self.assertRaises(HttpResponseError): + resp = self.table.create_entity(entity=entity) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_get_entity(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + resp = self.table.get_entity(partition_key=entity['PartitionKey'], + row_key=entity['RowKey']) + + # Assert + self.assertEqual(resp['PartitionKey'], entity['PartitionKey']) + self.assertEqual(resp['RowKey'], entity['RowKey']) + self._assert_default_entity(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_get_entity_with_hook(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + # resp, headers + # response_hook=lambda e, h: (e, h) + resp = self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'], + ) + + # Assert + self.assertEqual(resp['PartitionKey'], entity['PartitionKey']) + self.assertEqual(resp['RowKey'], entity['RowKey']) + self._assert_default_entity(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_get_entity_if_match(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, etag = self._insert_random_entity() + + # Act + # Do a get and confirm the etag is parsed correctly by using it + # as a condition to delete. + resp = self.table.get_entity(partition_key=entity['PartitionKey'], + row_key=entity['RowKey']) + + self.table.delete_entity( + partition_key=resp['PartitionKey'], + row_key=resp['RowKey'], + etag=etag, + match_condition=MatchConditions.IfNotModified + ) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_get_entity_full_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + resp = self.table.get_entity( + entity.PartitionKey, + entity.RowKey, + headers={'accept': 'application/json;odata=fullmetadata'}) + + # Assert + self.assertEqual(resp.PartitionKey, entity.PartitionKey) + self.assertEqual(resp.RowKey, entity.RowKey) + self._assert_default_entity_json_full_metadata(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_get_entity_no_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + resp = self.table.get_entity( + partition_key=entity.PartitionKey, + row_key=entity.RowKey, + headers={'accept': 'application/json;odata=nometadata'}) + + # Assert + self.assertEqual(resp.PartitionKey, entity.PartitionKey) + self.assertEqual(resp.RowKey, entity.RowKey) + self._assert_default_entity_json_no_metadata(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_get_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + + # Act + with self.assertRaises(ResourceNotFoundError): + self.table.get_entity(partition_key=entity.PartitionKey, + row_key=entity.RowKey) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_get_entity_with_special_doubles(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + entity.update({ + 'inf': float('inf'), + 'negativeinf': float('-inf'), + 'nan': float('nan') + }) + self.table.create_entity(entity=entity) + + # Act + resp = self.table.get_entity(partition_key=entity['PartitionKey'], + row_key=entity['RowKey']) + + # Assert + self.assertEqual(resp.inf, float('inf')) + self.assertEqual(resp.negativeinf, float('-inf')) + self.assertTrue(isnan(resp.nan)) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_update_entity(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + + # resp = self.table.update_item(sent_entity, response_hook=lambda e, h: h) + resp = self.table.update_entity(mode=UpdateMode.REPLACE, entity=sent_entity) + + # Assert + # self.assertTrue(resp) + received_entity = self.table.get_entity(partition_key=entity.PartitionKey, + row_key=entity.RowKey) + + self._assert_updated_entity(received_entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_update_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + + # Act + sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) + with self.assertRaises(ResourceNotFoundError): + self.table.update_entity(mode=UpdateMode.REPLACE, entity=sent_entity) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_update_entity_with_if_matches(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, etag = self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + # , response_hook=lambda e, h: h) + self.table.update_entity( + mode=UpdateMode.REPLACE, entity=sent_entity, etag=etag, + match_condition=MatchConditions.IfNotModified) + + # Assert + # self.assertTrue(resp) + received_entity = self.table.get_entity(entity.PartitionKey, entity.RowKey) + self._assert_updated_entity(received_entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_update_entity_with_if_doesnt_match(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + with self.assertRaises(HttpResponseError): + self.table.update_entity( + mode=UpdateMode.MERGE, + entity=sent_entity, + etag=u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', + match_condition=MatchConditions.IfNotModified) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_or_merge_entity_with_existing_entity(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + resp = self.table.upsert_entity(mode=UpdateMode.MERGE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + received_entity = self.table.get_entity(entity.PartitionKey, entity.RowKey) + self._assert_merged_entity(received_entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_or_merge_entity_with_non_existing_entity(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + + # Act + sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) + resp = self.table.upsert_entity(mode=UpdateMode.MERGE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + received_entity = self.table.get_entity(entity['PartitionKey'], + entity['RowKey']) + self._assert_updated_entity(received_entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_or_replace_entity_with_existing_entity(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + resp = self.table.upsert_entity(mode=UpdateMode.REPLACE, entity=sent_entity) + + # Assert + # self.assertIsNone(resp) + received_entity = self.table.get_entity(entity.PartitionKey, entity.RowKey) + self._assert_updated_entity(received_entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_insert_or_replace_entity_with_non_existing_entity(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + + # Act + sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) + resp = self.table.upsert_entity(mode=UpdateMode.REPLACE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + received_entity = self.table.get_entity(entity['PartitionKey'], + entity['RowKey']) + self._assert_updated_entity(received_entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_merge_entity(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + resp = self.table.update_entity(mode=UpdateMode.MERGE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + received_entity = self.table.get_entity(entity.PartitionKey, entity.RowKey) + self._assert_merged_entity(received_entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_merge_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + + # Act + sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) + with self.assertRaises(ResourceNotFoundError): + self.table.update_entity(mode=UpdateMode.MERGE, entity=sent_entity) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_merge_entity_with_if_matches(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, etag = self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + resp = self.table.update_entity( + mode=UpdateMode.MERGE, + entity=sent_entity, + etag=etag, + match_condition=MatchConditions.IfNotModified) + + # Assert + self.assertIsNone(resp) + received_entity = self.table.get_entity(entity.PartitionKey, entity.RowKey) + self._assert_merged_entity(received_entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_merge_entity_with_if_doesnt_match(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + with self.assertRaises(HttpResponseError): + self.table.update_entity(mode=UpdateMode.MERGE, + entity=sent_entity, + etag='W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', + match_condition=MatchConditions.IfNotModified) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_delete_entity(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + resp = self.table.delete_entity(partition_key=entity.PartitionKey, row_key=entity.RowKey) + + # Assert + self.assertIsNone(resp) + with self.assertRaises(ResourceNotFoundError): + self.table.get_entity(entity.PartitionKey, entity.RowKey) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_delete_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + + # Act + with self.assertRaises(ResourceNotFoundError): + self.table.delete_entity(entity['PartitionKey'], entity['RowKey']) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_delete_entity_with_if_matches(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, etag = self._insert_random_entity() + + # Act + resp = self.table.delete_entity(entity.PartitionKey, entity.RowKey, etag=etag, + match_condition=MatchConditions.IfNotModified) + + # Assert + self.assertIsNone(resp) + with self.assertRaises(ResourceNotFoundError): + self.table.get_entity(entity.PartitionKey, entity.RowKey) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_delete_entity_with_if_doesnt_match(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + with self.assertRaises(HttpResponseError): + self.table.delete_entity( + entity.PartitionKey, entity.RowKey, + etag=u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', + match_condition=MatchConditions.IfNotModified) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_unicode_property_value(self, resource_group, location, storage_account, storage_account_key): + ''' regression test for github issue #57''' + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + entity1 = entity.copy() + entity1.update({'Description': u'ꀕ'}) + entity2 = entity.copy() + entity2.update({'RowKey': 'test2', 'Description': 'ꀕ'}) + + # Act + self.table.create_entity(entity=entity1) + self.table.create_entity(entity=entity2) + entities = list(self.table.query_entities( + filter="PartitionKey eq '{}'".format(entity['PartitionKey']))) + + # Assert + self.assertEqual(len(entities), 2) + self.assertEqual(entities[0].Description, u'ꀕ') + self.assertEqual(entities[1].Description, u'ꀕ') + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_unicode_property_name(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + entity1 = entity.copy() + entity1.update({u'啊齄丂狛狜': u'ꀕ'}) + entity2 = entity.copy() + entity2.update({'RowKey': 'test2', u'啊齄丂狛狜': 'hello'}) + + # Act + self.table.create_entity(entity=entity1) + self.table.create_entity(entity=entity2) + entities = list(self.table.query_entities( + filter="PartitionKey eq '{}'".format(entity['PartitionKey']))) + + # Assert + self.assertEqual(len(entities), 2) + self.assertEqual(entities[0][u'啊齄丂狛狜'], u'ꀕ') + self.assertEqual(entities[1][u'啊齄丂狛狜'], u'hello') + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_operations_on_entity_with_partition_key_having_single_quote(self, resource_group, location, + storage_account, storage_account_key): + + # Arrange + partition_key_with_single_quote = "a''''b" + row_key_with_single_quote = "a''''b" + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity(pk=partition_key_with_single_quote, rk=row_key_with_single_quote) + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + resp = self.table.upsert_entity(mode=UpdateMode.MERGE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + # row key here only has 2 quotes + received_entity = self.table.get_entity(entity.PartitionKey, entity.RowKey) + self._assert_updated_entity(received_entity) + + # Act + sent_entity['newField'] = 'newFieldValue' + resp = self.table.update_entity(mode=UpdateMode.MERGE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + received_entity = self.table.get_entity(entity.PartitionKey, entity.RowKey) + self._assert_updated_entity(received_entity) + self.assertEqual(received_entity['newField'], 'newFieldValue') + + # Act + resp = self.table.delete_entity(entity.PartitionKey, entity.RowKey) + + # Assert + self.assertIsNone(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_empty_and_spaces_property_value(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + entity.update({ + 'EmptyByte': '', + 'EmptyUnicode': u'', + 'SpacesOnlyByte': ' ', + 'SpacesOnlyUnicode': u' ', + 'SpacesBeforeByte': ' Text', + 'SpacesBeforeUnicode': u' Text', + 'SpacesAfterByte': 'Text ', + 'SpacesAfterUnicode': u'Text ', + 'SpacesBeforeAndAfterByte': ' Text ', + 'SpacesBeforeAndAfterUnicode': u' Text ', + }) + + # Act + self.table.create_entity(entity=entity) + resp = self.table.get_entity(entity['PartitionKey'], entity['RowKey']) + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(resp.EmptyByte, '') + self.assertEqual(resp.EmptyUnicode, u'') + self.assertEqual(resp.SpacesOnlyByte, ' ') + self.assertEqual(resp.SpacesOnlyUnicode, u' ') + self.assertEqual(resp.SpacesBeforeByte, ' Text') + self.assertEqual(resp.SpacesBeforeUnicode, u' Text') + self.assertEqual(resp.SpacesAfterByte, 'Text ') + self.assertEqual(resp.SpacesAfterUnicode, u'Text ') + self.assertEqual(resp.SpacesBeforeAndAfterByte, ' Text ') + self.assertEqual(resp.SpacesBeforeAndAfterUnicode, u' Text ') + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_none_property_value(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + entity.update({'NoneValue': None}) + + # Act + self.table.create_entity(entity=entity) + resp = self.table.get_entity(entity['PartitionKey'], entity['RowKey']) + + # Assert + self.assertIsNotNone(resp) + self.assertFalse(hasattr(resp, 'NoneValue')) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_binary_property_value(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + binary_data = b'\x01\x02\x03\x04\x05\x06\x07\x08\t\n' + entity = self._create_random_base_entity_dict() + entity.update({'binary': b'\x01\x02\x03\x04\x05\x06\x07\x08\t\n'}) + + # Act + self.table.create_entity(entity=entity) + resp = self.table.get_entity(entity['PartitionKey'], entity['RowKey']) + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(resp.binary.value, binary_data) + finally: + self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_timezone(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + local_tz = tzoffset('BRST', -10800) + local_date = datetime(2003, 9, 27, 9, 52, 43, tzinfo=local_tz) + entity = self._create_random_base_entity_dict() + entity.update({'date': local_date}) + + # Act + self.table.create_entity(entity=entity) + resp = self.table.get_entity(entity['PartitionKey'], entity['RowKey']) + + # Assert + self.assertIsNotNone(resp) + # times are not equal because request is made after + self.assertEqual(resp.date.astimezone(tzutc()), local_date.astimezone(tzutc())) + self.assertEqual(resp.date.astimezone(local_tz), local_date) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_entities(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + table = self._create_query_table(2) + + # Act + entities = list(table.list_entities()) + + # Assert + self.assertEqual(len(entities), 2) + for entity in entities: + self._assert_default_entity(entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_zero_entities(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + table = self._create_query_table(0) + + # Act + entities = list(table.list_entities()) + + # Assert + self.assertEqual(len(entities), 0) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_entities_full_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + table = self._create_query_table(2) + + # Act + entities = list(table.list_entities(headers={'accept': 'application/json;odata=fullmetadata'})) + + # Assert + self.assertEqual(len(entities), 2) + for entity in entities: + self._assert_default_entity_json_full_metadata(entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_entities_no_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + table = self._create_query_table(2) + + # Act + entities = list(table.list_entities(headers={'accept': 'application/json;odata=nometadata'})) + + # Assert + self.assertEqual(len(entities), 2) + for entity in entities: + self._assert_default_entity_json_no_metadata(entity) + finally: + self._tear_down() + + @pytest.mark.skip("Batch not implemented") + @GlobalStorageAccountPreparer() + def test_query_entities_large(self, resource_group, location, storage_account, storage_account_key): + # Arrange + table_name = self._create_query_table(0) + total_entities_count = 1000 + entities_per_batch = 50 + + for j in range(total_entities_count // entities_per_batch): + batch = TableBatch() + for i in range(entities_per_batch): + entity = Entity() + entity.PartitionKey = 'large' + entity.RowKey = 'batch{0}-item{1}'.format(j, i) + entity.test = EntityProperty(EdmType.BOOLEAN, 'true') + entity.test2 = 'hello world;' * 100 + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime(2016, 12, 31, 11, 59, 59, 0) + batch.create_entity(entity) + self.ts.commit_batch(table_name, batch) + + # Act + start_time = datetime.now() + entities = list(self.ts.query_entities(table_name)) + elapsed_time = datetime.now() - start_time + + # Assert + print('query_entities took {0} secs.'.format(elapsed_time.total_seconds())) + # azure allocates 5 seconds to execute a query + # if it runs slowly, it will return fewer results and make the test fail + self.assertEqual(len(entities), total_entities_count) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_entities_with_filter(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + entities = list(self.table.query_entities( + filter="PartitionKey eq '{}'".format(entity.PartitionKey))) + + # Assert + self.assertEqual(len(entities), 1) + self.assertEqual(entity.PartitionKey, entities[0].PartitionKey) + self._assert_default_entity(entities[0]) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_entities_with_select(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + table = self._create_query_table(2) + + # Act + entities = list(table.list_entities(select=['age', 'sex'])) + + # Assert + self.assertEqual(len(entities), 2) + self.assertEqual(entities[0].age, 39) + self.assertEqual(entities[0].sex, 'male') + self.assertFalse(hasattr(entities[0], "birthday")) + self.assertFalse(hasattr(entities[0], "married")) + self.assertFalse(hasattr(entities[0], "deceased")) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_entities_with_top(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + table = self._create_query_table(3) + # circular dependencies made this return a list not an item paged - problem when calling by page + # Act + entities = list(next(table.list_entities(results_per_page=2).by_page())) + + # Assert + self.assertEqual(len(entities), 2) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_query_entities_with_top_and_next(self, resource_group, location, storage_account, storage_account_key): + # Arrange + self._set_up(storage_account, storage_account_key) + try: + table = self._create_query_table(5) + + # Act + resp1 = table.list_entities(results_per_page=2).by_page() + next(resp1) + resp2 = table.list_entities(results_per_page=2).by_page( + continuation_token=resp1.continuation_token) + next(resp2) + resp3 = table.list_entities(results_per_page=2).by_page( + continuation_token=resp2.continuation_token) + next(resp3) + + entities1 = resp1._current_page + entities2 = resp2._current_page + entities3 = resp3._current_page + + # Assert + self.assertEqual(len(entities1), 2) + self.assertEqual(len(entities2), 2) + self.assertEqual(len(entities3), 1) + self._assert_default_entity(entities1[0]) + self._assert_default_entity(entities1[1]) + self._assert_default_entity(entities2[0]) + self._assert_default_entity(entities2[1]) + self._assert_default_entity(entities3[0]) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + def test_sas_query(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + + self._set_up(storage_account, storage_account_key) + try: + # Arrange + entity, _ = self._insert_random_entity() + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start=datetime.utcnow() - timedelta(minutes=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + entities = list(table.query_entities( + filter="PartitionKey eq '{}'".format(entity['PartitionKey']))) + + # Assert + self.assertEqual(len(entities), 1) + self._assert_default_entity(entities[0]) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + def test_sas_add(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + self._set_up(storage_account, storage_account_key) + try: + # Arrange + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(add=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start=datetime.utcnow() - timedelta(minutes=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + + entity = self._create_random_entity_dict() + table.create_entity(entity=entity) + + # Assert + resp = self.table.get_entity(partition_key=entity['PartitionKey'], + row_key=entity['RowKey']) + self._assert_default_entity(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + def test_sas_add_inside_range(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + self._set_up(storage_account, storage_account_key) + try: + # Arrange + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(add=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start_pk='test', start_rk='test1', + end_pk='test', end_rk='test1', + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + entity = self._create_random_entity_dict('test', 'test1') + table.create_entity(entity=entity) + + # Assert + resp = self.table.get_entity('test', 'test1') + self._assert_default_entity(resp) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + def test_sas_add_outside_range(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + self._set_up(storage_account, storage_account_key) + try: + # Arrange + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(add=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start_pk='test', start_rk='test1', + end_pk='test', end_rk='test1', + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + with self.assertRaises(HttpResponseError): + entity = self._create_random_entity_dict() + table.create_entity(entity=entity) + + # Assert + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + def test_sas_update(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + self._set_up(storage_account, storage_account_key) + try: + # Arrange + entity, _ = self._insert_random_entity() + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(update=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + updated_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + table.update_entity(mode=UpdateMode.REPLACE, entity=updated_entity) + + # Assert + received_entity = self.table.get_entity(entity.PartitionKey, entity.RowKey) + self._assert_updated_entity(received_entity) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + def test_sas_delete(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + self._set_up(storage_account, storage_account_key) + try: + # Arrange + entity, _ = self._insert_random_entity() + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(delete=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + table.delete_entity(entity.PartitionKey, entity.RowKey) + + # Assert + with self.assertRaises(ResourceNotFoundError): + self.table.get_entity(entity.PartitionKey, entity.RowKey) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + def test_sas_upper_case_table_name(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + self._set_up(storage_account, storage_account_key) + try: + # Arrange + entity, _ = self._insert_random_entity() + + # Table names are case insensitive, so simply upper case our existing table name to test + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name.upper(), + permission=TableSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start=datetime.utcnow() - timedelta(minutes=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + entities = list(table.query_entities( + filter="PartitionKey eq '{}'".format(entity['PartitionKey']))) + + # Assert + self.assertEqual(len(entities), 1) + self._assert_default_entity(entities[0]) + finally: + self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + def test_sas_signed_identifier(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + self._set_up(storage_account, storage_account_key) + try: + # Arrange + entity, _ = self._insert_random_entity() + + access_policy = AccessPolicy() + access_policy.start = datetime(2011, 10, 11) + access_policy.expiry = datetime(2020, 10, 12) + access_policy.permission = TableSasPermissions(read=True) + identifiers = {'testid': access_policy} + + self.table.set_table_access_policy(identifiers) + + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + policy_id='testid', + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + entities = list(table.query_entities( + filter="PartitionKey eq '{}'".format(entity.PartitionKey))) + + # Assert + self.assertEqual(len(entities), 1) + self._assert_default_entity(entities[0]) + finally: + self._tear_down() + + +# ------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main() diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity_async.py b/sdk/tables/azure-data-tables/tests/test_table_entity_async.py new file mode 100644 index 000000000000..e6b6272e7250 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_table_entity_async.py @@ -0,0 +1,1731 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import unittest + +import pytest + +import uuid +from base64 import b64encode +from datetime import datetime, timedelta + +from azure.data.tables import generate_table_sas +from azure.data.tables._generated.models import QueryOptions +from azure.data.tables.aio import TableServiceClient +from dateutil.tz import tzutc, tzoffset +from math import isnan + +from azure.core import MatchConditions +from azure.core.exceptions import ( + HttpResponseError, + ResourceNotFoundError, + ResourceExistsError) + +from azure.data.tables._entity import TableEntity, EntityProperty, EdmType +from azure.data.tables import TableSasPermissions, AccessPolicy, UpdateMode + +from _shared.testcase import GlobalStorageAccountPreparer, TableTestCase, LogCaptured + + +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ + +class StorageTableEntityTest(TableTestCase): + + async def _set_up(self, storage_account, storage_account_key): + self.ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + self.table_name = self.get_resource_name('uttable') + self.table = self.ts.get_table_client(self.table_name) + if self.is_live: + try: + await self.ts.create_table(table_name=self.table_name) + except ResourceExistsError: + pass + + self.query_tables = [] + + async def _tear_down(self): + if self.is_live: + try: + await self.ts.delete_table(self.table_name) + except: + pass + + for table_name in self.query_tables: + try: + await self.ts.delete_table(table_name) + except: + pass + + # --Helpers----------------------------------------------------------------- + + async def _create_query_table(self, entity_count): + """ + Creates a table with the specified name and adds entities with the + default set of values. PartitionKey is set to 'MyPartition' and RowKey + is set to a unique counter value starting at 1 (as a string). + """ + table_name = self.get_resource_name('querytable') + table = await self.ts.create_table(table_name) + self.query_tables.append(table_name) + client = self.ts.get_table_client(table_name) + entity = self._create_random_entity_dict() + for i in range(1, entity_count + 1): + entity['RowKey'] = entity['RowKey'] + str(i) + await client.create_entity(entity=entity) + # with self.ts.batch(table_name) as batch: + # for i in range(1, entity_count + 1): + # entity['RowKey'] = entity['RowKey'] + str(i) + # batch.create_entity(entity) + return client + + def _create_random_base_entity_dict(self): + """ + Creates a dict-based entity with only pk and rk. + """ + partition = self.get_resource_name('pk') + row = self.get_resource_name('rk') + return { + 'PartitionKey': partition, + 'RowKey': row, + } + + def _create_random_entity_dict(self, pk=None, rk=None): + """ + Creates a dictionary-based entity with fixed values, using all + of the supported data types. + """ + partition = pk if pk is not None else self.get_resource_name('pk') + row = rk if rk is not None else self.get_resource_name('rk') + properties = { + 'PartitionKey': partition, + 'RowKey': row, + 'age': 39, + 'sex': 'male', + 'married': True, + 'deceased': False, + 'optional': None, + 'ratio': 3.1, + 'evenratio': 3.0, + 'large': 933311100, + 'Birthday': datetime(1973, 10, 4, tzinfo=tzutc()), + 'birthday': datetime(1970, 10, 4, tzinfo=tzutc()), + 'binary': b'binary', + 'other': EntityProperty(type=EdmType.INT32, value=20), + 'clsid': uuid.UUID('c9da6455-213d-42c9-9a79-3e9149a57833') + } + return TableEntity(**properties) + + async def _insert_random_entity(self, pk=None, rk=None): + entity = self._create_random_entity_dict(pk, rk) + # , response_hook=lambda e, h: h['etag'] + e = await self.table.create_entity(entity=entity) + metadata = e.metadata() + # etag = e['etag'] + return entity, metadata['etag'] + + def _create_updated_entity_dict(self, partition, row): + """ + Creates a dictionary-based entity with fixed values, with a + different set of values than the default entity. It + adds fields, changes field values, changes field types, + and removes fields when compared to the default entity. + """ + return { + 'PartitionKey': partition, + 'RowKey': row, + 'age': 'abc', + 'sex': 'female', + 'sign': 'aquarius', + 'birthday': datetime(1991, 10, 4, tzinfo=tzutc()) + } + + def _assert_default_entity(self, entity, headers=None): + ''' + Asserts that the entity passed in matches the default entity. + ''' + self.assertEqual(entity['age'], 39) + self.assertEqual(entity['sex'], 'male') + self.assertEqual(entity['married'], True) + self.assertEqual(entity['deceased'], False) + self.assertFalse("optional" in entity) + self.assertFalse("aquarius" in entity) + self.assertEqual(entity['ratio'], 3.1) + self.assertEqual(entity['evenratio'], 3.0) + self.assertEqual(entity['large'], 933311100) + self.assertEqual(entity['Birthday'], datetime(1973, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity['birthday'], datetime(1970, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity['binary'].value, b'binary') # TODO: added the ".value" portion, verify this is correct + self.assertIsInstance(entity['other'], EntityProperty) + self.assertEqual(entity['other'].type, EdmType.INT32) + self.assertEqual(entity['other'].value, 20) + self.assertEqual(entity['clsid'], uuid.UUID('c9da6455-213d-42c9-9a79-3e9149a57833')) + # self.assertTrue('metadata' in entity.odata) + + # TODO: these are commented out / nonexistent in sync code, should we have them? + # self.assertIsNotNone(entity.Timestamp) + # self.assertIsInstance(entity.Timestamp, datetime) + if headers: + self.assertTrue("etag" in headers) + self.assertIsNotNone(headers['etag']) + + def _assert_default_entity_json_full_metadata(self, entity, headers=None): + ''' + Asserts that the entity passed in matches the default entity. + ''' + self.assertEqual(entity['age'], 39) + self.assertEqual(entity['sex'], 'male') + self.assertEqual(entity['married'], True) + self.assertEqual(entity['deceased'], False) + self.assertFalse("optional" in entity) + self.assertFalse("aquarius" in entity) + self.assertEqual(entity['ratio'], 3.1) + self.assertEqual(entity['evenratio'], 3.0) + self.assertEqual(entity['large'], 933311100) + self.assertEqual(entity['Birthday'], datetime(1973, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity['birthday'], datetime(1970, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity['binary'].value, b'binary') + self.assertIsInstance(entity['other'], EntityProperty) + self.assertEqual(entity['other'].type, EdmType.INT32) + self.assertEqual(entity['other'].value, 20) + self.assertEqual(entity['clsid'], uuid.UUID('c9da6455-213d-42c9-9a79-3e9149a57833')) + # self.assertTrue('metadata' in entity.odata) + # self.assertTrue('id' in entity.odata) + # self.assertTrue('type' in entity.odata) + # self.assertTrue('etag' in entity.odata) + # self.assertTrue('editLink' in entity.odata) + + # TODO: commented out in sync, should we have these? + # self.assertIsNotNone(entity.Timestamp) + # self.assertIsInstance(entity.Timestamp, datetime) + # if headers: + # self.assertTrue("etag" in headers) + # self.assertIsNotNone(headers['etag']) + + def _assert_default_entity_json_no_metadata(self, entity, headers=None): + ''' + Asserts that the entity passed in matches the default entity. + ''' + self.assertEqual(entity['age'], '39') + self.assertEqual(entity['sex'], 'male') + self.assertEqual(entity['married'], True) + self.assertEqual(entity['deceased'], False) + self.assertFalse("optional" in entity) + self.assertFalse("aquarius" in entity) + self.assertEqual(entity['ratio'], 3.1) + self.assertEqual(entity['evenratio'], 3.0) + self.assertEqual(entity['large'], '933311100') + self.assertTrue(entity['Birthday'].startswith('1973-10-04T00:00:00')) + self.assertTrue(entity['birthday'].startswith('1970-10-04T00:00:00')) + self.assertTrue(entity['Birthday'].endswith('00Z')) + self.assertTrue(entity['birthday'].endswith('00Z')) + self.assertEqual(entity['binary'], b64encode(b'binary').decode('utf-8')) + self.assertIsInstance(entity['other'], EntityProperty) + self.assertEqual(entity['other'].type, EdmType.INT32) + self.assertEqual(entity['other'].value, 20) + self.assertEqual(entity['clsid'], 'c9da6455-213d-42c9-9a79-3e9149a57833') + # self.assertIsNone(entity.odata) + # self.assertIsNotNone(entity.Timestamp) + # self.assertIsInstance(entity.Timestamp, datetime) + if headers: + self.assertTrue("etag" in headers) + self.assertIsNotNone(headers['etag']) + + def _assert_updated_entity(self, entity): + ''' + Asserts that the entity passed in matches the updated entity. + ''' + self.assertEqual(entity.age, 'abc') + self.assertEqual(entity.sex, 'female') + self.assertFalse(hasattr(entity, "married")) + self.assertFalse(hasattr(entity, "deceased")) + self.assertEqual(entity.sign, 'aquarius') + self.assertFalse(hasattr(entity, "optional")) + self.assertFalse(hasattr(entity, "ratio")) + self.assertFalse(hasattr(entity, "evenratio")) + self.assertFalse(hasattr(entity, "large")) + self.assertFalse(hasattr(entity, "Birthday")) + # self.assertEqual(entity.birthday, "1991-10-04 00:00:00+00:00") + self.assertEqual(entity.birthday, datetime(1991, 10, 4, tzinfo=tzutc())) + self.assertFalse(hasattr(entity, "other")) + self.assertFalse(hasattr(entity, "clsid")) + # TODO: should these all be commented out? + # self.assertIsNotNone(entity.odata.etag) + # self.assertIsNotNone(entity.Timestamp) + # self.assertIsInstance(entity.timestamp, datetime) + + def _assert_merged_entity(self, entity): + ''' + Asserts that the entity passed in matches the default entity + merged with the updated entity. + ''' + self.assertEqual(entity.age, 'abc') + self.assertEqual(entity.sex, 'female') + self.assertEqual(entity.sign, 'aquarius') + self.assertEqual(entity.married, True) + self.assertEqual(entity.deceased, False) + self.assertEqual(entity.sign, 'aquarius') + self.assertEqual(entity.ratio, 3.1) + self.assertEqual(entity.evenratio, 3.0) + self.assertEqual(entity.large, 933311100) + self.assertEqual(entity.Birthday, datetime(1973, 10, 4, tzinfo=tzutc())) + self.assertEqual(entity.birthday, datetime(1991, 10, 4, tzinfo=tzutc())) + self.assertIsInstance(entity.other, EntityProperty) + self.assertEqual(entity.other.type, EdmType.INT32) + self.assertEqual(entity.other.value, 20) + self.assertIsInstance(entity.clsid, uuid.UUID) + self.assertEqual(str(entity.clsid), 'c9da6455-213d-42c9-9a79-3e9149a57833') + # TODO: should these all be commented out? + # self.assertIsNotNone(entity.etag) + # self.assertIsNotNone(entity.odata['etag']) + # self.assertIsNotNone(entity.Timestamp) + # self.assertIsInstance(entity.Timestamp, datetime) + + # --Test cases for entities ------------------------------------------ + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_dictionary(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + + # Act + # resp = self.table.create_item(entity) + resp = await self.table.create_entity(entity=entity) + + # Assert --- Does this mean insert returns nothing? + self.assertIsNotNone(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_with_hook(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + + # Act + # , response_hook = lambda e, h: (e, h) + resp = await self.table.create_entity(entity=entity) + + # Assert + self.assertIsNotNone(resp) + self._assert_default_entity(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_with_no_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + + # Act + # response_hook = lambda e, h: (e, h) + resp = await self.table.create_entity( + entity=entity, + headers={'Accept': 'application/json;odata=nometadata'}, + ) + + # Assert + self.assertIsNotNone(resp) + self._assert_default_entity_json_no_metadata(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_with_full_metadata(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + + # Act + # response_hook=lambda e, h: (e, h) + resp = await self.table.create_entity( + entity=entity, + headers={'Accept': 'application/json;odata=fullmetadata'},) + + # Assert + self.assertIsNotNone(resp) + self._assert_default_entity_json_full_metadata(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_conflict(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + with self.assertRaises(ResourceExistsError): + # self.table.create_item(entity) + await self.table.create_entity(entity=entity) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_with_large_int32_value_throws(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + # Act + dict32 = self._create_random_base_entity_dict() + dict32['large'] = EntityProperty(EdmType.INT32, 2 ** 31) + + # Assert + with self.assertRaises(TypeError): + await self.table.create_entity(entity=dict32) + + dict32['large'] = EntityProperty(EdmType.INT32, -(2 ** 31 + 1)) + with self.assertRaises(TypeError): + await self.table.create_entity(entity=dict32) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_with_large_int64_value_throws(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + # Act + dict64 = self._create_random_base_entity_dict() + dict64['large'] = EntityProperty(EdmType.INT64, 2 ** 63) + + # Assert + with self.assertRaises(TypeError): + await self.table.create_entity(entity=dict64) + + dict64['large'] = EntityProperty(EdmType.INT64, -(2 ** 63 + 1)) + with self.assertRaises(TypeError): + await self.table.create_entity(entity=dict64) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_missing_pk(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = {'RowKey': 'rk'} + + # Act + with self.assertRaises(ValueError): + # resp = self.table.create_item(entity) + resp = await self.table.create_entity(entity=entity) + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_empty_string_pk(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = {'RowKey': 'rk', 'PartitionKey': ''} + + # Act + if 'cosmos' in self.table.url: + with self.assertRaises(HttpResponseError): + await self.table.create_entity(entity=entity) + else: + resp = await self.table.create_entity(entity=entity) + + # Assert + # self.assertIsNone(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_missing_rk(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = {'PartitionKey': 'pk'} + + # Act + with self.assertRaises(ValueError): + resp = await self.table.create_entity(entity=entity) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_empty_string_rk(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = {'PartitionKey': 'pk', 'RowKey': ''} + + # Act + if 'cosmos' in self.table.url: + with self.assertRaises(HttpResponseError): + await self.table.create_entity(entity=entity) + else: + resp = await self.table.create_entity(entity=entity) + + # Assert + # self.assertIsNone(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_too_many_properties(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + if 'cosmos' in self.table.url: + pytest.skip("Cosmos supports large number of properties.") + try: + entity = self._create_random_base_entity_dict() + for i in range(255): + entity['key{0}'.format(i)] = 'value{0}'.format(i) + + # Act + with self.assertRaises(HttpResponseError): + resp = await self.table.create_entity(entity=entity) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_entity_property_name_too_long(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + if 'cosmos' in self.table.url: + pytest.skip("Cosmos supports large property names.") + try: + entity = self._create_random_base_entity_dict() + entity['a' * 256] = 'badval' + + # Act + with self.assertRaises(HttpResponseError): + resp = await self.table.create_entity(entity=entity) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_get_entity(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + resp = await self.table.get_entity(partition_key=entity['PartitionKey'], + row_key=entity['RowKey']) + + # Assert + self.assertEqual(resp['PartitionKey'], entity['PartitionKey']) + self.assertEqual(resp['RowKey'], entity['RowKey']) + self._assert_default_entity(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_get_entity_with_hook(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + # resp, headers + # response_hook=lambda e, h: (e, h) + resp = await self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'], + ) + + # Assert + self.assertEqual(resp['PartitionKey'], entity['PartitionKey']) + self.assertEqual(resp['RowKey'], entity['RowKey']) + self._assert_default_entity(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_get_entity_if_match(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, etag = await self._insert_random_entity() + + # Act + # Do a get and confirm the etag is parsed correctly by using it + # as a condition to delete. + resp = await self.table.get_entity(partition_key=entity['PartitionKey'], + row_key=entity['RowKey']) + + await self.table.delete_entity( + partition_key=resp['PartitionKey'], + row_key=resp['RowKey'], + etag=etag, + match_condition=MatchConditions.IfNotModified + ) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_get_entity_full_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + resp = await self.table.get_entity( + entity.PartitionKey, + entity.RowKey, + headers={'accept': 'application/json;odata=fullmetadata'}) + + # Assert + self.assertEqual(resp.PartitionKey, entity.PartitionKey) + self.assertEqual(resp.RowKey, entity.RowKey) + self._assert_default_entity_json_full_metadata(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_get_entity_no_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + resp = await self.table.get_entity( + partition_key=entity.PartitionKey, + row_key=entity.RowKey, + headers={'accept': 'application/json;odata=nometadata'}) + + # Assert + self.assertEqual(resp.PartitionKey, entity.PartitionKey) + self.assertEqual(resp.RowKey, entity.RowKey) + self._assert_default_entity_json_no_metadata(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_get_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_entity_dict() + + # Act + with self.assertRaises(ResourceNotFoundError): + await self.table.get_entity(partition_key=entity.PartitionKey, + row_key=entity.RowKey) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_get_entity_with_special_doubles(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + entity.update({ + 'inf': float('inf'), + 'negativeinf': float('-inf'), + 'nan': float('nan') + }) + await self.table.create_entity(entity=entity) + + # Act + resp = await self.table.get_entity(partition_key=entity['PartitionKey'], + row_key=entity['RowKey']) + + # Assert + self.assertEqual(resp.inf, float('inf')) + self.assertEqual(resp.negativeinf, float('-inf')) + self.assertTrue(isnan(resp.nan)) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_update_entity(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + + # resp = self.table.update_item(sent_entity, response_hook=lambda e, h: h) + resp = await self.table.update_entity(mode=UpdateMode.REPLACE, entity=sent_entity) + + # Assert + # self.assertTrue(resp) + received_entity = await self.table.get_entity( + partition_key=entity.PartitionKey, + row_key=entity.RowKey) + + self._assert_updated_entity(received_entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_update_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + + # Act + sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) + with self.assertRaises(ResourceNotFoundError): + await self.table.update_entity(mode=UpdateMode.REPLACE, entity=sent_entity) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_update_entity_with_if_matches(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, etag = await self._insert_random_entity() + + # Act + #, response_hook=lambda e, h: h) + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + await self.table.update_entity( + mode=UpdateMode.REPLACE, + entity=sent_entity, etag=etag, + match_condition=MatchConditions.IfNotModified) + + # Assert + # self.assertTrue(resp) + received_entity = await self.table.get_entity(entity.PartitionKey, + entity.RowKey) + self._assert_updated_entity(received_entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_update_entity_with_if_doesnt_match(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + with self.assertRaises(HttpResponseError): + await self.table.update_entity( + mode=UpdateMode.REPLACE, + entity=sent_entity, + etag=u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', + match_condition=MatchConditions.IfNotModified) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_or_merge_entity_with_existing_entity(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + resp = await self.table.upsert_entity(mode=UpdateMode.MERGE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + received_entity = await self.table.get_entity(entity.PartitionKey, + entity.RowKey) + self._assert_merged_entity(received_entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_or_merge_entity_with_non_existing_entity(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + + # Act + sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) + resp = await self.table.upsert_entity(mode=UpdateMode.MERGE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + received_entity = await self.table.get_entity(entity['PartitionKey'], + entity['RowKey']) + self._assert_updated_entity(received_entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_or_replace_entity_with_existing_entity(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + resp = await self.table.upsert_entity(mode=UpdateMode.REPLACE, entity=sent_entity) + + # Assert + # self.assertIsNone(resp) + received_entity = await self.table.get_entity(entity.PartitionKey, + entity.RowKey) + self._assert_updated_entity(received_entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_insert_or_replace_entity_with_non_existing_entity(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + + # Act + sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) + resp = await self.table.upsert_entity(mode=UpdateMode.REPLACE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + received_entity = await self.table.get_entity(entity['PartitionKey'], + entity['RowKey']) + self._assert_updated_entity(received_entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_merge_entity(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + resp = await self.table.update_entity(mode=UpdateMode.MERGE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + received_entity = await self.table.get_entity(entity.PartitionKey, + entity.RowKey) + self._assert_merged_entity(received_entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_merge_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + + # Act + sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) + with self.assertRaises(ResourceNotFoundError): + await self.table.update_entity(mode=UpdateMode.MERGE, entity=sent_entity) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_merge_entity_with_if_matches(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, etag = await self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + resp = await self.table.update_entity(mode=UpdateMode.MERGE, + entity=sent_entity, etag=etag, + match_condition=MatchConditions.IfNotModified) + + # Assert + self.assertIsNone(resp) + received_entity = await self.table.get_entity(entity.PartitionKey, + entity.RowKey) + self._assert_merged_entity(received_entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_merge_entity_with_if_doesnt_match(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + with self.assertRaises(HttpResponseError): + await self.table.update_entity(mode=UpdateMode.MERGE, + entity=sent_entity, + etag='W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', + match_condition=MatchConditions.IfNotModified) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_delete_entity(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + resp = await self.table.delete_entity(partition_key=entity.PartitionKey, row_key=entity.RowKey) + + # Assert + self.assertIsNone(resp) + with self.assertRaises(ResourceNotFoundError): + await self.table.get_entity(entity.PartitionKey, entity.RowKey) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_delete_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + + # Act + with self.assertRaises(ResourceNotFoundError): + await self.table.delete_entity(entity['PartitionKey'], entity['RowKey']) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_delete_entity_with_if_matches(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, etag = await self._insert_random_entity() + + # Act + resp = await self.table.delete_entity(entity.PartitionKey, entity.RowKey, etag=etag, + match_condition=MatchConditions.IfNotModified) + + # Assert + self.assertIsNone(resp) + with self.assertRaises(ResourceNotFoundError): + await self.table.get_entity(entity.PartitionKey, entity.RowKey) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_delete_entity_with_if_doesnt_match(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + with self.assertRaises(HttpResponseError): + await self.table.delete_entity( + entity.PartitionKey, entity.RowKey, + etag=u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', + match_condition=MatchConditions.IfNotModified) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_unicode_property_value(self, resource_group, location, storage_account, storage_account_key): + ''' regression test for github issue #57''' + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + entity1 = entity.copy() + entity1.update({'Description': u'ꀕ'}) + entity2 = entity.copy() + entity2.update({'RowKey': 'test2', 'Description': 'ꀕ'}) + + # Act + await self.table.create_entity(entity=entity1) + await self.table.create_entity(entity=entity2) + entities = [] + async for e in self.table.query_entities( + filter="PartitionKey eq '{}'".format(entity['PartitionKey'])): + entities.append(e) + + # Assert + self.assertEqual(len(entities), 2) + self.assertEqual(entities[0].Description, u'ꀕ') + self.assertEqual(entities[1].Description, u'ꀕ') + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_unicode_property_name(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + entity1 = entity.copy() + entity1.update({u'啊齄丂狛狜': u'ꀕ'}) + entity2 = entity.copy() + entity2.update({'RowKey': 'test2', u'啊齄丂狛狜': 'hello'}) + + # Act + await self.table.create_entity(entity=entity1) + await self.table.create_entity(entity=entity2) + entities = [] + async for e in self.table.query_entities( + filter="PartitionKey eq '{}'".format(entity['PartitionKey'])): + entities.append(e) + + # Assert + self.assertEqual(len(entities), 2) + self.assertEqual(entities[0][u'啊齄丂狛狜'], u'ꀕ') + self.assertEqual(entities[1][u'啊齄丂狛狜'], u'hello') + finally: + await self._tear_down() + + @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_operations_on_entity_with_partition_key_having_single_quote(self, resource_group, location, + storage_account, storage_account_key): + + # Arrange + partition_key_with_single_quote = "a''''b" + row_key_with_single_quote = "a''''b" + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity(pk=partition_key_with_single_quote, + rk=row_key_with_single_quote) + + # Act + sent_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + resp = await self.table.upsert_entity(mode=UpdateMode.REPLACE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + # row key here only has 2 quotes + received_entity = await self.table.get_entity( + entity.PartitionKey, entity.RowKey) + self._assert_updated_entity(received_entity) + + # Act + sent_entity['newField'] = 'newFieldValue' + resp = await self.table.update_entity(mode=UpdateMode.REPLACE, entity=sent_entity) + + # Assert + self.assertIsNone(resp) + received_entity = await self.table.get_entity( + entity.PartitionKey, entity.RowKey) + self._assert_updated_entity(received_entity) + self.assertEqual(received_entity['newField'], 'newFieldValue') + + # Act + resp = await self.table.delete_entity(entity.PartitionKey, entity.RowKey) + + # Assert + self.assertIsNone(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_empty_and_spaces_property_value(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + entity.update({ + 'EmptyByte': '', + 'EmptyUnicode': u'', + 'SpacesOnlyByte': ' ', + 'SpacesOnlyUnicode': u' ', + 'SpacesBeforeByte': ' Text', + 'SpacesBeforeUnicode': u' Text', + 'SpacesAfterByte': 'Text ', + 'SpacesAfterUnicode': u'Text ', + 'SpacesBeforeAndAfterByte': ' Text ', + 'SpacesBeforeAndAfterUnicode': u' Text ', + }) + + # Act + await self.table.create_entity(entity=entity) + resp = await self.table.get_entity(entity['PartitionKey'], entity['RowKey']) + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(resp.EmptyByte, '') + self.assertEqual(resp.EmptyUnicode, u'') + self.assertEqual(resp.SpacesOnlyByte, ' ') + self.assertEqual(resp.SpacesOnlyUnicode, u' ') + self.assertEqual(resp.SpacesBeforeByte, ' Text') + self.assertEqual(resp.SpacesBeforeUnicode, u' Text') + self.assertEqual(resp.SpacesAfterByte, 'Text ') + self.assertEqual(resp.SpacesAfterUnicode, u'Text ') + self.assertEqual(resp.SpacesBeforeAndAfterByte, ' Text ') + self.assertEqual(resp.SpacesBeforeAndAfterUnicode, u' Text ') + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_none_property_value(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity = self._create_random_base_entity_dict() + entity.update({'NoneValue': None}) + + # Act + await self.table.create_entity(entity=entity) + resp = await self.table.get_entity(entity['PartitionKey'], entity['RowKey']) + + # Assert + self.assertIsNotNone(resp) + self.assertFalse(hasattr(resp, 'NoneValue')) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_binary_property_value(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + binary_data = b'\x01\x02\x03\x04\x05\x06\x07\x08\t\n' + entity = self._create_random_base_entity_dict() + entity.update({'binary': b'\x01\x02\x03\x04\x05\x06\x07\x08\t\n'}) + + # Act + await self.table.create_entity(entity=entity) + resp = await self.table.get_entity(entity['PartitionKey'], entity['RowKey']) + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(resp.binary.value, binary_data) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_timezone(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + local_tz = tzoffset('BRST', -10800) + local_date = datetime(2003, 9, 27, 9, 52, 43, tzinfo=local_tz) + entity = self._create_random_base_entity_dict() + entity.update({'date': local_date}) + + # Act + await self.table.create_entity(entity=entity) + resp = await self.table.get_entity(entity['PartitionKey'], entity['RowKey']) + + # Assert + self.assertIsNotNone(resp) + # times are not equal because request is made after + # self.assertEqual(resp.date.astimezone(tzutc()), local_date.astimezone(tzutc())) + # self.assertEqual(resp.date.astimezone(local_tz), local_date) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_query_entities(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + table = await self._create_query_table(2) + + # Act + entities = [] + async for t in table.list_entities(): + entities.append(t) + + # Assert + self.assertEqual(len(entities), 2) + for entity in entities: + self._assert_default_entity(entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_query_zero_entities(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + table = await self._create_query_table(0) + + # Act + entities = [] + async for t in table.list_entities(): + entities.append(t) + + # Assert + self.assertEqual(len(entities), 0) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_query_entities_full_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + table = await self._create_query_table(2) + + # Act + entities = [] + async for t in table.list_entities(headers={'accept': 'application/json;odata=fullmetadata'}): + entities.append(t) + + # Assert + self.assertEqual(len(entities), 2) + for entity in entities: + self._assert_default_entity_json_full_metadata(entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_query_entities_no_metadata(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + table = await self._create_query_table(2) + + # Act + entities = [] + async for t in table.list_entities(headers={'accept': 'application/json;odata=nometadata'}): + entities.append(t) + + # Assert + self.assertEqual(len(entities), 2) + for entity in entities: + self._assert_default_entity_json_no_metadata(entity) + finally: + await self._tear_down() + + @pytest.mark.skip("Batch not implemented") + @GlobalStorageAccountPreparer() + def test_query_entities_large(self, resource_group, location, storage_account, storage_account_key): + # Arrange + table_name = self._create_query_table(0) + total_entities_count = 1000 + entities_per_batch = 50 + + for j in range(total_entities_count // entities_per_batch): + batch = TableBatch() + for i in range(entities_per_batch): + entity = TableEntity() + entity.PartitionKey = 'large' + entity.RowKey = 'batch{0}-item{1}'.format(j, i) + entity.test = EntityProperty(EdmType.BOOLEAN, 'true') + entity.test2 = 'hello world;' * 100 + entity.test3 = 3 + entity.test4 = EntityProperty(EdmType.INT64, '1234567890') + entity.test5 = datetime(2016, 12, 31, 11, 59, 59, 0) + batch.create_entity(entity) + self.ts.commit_batch(table_name, batch) + + # Act + start_time = datetime.now() + entities = list(self.ts.query_entities(table_name)) + elapsed_time = datetime.now() - start_time + + # Assert + print('query_entities took {0} secs.'.format(elapsed_time.total_seconds())) + # azure allocates 5 seconds to execute a query + # if it runs slowly, it will return fewer results and make the test fail + self.assertEqual(len(entities), total_entities_count) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_query_entities_with_filter(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + entities = [] + async for t in self.table.query_entities( + filter="PartitionKey eq '{}'".format(entity.PartitionKey)): + entities.append(t) + + # Assert + self.assertEqual(len(entities), 1) + self.assertEqual(entity.PartitionKey, entities[0].PartitionKey) + self._assert_default_entity(entities[0]) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_query_entities_with_select(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + table = await self._create_query_table(2) + + # Act + entities = [] + async for t in table.list_entities(select=["age, sex"]): + entities.append(t) + + # Assert + self.assertEqual(len(entities), 2) + self.assertEqual(entities[0].age, 39) + self.assertEqual(entities[0].sex, 'male') + self.assertFalse(hasattr(entities[0], "birthday")) + self.assertFalse(hasattr(entities[0], "married")) + self.assertFalse(hasattr(entities[0], "deceased")) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_query_entities_with_top(self, resource_group, location, storage_account, storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + table = await self._create_query_table(3) + # circular dependencies made this return a list not an item paged - problem when calling by page + # Act + entities = [] + async for t in table.list_entities(results_per_page=2).by_page(): + entities.append(t) + + # Assert + self.assertEqual(len(entities), 2) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + async def test_query_entities_with_top_and_next(self, resource_group, location, storage_account, + storage_account_key): + # Arrange + await self._set_up(storage_account, storage_account_key) + try: + table = await self._create_query_table(5) + + # Act + resp1 = table.list_entities(results_per_page=2).by_page() + entities1 = [] + async for el in await resp1.__anext__(): + entities1.append(el) + resp2 = table.list_entities(results_per_page=2).by_page( + continuation_token=resp1.continuation_token) + entities2 = [] + async for el in await resp2.__anext__(): + entities2.append(el) + resp3 = table.list_entities(results_per_page=2).by_page( + continuation_token=resp2.continuation_token) + entities3 = [] + async for el in await resp3.__anext__(): + entities3.append(el) + + # Assert + self.assertEqual(len(entities1), 2) + self.assertEqual(len(entities2), 2) + self.assertEqual(len(entities3), 1) + self._assert_default_entity(entities1[0]) + self._assert_default_entity(entities1[1]) + self._assert_default_entity(entities2[0]) + self._assert_default_entity(entities2[1]) + self._assert_default_entity(entities3[0]) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + async def test_sas_query(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + + await self._set_up(storage_account, storage_account_key) + try: + # Arrange + entity, _ = await self._insert_random_entity() + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start=datetime.utcnow() - timedelta(minutes=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + entities = [] + async for t in table.query_entities( + filter="PartitionKey eq '{}'".format(entity['PartitionKey'])): + entities.append(t) + + # Assert + self.assertEqual(len(entities), 1) + self._assert_default_entity(entities[0]) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + async def test_sas_add(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + await self._set_up(storage_account, storage_account_key) + try: + # Arrange + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(add=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start=datetime.utcnow() - timedelta(minutes=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + + entity = self._create_random_entity_dict() + await table.create_entity(entity=entity) + + # Assert + resp = await self.table.get_entity(partition_key=entity['PartitionKey'], + row_key=entity['RowKey']) + self._assert_default_entity(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + async def test_sas_add_inside_range(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + await self._set_up(storage_account, storage_account_key) + try: + # Arrange + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(add=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start_pk='test', start_rk='test1', + end_pk='test', end_rk='test1', + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + entity = self._create_random_entity_dict('test', 'test1') + await table.create_entity(entity=entity) + + # Assert + resp = await self.table.get_entity('test', 'test1') + self._assert_default_entity(resp) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + async def test_sas_add_outside_range(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + await self._set_up(storage_account, storage_account_key) + try: + # Arrange + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(add=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start_pk='test', start_rk='test1', + end_pk='test', end_rk='test1', + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + with self.assertRaises(HttpResponseError): + entity = self._create_random_entity_dict() + await table.create_entity(entity=entity) + + # Assert + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + async def test_sas_update(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + await self._set_up(storage_account, storage_account_key) + try: + # Arrange + entity, _ = await self._insert_random_entity() + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(update=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + updated_entity = self._create_updated_entity_dict(entity.PartitionKey, entity.RowKey) + await table.update_entity(mode=UpdateMode.REPLACE, entity=updated_entity) + + # Assert + received_entity = await self.table.get_entity(entity.PartitionKey, + entity.RowKey) + self._assert_updated_entity(received_entity) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + async def test_sas_delete(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + await self._set_up(storage_account, storage_account_key) + try: + # Arrange + entity, _ = await self._insert_random_entity() + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + permission=TableSasPermissions(delete=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + await table.delete_entity(entity.PartitionKey, entity.RowKey) + + # Assert + with self.assertRaises(ResourceNotFoundError): + await self.table.get_entity(entity.PartitionKey, entity.RowKey) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + async def test_sas_upper_case_table_name(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + await self._set_up(storage_account, storage_account_key) + try: + # Arrange + entity, _ = await self._insert_random_entity() + + # Table names are case insensitive, so simply upper case our existing table name to test + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name.upper(), + permission=TableSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + start=datetime.utcnow() - timedelta(minutes=1), + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(self.table_name) + entities = [] + async for t in table.query_entities( + filter="PartitionKey eq '{}'".format(entity['PartitionKey'])): + entities.append(t) + + # Assert + self.assertEqual(len(entities), 1) + self._assert_default_entity(entities[0]) + finally: + await self._tear_down() + + # @pytest.mark.skip("pending") + @pytest.mark.live_test_only + @GlobalStorageAccountPreparer() + async def test_sas_signed_identifier(self, resource_group, location, storage_account, storage_account_key): + # SAS URL is calculated from storage key, so this test runs live only + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support sas") + await self._set_up(storage_account, storage_account_key) + try: + # Arrange + entity, _ = await self._insert_random_entity() + + access_policy = AccessPolicy() + access_policy.start = datetime(2011, 10, 11) + access_policy.expiry = datetime(2020, 10, 12) + access_policy.permission = TableSasPermissions(read=True) + identifiers = {'testid': access_policy} + + await self.table.set_table_access_policy(identifiers) + + token = generate_table_sas( + storage_account.name, + storage_account_key, + self.table_name, + policy_id='testid', + ) + + # Act + service = TableServiceClient( + self.account_url(storage_account, "table"), + credential=token, + ) + table = service.get_table_client(table=self.table_name) + entities = [] + async for t in table.query_entities( + filter="PartitionKey eq '{}'".format(entity.PartitionKey)): + entities.append(t) + + # Assert + self.assertEqual(len(entities), 1) + self._assert_default_entity(entities[0]) + finally: + await self._tear_down() + + +# ------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main() diff --git a/sdk/tables/azure-data-tables/tests/test_table_service_properties.py b/sdk/tables/azure-data-tables/tests/test_table_service_properties.py new file mode 100644 index 000000000000..a65cbfd6d21e --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_table_service_properties.py @@ -0,0 +1,262 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import unittest +import time +import pytest +from azure.data.tables._models import TableAnalyticsLogging, Metrics, RetentionPolicy, CorsRule + +from msrest.exceptions import ValidationError # TODO This should be an azure-core error. +from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer +from azure.core.exceptions import HttpResponseError + +# from azure.data.tabless import ( +# TableServiceClient, +# TableClient, +# TableAnalyticsLogging, +# Metrics, +# CorsRule, +# RetentionPolicy, +# ) + +from azure.data.tables import TableServiceClient + +from _shared.testcase import GlobalStorageAccountPreparer, TableTestCase + +# ------------------------------------------------------------------------------ + + +class TableServicePropertiesTest(TableTestCase): + # --Helpers----------------------------------------------------------------- + def _assert_properties_default(self, prop): + self.assertIsNotNone(prop) + + self._assert_logging_equal(prop['analytics_logging'], TableAnalyticsLogging()) + self._assert_metrics_equal(prop['hour_metrics'], Metrics()) + self._assert_metrics_equal(prop['minute_metrics'], Metrics()) + self._assert_cors_equal(prop['cors'], list()) + + def _assert_logging_equal(self, log1, log2): + if log1 is None or log2 is None: + self.assertEqual(log1, log2) + return + + self.assertEqual(log1.version, log2.version) + self.assertEqual(log1.read, log2.read) + self.assertEqual(log1.write, log2.write) + self.assertEqual(log1.delete, log2.delete) + self._assert_retention_equal(log1.retention_policy, log2.retention_policy) + + def _assert_delete_retention_policy_equal(self, policy1, policy2): + if policy1 is None or policy2 is None: + self.assertEqual(policy1, policy2) + return + + self.assertEqual(policy1.enabled, policy2.enabled) + self.assertEqual(policy1.days, policy2.days) + + def _assert_static_website_equal(self, prop1, prop2): + if prop1 is None or prop2 is None: + self.assertEqual(prop1, prop2) + return + + self.assertEqual(prop1.enabled, prop2.enabled) + self.assertEqual(prop1.index_document, prop2.index_document) + self.assertEqual(prop1.error_document404_path, prop2.error_document404_path) + + def _assert_delete_retention_policy_not_equal(self, policy1, policy2): + if policy1 is None or policy2 is None: + self.assertNotEqual(policy1, policy2) + return + + self.assertFalse(policy1.enabled == policy2.enabled + and policy1.days == policy2.days) + + def _assert_metrics_equal(self, metrics1, metrics2): + if metrics1 is None or metrics2 is None: + self.assertEqual(metrics1, metrics2) + return + + self.assertEqual(metrics1.version, metrics2.version) + self.assertEqual(metrics1.enabled, metrics2.enabled) + self.assertEqual(metrics1.include_apis, metrics2.include_apis) + self._assert_retention_equal(metrics1.retention_policy, metrics2.retention_policy) + + def _assert_cors_equal(self, cors1, cors2): + if cors1 is None or cors2 is None: + self.assertEqual(cors1, cors2) + return + + self.assertEqual(len(cors1), len(cors2)) + + for i in range(0, len(cors1)): + rule1 = cors1[i] + rule2 = cors2[i] + self.assertEqual(len(rule1.allowed_origins), len(rule2.allowed_origins)) + self.assertEqual(len(rule1.allowed_methods), len(rule2.allowed_methods)) + self.assertEqual(rule1.max_age_in_seconds, rule2.max_age_in_seconds) + self.assertEqual(len(rule1.exposed_headers), len(rule2.exposed_headers)) + self.assertEqual(len(rule1.allowed_headers), len(rule2.allowed_headers)) + + def _assert_retention_equal(self, ret1, ret2): + self.assertEqual(ret1.enabled, ret2.enabled) + self.assertEqual(ret1.days, ret2.days) + + # --Test cases per service --------------------------------------- + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_table_service_properties(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support service properties") + tsc = TableServiceClient(url, storage_account_key) + # Act + resp = tsc.set_service_properties( + analytics_logging=TableAnalyticsLogging(), + hour_metrics=Metrics(), + minute_metrics=Metrics(), + cors=list()) + + # Assert + self.assertIsNone(resp) + if self.is_live: + time.sleep(30) + self._assert_properties_default(tsc.get_service_properties()) + + + # --Test cases per feature --------------------------------------- + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_set_logging(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support service properties") + tsc = TableServiceClient(url, storage_account_key) + logging = TableAnalyticsLogging(read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5)) + + # Act + tsc.set_service_properties(analytics_logging=logging) + + # Assert + if self.is_live: + time.sleep(30) + received_props = tsc.get_service_properties() + self._assert_logging_equal(received_props['analytics_logging'], logging) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_set_hour_metrics(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support service properties") + tsc = TableServiceClient(url, storage_account_key) + hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) + + # Act + tsc.set_service_properties(hour_metrics=hour_metrics) + + # Assert + if self.is_live: + time.sleep(30) + received_props = tsc.get_service_properties() + self._assert_metrics_equal(received_props['hour_metrics'], hour_metrics) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_set_minute_metrics(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support service properties") + tsc = TableServiceClient(url, storage_account_key) + minute_metrics = Metrics(enabled=True, include_apis=True, + retention_policy=RetentionPolicy(enabled=True, days=5)) + + # Act + tsc.set_service_properties(minute_metrics=minute_metrics) + + # Assert + if self.is_live: + time.sleep(30) + received_props = tsc.get_service_properties() + self._assert_metrics_equal(received_props['minute_metrics'], minute_metrics) + + #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_set_cors(self, resource_group, location, storage_account, storage_account_key): + # Arrange + url = self.account_url(storage_account, "table") + if 'cosmos' in url: + pytest.skip("Cosmos Tables does not yet support service properties") + tsc = TableServiceClient(url, storage_account_key) + cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) + + allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] + allowed_methods = ['GET', 'PUT'] + max_age_in_seconds = 500 + exposed_headers = ["x-ms-meta-data*", "x-ms-meta-source*", "x-ms-meta-abc", "x-ms-meta-bcd"] + allowed_headers = ["x-ms-meta-data*", "x-ms-meta-target*", "x-ms-meta-xyz", "x-ms-meta-foo"] + cors_rule2 = CorsRule( + allowed_origins, + allowed_methods, + max_age_in_seconds=max_age_in_seconds, + exposed_headers=exposed_headers, + allowed_headers=allowed_headers) + + cors = [cors_rule1, cors_rule2] + + # Act + tsc.set_service_properties(cors=cors) + + # Assert + if self.is_live: + time.sleep(30) + received_props = tsc.get_service_properties() + self._assert_cors_equal(received_props['cors'], cors) + + # --Test cases for errors --------------------------------------- + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_retention_no_days(self, resource_group, location, storage_account, storage_account_key): + # Assert + self.assertRaises(ValueError, + RetentionPolicy, + True, None) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_too_many_cors_rules(self, resource_group, location, storage_account, storage_account_key): + # Arrange + tsc = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + cors = [] + for i in range(0, 6): + cors.append(CorsRule(['www.xyz.com'], ['GET'])) + + # Assert + self.assertRaises(HttpResponseError, + tsc.set_service_properties, None, None, None, cors) + + # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() + def test_retention_too_long(self, resource_group, location, storage_account, storage_account_key): + # Arrange + tsc = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + minute_metrics = Metrics(enabled=True, include_apis=True, + retention_policy=RetentionPolicy(enabled=True, days=366)) + + # Assert + self.assertRaises(HttpResponseError, + tsc.set_service_properties, + None, None, minute_metrics) + + +# ------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main() diff --git a/sdk/tables/azure-data-tables/tests/test_table_service_stats.py b/sdk/tables/azure-data-tables/tests/test_table_service_stats.py new file mode 100644 index 000000000000..ab6d8e6ef77f --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_table_service_stats.py @@ -0,0 +1,81 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import unittest +import pytest + +# from azure.data.tabless import TableServiceClient +from azure.data.tables import TableServiceClient +from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer +from _shared.testcase import GlobalResourceGroupPreparer, TableTestCase, GlobalStorageAccountPreparer + +SERVICE_UNAVAILABLE_RESP_BODY = 'unavailable ' + +SERVICE_LIVE_RESP_BODY = 'liveWed, 19 Jan 2021 22:28:43 GMT ' + + +# --Test Class ----------------------------------------------------------------- +class TableServiceStatsTest(TableTestCase): + # --Helpers----------------------------------------------------------------- + def _assert_stats_default(self, stats): + self.assertIsNotNone(stats) + self.assertIsNotNone(stats['geo_replication']) + + self.assertEqual(stats['geo_replication']['status'], 'live') + self.assertIsNotNone(stats['geo_replication']['last_sync_time']) + + def _assert_stats_unavailable(self, stats): + self.assertIsNotNone(stats) + self.assertIsNotNone(stats['geo_replication']) + + self.assertEqual(stats['geo_replication']['status'], 'unavailable') + self.assertIsNone(stats['geo_replication']['last_sync_time']) + + @staticmethod + def override_response_body_with_unavailable_status(response): + response.http_response.text = lambda _: SERVICE_UNAVAILABLE_RESP_BODY + + @staticmethod + def override_response_body_with_live_status(response): + response.http_response.text = lambda _: SERVICE_LIVE_RESP_BODY + # response.http_response.text = lambda _: SERVICE_LIVE_RESP_BODY + + # --Test cases per service --------------------------------------- + + # @pytest.mark.skip("pending") + #@GlobalStorageAccountPreparer() + @GlobalResourceGroupPreparer() + @StorageAccountPreparer(name_prefix='pyacrstorage', sku='Standard_RAGRS', random_name_enabled=True) + def test_table_service_stats_f(self, resource_group, location, storage_account, storage_account_key): + # Arrange + tsc = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + + # Act + stats = tsc.get_service_stats(raw_response_hook=self.override_response_body_with_live_status) + # Assert + self._assert_stats_default(stats) + + # @pytest.mark.skip("pending") + @GlobalResourceGroupPreparer() + @StorageAccountPreparer(name_prefix='pyacrstorage', sku='Standard_RAGRS', random_name_enabled=True) + def test_table_service_stats_when_unavailable(self, resource_group, location, storage_account, storage_account_key): + # Arrange + tsc = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) + + # Act + stats = tsc.get_service_stats( + raw_response_hook=self.override_response_body_with_unavailable_status) + + # Assert + self._assert_stats_unavailable(stats) + + +# ------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main() diff --git a/sdk/tables/ci.yml b/sdk/tables/ci.yml new file mode 100644 index 000000000000..c774c989e2f0 --- /dev/null +++ b/sdk/tables/ci.yml @@ -0,0 +1,41 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/tables/ + - sdk/core/ + - tools/ + - eng/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/tables/ + - sdk/core/ + - tools/ + - eng/ + + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: tables + Artifacts: + - name: azure_data_tables + safeName: azuredatatables + diff --git a/sdk/tables/tests.yml b/sdk/tables/tests.yml new file mode 100644 index 000000000000..ab37d5ceaa85 --- /dev/null +++ b/sdk/tables/tests.yml @@ -0,0 +1,39 @@ +trigger: none + +resources: + repositories: + - repository: azure-sdk-tools + type: github + name: Azure/azure-sdk-tools + endpoint: azure + +jobs: + - template: ./tests_invoke.yml + parameters: + InjectedPackages: $(InjectedPackages) + EnvVars: + STORAGE_ACCOUNT_NAME: $(python-storage-storage-account-name) + STORAGE_ACCOUNT_KEY: $(python-storage-storage-account-key) + STORAGE_DATA_LAKE_ACCOUNT_NAME: $(python-storage-data-lake-account-name) + STORAGE_DATA_LAKE_ACCOUNT_KEY: $(python-storage-data-lake-account-key) + BLOB_STORAGE_ACCOUNT_NAME: $(python-storage-blob-storage-account-name) + BLOB_STORAGE_ACCOUNT_KEY: $(python-storage-blob-storage-account-key) + REMOTE_STORAGE_ACCOUNT_NAME: $(python-storage-remote-storage-account-name) + REMOTE_STORAGE_ACCOUNT_KEY: $(python-storage-remote-storage-account-key) + PREMIUM_STORAGE_ACCOUNT_NAME: $(python-storage-premium-storage-account-name) + PREMIUM_STORAGE_ACCOUNT_KEY: $(python-storage-premium-storage-account-key) + OAUTH_STORAGE_ACCOUNT_NAME: $(python-storage-oauth-storage-account-name) + OAUTH_STORAGE_ACCOUNT_KEY: $(python-storage-oauth-storage-account-key) + ACTIVE_DIRECTORY_APPLICATION_ID: $(aad-azure-sdk-test-client-id) + ACTIVE_DIRECTORY_APPLICATION_SECRET: $(aad-azure-sdk-test-client-secret) + ACTIVE_DIRECTORY_TENANT_ID: $(aad-azure-sdk-test-tenant-id) + CONNECTION_STRING: $(python-storage-blob-connection-string) + BLOB_CONNECTION_STRING: $(python-storage-blob-connection-string) + PREMIUM_CONNECTION_STRING: $(python-storage-premium-connection-string) + TEST_MODE: 'RunLiveNoRecord' + AZURE_SKIP_LIVE_RECORDING: 'True' + AZURE_TEST_RUN_LIVE: 'true' + AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) + AZURE_SUBSCRIPTION_ID: $(azure-subscription-id) + AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) + AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) diff --git a/shared_requirements.txt b/shared_requirements.txt index 16b56a8ce224..8621eed303e5 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -153,4 +153,5 @@ opentelemetry-api==0.10b0 #override azure-search-documents msrest>=0.6.10 #override azure-synapse-accesscontrol azure-core>=1.6.0,<2.0.0 #override azure-synapse-spark azure-core>=1.6.0,<2.0.0 -#override azure-synapse-artifacts azure-core>=1.6.0,<2.0.0 \ No newline at end of file +#override azure-synapse-artifacts azure-core>=1.6.0,<2.0.0 +#override azure-data-tables msrest>=0.6.10 \ No newline at end of file