diff --git a/sdk/tables/aztable/entity_test.go b/sdk/tables/aztable/entity_test.go index cf247a50bc42..d075a0bec75a 100644 --- a/sdk/tables/aztable/entity_test.go +++ b/sdk/tables/aztable/entity_test.go @@ -41,8 +41,8 @@ func (s *tableClientLiveTests) TestAddBasicEntity() { require.Equal(receivedEntity.RowKey, "rk001") queryString := "PartitionKey eq 'pk001'" - queryOptions := QueryOptions{Filter: &queryString} - pager := client.Query(&queryOptions) + listOptions := ListOptions{Filter: &queryString} + pager := client.List(&listOptions) count := 0 for pager.NextPage(ctx) { resp := pager.PageResponse() diff --git a/sdk/tables/aztable/models.go b/sdk/tables/aztable/models.go new file mode 100644 index 000000000000..c6ec5fc9371c --- /dev/null +++ b/sdk/tables/aztable/models.go @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package aztable + +// QueryOptions contains a group of parameters for the Table.Query method. +type ListOptions struct { + // OData filter expression. + Filter *string + // Specifies the media type for the response. + Format *OdataMetadataFormat + // Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + Select *string + // Maximum number of records to return. + Top *int32 +} + +func (l *ListOptions) toQueryOptions() *QueryOptions { + if l == nil { + return &QueryOptions{} + } + + return &QueryOptions{ + Filter: l.Filter, + Format: l.Format, + Select: l.Select, + Top: l.Top, + } +} diff --git a/sdk/tables/aztable/recordings/TestServiceClient_Cosmos/TestListTables-variables.yaml b/sdk/tables/aztable/recordings/TestServiceClient_Cosmos/TestListTables-variables.yaml new file mode 100644 index 000000000000..c6777751d235 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestServiceClient_Cosmos/TestListTables-variables.yaml @@ -0,0 +1,5 @@ +--- +COSMOS_TABLES_ENDPOINT_SUFFIX: cosmos.azure.com +TABLES_COSMOS_ACCOUNT_NAME: seankaneprim +TABLES_PRIMARY_COSMOS_ACCOUNT_KEY: Kg== +randomSeed: "1626796896" diff --git a/sdk/tables/aztable/recordings/TestServiceClient_Cosmos/TestListTables.yaml b/sdk/tables/aztable/recordings/TestServiceClient_Cosmos/TestListTables.yaml new file mode 100644 index 000000000000..ba3f4296d831 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestServiceClient_Cosmos/TestListTables.yaml @@ -0,0 +1,557 @@ +--- +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:36 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables + method: GET + response: + body: '{"value":[{"TableName":"gotable5jq3v0tq94aql4"},{"TableName":"gotableq7wc90zjsaq4o4"},{"TableName":"gotable5jq3v0tq94aql0"},{"TableName":"gotable5jq3v0tq94aql3"},{"TableName":"gotable5jq3v0tq94aql2"},{"TableName":"gotableq7wc90zjsaq4o3"},{"TableName":"gotablel4p8jpfnr5wfc"},{"TableName":"gotableq7wc90zjsaq4o2"},{"TableName":"gotable5jq3v0tq94aql1"},{"TableName":"gotableq7wc90zjsaq4o1"},{"TableName":"gotableq7wc90zjsaq4o0"}],"odata.metadata":"https://seankaneprim.table.cosmos.azure.com/$metadata#Tables"}' + headers: + Content-Type: + - application/json;odata=minimalmetadata + Date: + - Tue, 20 Jul 2021 16:01:36 GMT + X-Ms-Request-Id: + - d1a623e2-60a3-4471-bbdd-c9177dd251b8 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:36 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotable5jq3v0tq94aql4') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:36 GMT + X-Ms-Request-Id: + - c831b329-33a4-422d-bcb2-f521a44e73cd + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:37 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotableq7wc90zjsaq4o4') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:37 GMT + X-Ms-Request-Id: + - ec89c3e4-62c9-4298-87ff-e764077fc45e + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:37 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotable5jq3v0tq94aql0') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:37 GMT + X-Ms-Request-Id: + - 3870142d-c5ec-417d-ba17-46a852cac90c + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:38 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotable5jq3v0tq94aql3') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:37 GMT + X-Ms-Request-Id: + - 5e74aa0a-336a-4f5f-9ce5-314b3423dc47 + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:38 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotable5jq3v0tq94aql2') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:38 GMT + X-Ms-Request-Id: + - e72a9553-2139-4d23-8587-0597293e230d + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:38 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotableq7wc90zjsaq4o3') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:38 GMT + X-Ms-Request-Id: + - 2b2ac4dd-95d3-479f-b43c-dbbe95e24a35 + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:39 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotablel4p8jpfnr5wfc') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:39 GMT + X-Ms-Request-Id: + - 506ecd01-1315-4fdb-87c3-9565da3a8d35 + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:39 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotableq7wc90zjsaq4o2') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:39 GMT + X-Ms-Request-Id: + - de18a430-15e8-44b8-8102-b22c1ad23e31 + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:39 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotable5jq3v0tq94aql1') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:39 GMT + X-Ms-Request-Id: + - ad3e784e-5fe6-48bd-8281-107fab2d16b4 + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:40 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotableq7wc90zjsaq4o1') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:40 GMT + X-Ms-Request-Id: + - c6c69d9b-a4a5-469f-94d5-fa0dbbc7ed30 + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:40 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotableq7wc90zjsaq4o0') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 16:01:40 GMT + X-Ms-Request-Id: + - 4e3c0641-f714-49c9-9a24-f9f22df2afa5 + status: 204 No Content + code: 204 + duration: "" +- request: + body: '{"TableName":"gotabled7f5qwr5hskdg0"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "37" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:41 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables + method: POST + response: + body: '{"TableName":"gotabled7f5qwr5hskdg0","odata.metadata":"https://seankaneprim.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + Content-Type: + - application/json;odata=minimalmetadata + Date: + - Tue, 20 Jul 2021 16:01:41 GMT + Etag: + - W/"datetime'2021-07-20T16%3A01%3A41.6731656Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/Tables('gotabled7f5qwr5hskdg0') + X-Ms-Request-Id: + - df88e6cf-9bd6-4115-8177-b6aaaf2262e1 + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"TableName":"gotabled7f5qwr5hskdg1"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "37" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:42 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables + method: POST + response: + body: '{"TableName":"gotabled7f5qwr5hskdg1","odata.metadata":"https://seankaneprim.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + Content-Type: + - application/json;odata=minimalmetadata + Date: + - Tue, 20 Jul 2021 16:01:42 GMT + Etag: + - W/"datetime'2021-07-20T16%3A01%3A42.5668104Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/Tables('gotabled7f5qwr5hskdg1') + X-Ms-Request-Id: + - 26d147ca-dc5f-4475-aafb-08091ce29e69 + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"TableName":"gotabled7f5qwr5hskdg2"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "37" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:43 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables + method: POST + response: + body: '{"TableName":"gotabled7f5qwr5hskdg2","odata.metadata":"https://seankaneprim.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + Content-Type: + - application/json;odata=minimalmetadata + Date: + - Tue, 20 Jul 2021 16:01:43 GMT + Etag: + - W/"datetime'2021-07-20T16%3A01%3A43.3920520Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/Tables('gotabled7f5qwr5hskdg2') + X-Ms-Request-Id: + - ff314918-0c36-4935-8a12-e80e383d60cb + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"TableName":"gotabled7f5qwr5hskdg3"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "37" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:43 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables + method: POST + response: + body: '{"TableName":"gotabled7f5qwr5hskdg3","odata.metadata":"https://seankaneprim.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + Content-Type: + - application/json;odata=minimalmetadata + Date: + - Tue, 20 Jul 2021 16:01:44 GMT + Etag: + - W/"datetime'2021-07-20T16%3A01%3A44.2174984Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/Tables('gotabled7f5qwr5hskdg3') + X-Ms-Request-Id: + - a61384c7-ab17-424c-9c04-b0309eea72d0 + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"TableName":"gotabled7f5qwr5hskdg4"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "37" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:44 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables + method: POST + response: + body: '{"TableName":"gotabled7f5qwr5hskdg4","odata.metadata":"https://seankaneprim.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + Content-Type: + - application/json;odata=minimalmetadata + Date: + - Tue, 20 Jul 2021 16:01:44 GMT + Etag: + - W/"datetime'2021-07-20T16%3A01%3A45.0529800Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/Tables('gotabled7f5qwr5hskdg4') + X-Ms-Request-Id: + - 31a463d8-b07a-4360-8306-b1e05febc688 + status: 201 Created + code: 201 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:45 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables + method: GET + response: + body: '{"value":[{"TableName":"gotabled7f5qwr5hskdg3"},{"TableName":"gotabled7f5qwr5hskdg1"},{"TableName":"gotabled7f5qwr5hskdg0"},{"TableName":"gotabled7f5qwr5hskdg4"},{"TableName":"gotabled7f5qwr5hskdg2"}],"odata.metadata":"https://seankaneprim.table.cosmos.azure.com/$metadata#Tables"}' + headers: + Content-Type: + - application/json;odata=minimalmetadata + Date: + - Tue, 20 Jul 2021 16:01:45 GMT + X-Ms-Request-Id: + - a88f3060-ca4b-44e0-9ad2-15ec2205999a + status: 200 OK + code: 200 + duration: "" diff --git a/sdk/tables/aztable/recordings/TestServiceClient_Storage/TestListTables-variables.yaml b/sdk/tables/aztable/recordings/TestServiceClient_Storage/TestListTables-variables.yaml new file mode 100644 index 000000000000..5134b5eef979 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestServiceClient_Storage/TestListTables-variables.yaml @@ -0,0 +1,5 @@ +--- +STORAGE_ENDPOINT_SUFFIX: core.windows.net +TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== +TABLES_STORAGE_ACCOUNT_NAME: seankaneprim +randomSeed: "1626796893" diff --git a/sdk/tables/aztable/recordings/TestServiceClient_Storage/TestListTables.yaml b/sdk/tables/aztable/recordings/TestServiceClient_Storage/TestListTables.yaml new file mode 100644 index 000000000000..e95cb124c90e --- /dev/null +++ b/sdk/tables/aztable/recordings/TestServiceClient_Storage/TestListTables.yaml @@ -0,0 +1,713 @@ +--- +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:33 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables + method: GET + response: + body: '{"odata.metadata":"https://seankaneprim.table.core.windows.net/$metadata#Tables","value":[{"TableName":"gotable1v1a7j87nvs5o"},{"TableName":"gotable5jq3v0tq94aql0"},{"TableName":"gotable5jq3v0tq94aql1"},{"TableName":"gotable5jq3v0tq94aql2"},{"TableName":"gotable5jq3v0tq94aql3"},{"TableName":"gotable5jq3v0tq94aql4"},{"TableName":"gotablekyd305p8fhn460"},{"TableName":"gotablekyd305p8fhn461"},{"TableName":"gotablekyd305p8fhn462"},{"TableName":"gotablekyd305p8fhn463"},{"TableName":"gotablekyd305p8fhn464"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 20 Jul 2021 16:01:33 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf5925b-d002-0079-7380-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:34 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotable1v1a7j87nvs5o') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:33 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf592d4-d002-0079-6580-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:34 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotable5jq3v0tq94aql0') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:33 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf59332-d002-0079-3f80-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:34 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotable5jq3v0tq94aql1') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:33 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf59365-d002-0079-7280-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:34 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotable5jq3v0tq94aql2') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:34 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf59394-d002-0079-2080-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:34 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotable5jq3v0tq94aql3') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:34 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf593f1-d002-0079-7a80-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:34 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotable5jq3v0tq94aql4') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:34 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf59437-d002-0079-3f80-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablekyd305p8fhn460') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:34 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf59477-d002-0079-7e80-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablekyd305p8fhn461') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:34 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf594b1-d002-0079-3780-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablekyd305p8fhn462') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:34 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf594e9-d002-0079-6f80-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablekyd305p8fhn463') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:34 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf5952d-d002-0079-3180-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablekyd305p8fhn464') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 16:01:34 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf59575-d002-0079-7480-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: '{"TableName":"gotablebyhusoz3ewumo0"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "37" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables + method: POST + response: + body: '{"odata.metadata":"https://seankaneprim.table.core.windows.net/$metadata#Tables/@Element","TableName":"gotablebyhusoz3ewumo0"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 20 Jul 2021 16:01:34 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablebyhusoz3ewumo0') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf595ad-d002-0079-2980-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"TableName":"gotablebyhusoz3ewumo1"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "37" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables + method: POST + response: + body: '{"odata.metadata":"https://seankaneprim.table.core.windows.net/$metadata#Tables/@Element","TableName":"gotablebyhusoz3ewumo1"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 20 Jul 2021 16:01:35 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablebyhusoz3ewumo1') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf595fa-d002-0079-7280-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"TableName":"gotablebyhusoz3ewumo2"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "37" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables + method: POST + response: + body: '{"odata.metadata":"https://seankaneprim.table.core.windows.net/$metadata#Tables/@Element","TableName":"gotablebyhusoz3ewumo2"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 20 Jul 2021 16:01:35 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablebyhusoz3ewumo2') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf5963a-d002-0079-2e80-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"TableName":"gotablebyhusoz3ewumo3"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "37" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables + method: POST + response: + body: '{"odata.metadata":"https://seankaneprim.table.core.windows.net/$metadata#Tables/@Element","TableName":"gotablebyhusoz3ewumo3"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 20 Jul 2021 16:01:35 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablebyhusoz3ewumo3') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf59673-d002-0079-6580-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"TableName":"gotablebyhusoz3ewumo4"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "37" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables + method: POST + response: + body: '{"odata.metadata":"https://seankaneprim.table.core.windows.net/$metadata#Tables/@Element","TableName":"gotablebyhusoz3ewumo4"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 20 Jul 2021 16:01:35 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablebyhusoz3ewumo4') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf596a6-d002-0079-1780-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 16:01:36 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables + method: GET + response: + body: '{"odata.metadata":"https://seankaneprim.table.core.windows.net/$metadata#Tables","value":[{"TableName":"gotablebyhusoz3ewumo0"},{"TableName":"gotablebyhusoz3ewumo1"},{"TableName":"gotablebyhusoz3ewumo2"},{"TableName":"gotablebyhusoz3ewumo3"},{"TableName":"gotablebyhusoz3ewumo4"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 20 Jul 2021 16:01:35 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - dbf596db-d002-0079-4980-7d1451000000 + X-Ms-Version: + - "2019-02-02" + status: 200 OK + code: 200 + duration: "" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestListEntities-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestListEntities-variables.yaml new file mode 100644 index 000000000000..020dafba68f5 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestListEntities-variables.yaml @@ -0,0 +1,5 @@ +--- +COSMOS_TABLES_ENDPOINT_SUFFIX: cosmos.azure.com +TABLES_COSMOS_ACCOUNT_NAME: seankaneprim +TABLES_PRIMARY_COSMOS_ACCOUNT_KEY: Kg== +randomSeed: "1626796656" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestListEntities.yaml b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestListEntities.yaml new file mode 100644 index 000000000000..2b02d7b0d715 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestListEntities.yaml @@ -0,0 +1,305 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotablekpg8v4qrcxayf"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "36" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:36 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables + method: POST + response: + body: '{"TableName":"gotablekpg8v4qrcxayf","odata.metadata":"https://seankaneprim.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + Content-Type: + - application/json;odata=minimalmetadata + Date: + - Tue, 20 Jul 2021 15:57:36 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A36.9868296Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/Tables('gotablekpg8v4qrcxayf') + X-Ms-Request-Id: + - 29a6932d-34fe-43bf-bb15-0d6c9eef5b17 + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"PartitionKey":"partition","RowKey":"0","Value":1}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "51" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + Prefer: + - return-no-content + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:37 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf + method: POST + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 15:57:37 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A37.7762312Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf(PartitionKey='partition',RowKey='0') + Preference-Applied: + - return-no-content + X-Ms-Request-Id: + - 2f1b9870-84c7-46b8-b418-d75d21c3b448 + status: 204 No Content + code: 204 + duration: "" +- request: + body: '{"PartitionKey":"partition","RowKey":"1","Value":2}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "51" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + Prefer: + - return-no-content + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:37 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf + method: POST + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 15:57:37 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A37.8735112Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf(PartitionKey='partition',RowKey='1') + Preference-Applied: + - return-no-content + X-Ms-Request-Id: + - 7cd30c18-6738-4b94-a3b2-14ef52328a4c + status: 204 No Content + code: 204 + duration: "" +- request: + body: '{"PartitionKey":"partition","RowKey":"2","Value":3}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "51" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + Prefer: + - return-no-content + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:37 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf + method: POST + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 15:57:37 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A37.9680264Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf(PartitionKey='partition',RowKey='2') + Preference-Applied: + - return-no-content + X-Ms-Request-Id: + - e2d19d8b-055a-4afd-812b-c85a94476427 + status: 204 No Content + code: 204 + duration: "" +- request: + body: '{"PartitionKey":"partition","RowKey":"3","Value":4}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "51" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + Prefer: + - return-no-content + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:37 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf + method: POST + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 15:57:37 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A38.0645896Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf(PartitionKey='partition',RowKey='3') + Preference-Applied: + - return-no-content + X-Ms-Request-Id: + - 425ae295-a848-455b-8ccd-16ba1cf78366 + status: 204 No Content + code: 204 + duration: "" +- request: + body: '{"PartitionKey":"partition","RowKey":"4","Value":5}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "51" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + Prefer: + - return-no-content + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:37 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf + method: POST + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 15:57:37 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A38.1603336Z'" + Location: + - https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf(PartitionKey='partition',RowKey='4') + Preference-Applied: + - return-no-content + X-Ms-Request-Id: + - 0c8dd131-e14b-49db-8092-02106c01b50c + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:37 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/gotablekpg8v4qrcxayf() + method: GET + response: + body: '{"value":[{"odata.etag":"W/\"datetime''2021-07-20T15%3A57%3A37.7762312Z''\"","PartitionKey":"partition","RowKey":"0","Value":1,"Timestamp":"2021-07-20T15:57:37.7762312Z"},{"odata.etag":"W/\"datetime''2021-07-20T15%3A57%3A37.8735112Z''\"","PartitionKey":"partition","RowKey":"1","Value":2,"Timestamp":"2021-07-20T15:57:37.8735112Z"},{"odata.etag":"W/\"datetime''2021-07-20T15%3A57%3A37.9680264Z''\"","PartitionKey":"partition","RowKey":"2","Value":3,"Timestamp":"2021-07-20T15:57:37.9680264Z"},{"odata.etag":"W/\"datetime''2021-07-20T15%3A57%3A38.0645896Z''\"","PartitionKey":"partition","RowKey":"3","Value":4,"Timestamp":"2021-07-20T15:57:38.0645896Z"},{"odata.etag":"W/\"datetime''2021-07-20T15%3A57%3A38.1603336Z''\"","PartitionKey":"partition","RowKey":"4","Value":5,"Timestamp":"2021-07-20T15:57:38.1603336Z"}],"odata.metadata":"https://seankaneprim.table.cosmos.azure.com/$metadata#gotablekpg8v4qrcxayf"}' + headers: + Content-Type: + - application/json;odata=minimalmetadata + Date: + - Tue, 20 Jul 2021 15:57:37 GMT + X-Ms-Request-Id: + - e9ab21c5-dc78-458c-a610-0b7284f6b128 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:38 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.cosmos.azure.com/Tables('gotablekpg8v4qrcxayf') + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 20 Jul 2021 15:57:37 GMT + X-Ms-Request-Id: + - e883f6a8-15bc-4e93-86fa-ce057757595c + status: 204 No Content + code: 204 + duration: "" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestListEntities-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestListEntities-variables.yaml new file mode 100644 index 000000000000..d5b7be133444 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestListEntities-variables.yaml @@ -0,0 +1,5 @@ +--- +STORAGE_ENDPOINT_SUFFIX: core.windows.net +TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== +TABLES_STORAGE_ACCOUNT_NAME: seankaneprim +randomSeed: "1626796654" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestListEntities.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestListEntities.yaml new file mode 100644 index 000000000000..6a1ca63a2c47 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestListEntities.yaml @@ -0,0 +1,389 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotablemwc9x1cbe9eur"}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "36" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:34 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables + method: POST + response: + body: '{"odata.metadata":"https://seankaneprim.table.core.windows.net/$metadata#Tables/@Element","TableName":"gotablemwc9x1cbe9eur"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 20 Jul 2021 15:57:34 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablemwc9x1cbe9eur') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - fa96f097-3002-0071-097f-7d0e5e000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"PartitionKey":"partition","RowKey":"0","Value":1}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "51" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + Prefer: + - return-no-content + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur(PartitionKey='partition',RowKey='0') + Date: + - Tue, 20 Jul 2021 15:57:34 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A35.6389627Z'" + Location: + - https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur(PartitionKey='partition',RowKey='0') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - fa96f0da-3002-0071-427f-7d0e5e000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: '{"PartitionKey":"partition","RowKey":"1","Value":2}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "51" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + Prefer: + - return-no-content + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur(PartitionKey='partition',RowKey='1') + Date: + - Tue, 20 Jul 2021 15:57:35 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A35.7230224Z'" + Location: + - https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur(PartitionKey='partition',RowKey='1') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - fa96f0fd-3002-0071-647f-7d0e5e000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: '{"PartitionKey":"partition","RowKey":"2","Value":3}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "51" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + Prefer: + - return-no-content + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur(PartitionKey='partition',RowKey='2') + Date: + - Tue, 20 Jul 2021 15:57:35 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A35.811085Z'" + Location: + - https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur(PartitionKey='partition',RowKey='2') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - fa96f160-3002-0071-447f-7d0e5e000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: '{"PartitionKey":"partition","RowKey":"3","Value":4}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "51" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + Prefer: + - return-no-content + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur(PartitionKey='partition',RowKey='3') + Date: + - Tue, 20 Jul 2021 15:57:35 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A35.898147Z'" + Location: + - https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur(PartitionKey='partition',RowKey='3') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - fa96f189-3002-0071-6b7f-7d0e5e000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: '{"PartitionKey":"partition","RowKey":"4","Value":5}' + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Content-Length: + - "51" + Content-Type: + - application/json + Dataserviceversion: + - "3.0" + Prefer: + - return-no-content + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur(PartitionKey='partition',RowKey='4') + Date: + - Tue, 20 Jul 2021 15:57:35 GMT + Etag: + - W/"datetime'2021-07-20T15%3A57%3A35.9842082Z'" + Location: + - https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur(PartitionKey='partition',RowKey='4') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - fa96f1b7-3002-0071-197f-7d0e5e000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - sanitized + Dataserviceversion: + - "3.0" + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablemwc9x1cbe9eur() + method: GET + response: + body: '{"odata.metadata":"https://seankaneprim.table.core.windows.net/$metadata#gotablemwc9x1cbe9eur","value":[{"odata.etag":"W/\"datetime''2021-07-20T15%3A57%3A35.6389627Z''\"","PartitionKey":"partition","RowKey":"0","Timestamp":"2021-07-20T15:57:35.6389627Z","Value":1},{"odata.etag":"W/\"datetime''2021-07-20T15%3A57%3A35.7230224Z''\"","PartitionKey":"partition","RowKey":"1","Timestamp":"2021-07-20T15:57:35.7230224Z","Value":2},{"odata.etag":"W/\"datetime''2021-07-20T15%3A57%3A35.811085Z''\"","PartitionKey":"partition","RowKey":"2","Timestamp":"2021-07-20T15:57:35.811085Z","Value":3},{"odata.etag":"W/\"datetime''2021-07-20T15%3A57%3A35.898147Z''\"","PartitionKey":"partition","RowKey":"3","Timestamp":"2021-07-20T15:57:35.898147Z","Value":4},{"odata.etag":"W/\"datetime''2021-07-20T15%3A57%3A35.9842082Z''\"","PartitionKey":"partition","RowKey":"4","Timestamp":"2021-07-20T15:57:35.9842082Z","Value":5}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 20 Jul 2021 15:57:35 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - fa96f1e0-3002-0071-417f-7d0e5e000000 + X-Ms-Version: + - "2019-02-02" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Tue, 20 Jul 2021 15:57:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablemwc9x1cbe9eur') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 20 Jul 2021 15:57:35 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - fa96f214-3002-0071-737f-7d0e5e000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" diff --git a/sdk/tables/aztable/table_batch_test.go b/sdk/tables/aztable/table_batch_test.go index 65dd8226e8c8..851cbf573796 100644 --- a/sdk/tables/aztable/table_batch_test.go +++ b/sdk/tables/aztable/table_batch_test.go @@ -32,7 +32,7 @@ func (s *tableClientLiveTests) TestBatchAdd() { require.Equal(r.StatusCode, http.StatusNoContent) } - pager := client.Query(nil) + pager := client.List(nil) count := 0 for pager.NextPage(ctx) { response := pager.PageResponse() @@ -69,8 +69,8 @@ func (s *tableClientLiveTests) TestBatchMixed() { var qResp TableEntityQueryByteResponseResponse filter := "RowKey eq '1'" - query := &QueryOptions{Filter: &filter} - pager := client.Query(query) + list := &ListOptions{Filter: &filter} + pager := client.List(list) for pager.NextPage(ctx) { qResp = pager.PageResponse() } @@ -125,7 +125,7 @@ func (s *tableClientLiveTests) TestBatchMixed() { } - pager = client.Query(query) + pager = client.List(list) for pager.NextPage(ctx) { qResp = pager.PageResponse() } diff --git a/sdk/tables/aztable/table_client.go b/sdk/tables/aztable/table_client.go index 6740cb0c8ce7..8fb6c93ea071 100644 --- a/sdk/tables/aztable/table_client.go +++ b/sdk/tables/aztable/table_client.go @@ -42,8 +42,8 @@ func (t *TableClient) Delete(ctx context.Context) (TableDeleteResponse, error) { return t.service.Delete(ctx, t.Name) } -// Query queries the tables using the specified QueryOptions. -// QueryOptions can specify the following properties to affect the query results returned: +// List queries the entities using the specified ListOptions. +// ListOptions can specify the following properties to affect the query results returned: // // Filter: An Odata filter expression that limits results to those entities that satisfy the filter expression. // For example, the following expression would return only entities with a PartitionKey of 'foo': "PartitionKey eq 'foo'" @@ -54,19 +54,20 @@ func (t *TableClient) Delete(ctx context.Context) (TableDeleteResponse, error) { // Top: The maximum number of entities that will be returned per page of results. // Note: This value does not limit the total number of results if NextPage is called on the returned Pager until it returns false. // -// Query returns a Pager, which allows iteration through each page of results. Example: +// List returns a Pager, which allows iteration through each page of results. Example: // -// pager := client.Query(nil) +// options := &ListOptions{Filter: to.StringPtr("PartitionKey eq 'pk001'"), Top: to.Int32Ptr(25), Select: to.StringPtr("PartitionKey,RowKey,Value,Price")} +// pager := client.List(options) // Pass in 'nil' if you want to return all Entities for an account. // for pager.NextPage(ctx) { // resp = pager.PageResponse() -// fmt.Sprintf("The page contains %i results", len(resp.TableEntityQueryResponse.Value)) +// fmt.Printf("The page contains %i results.\n", len(resp.TableEntityQueryResponse.Value)) // } // err := pager.Err() -func (t *TableClient) Query(queryOptions *QueryOptions) TableEntityQueryResponsePager { - if queryOptions == nil { - queryOptions = &QueryOptions{} - } - return &tableEntityQueryResponsePager{tableClient: t, queryOptions: queryOptions, tableQueryOptions: &TableQueryEntitiesOptions{}} +func (t *TableClient) List(queryOptions *ListOptions) TableEntityQueryResponsePager { + return &tableEntityQueryResponsePager{ + tableClient: t, + queryOptions: queryOptions, + tableQueryOptions: &TableQueryEntitiesOptions{}} } // GetEntity retrieves a specific entity from the service using the specified partitionKey and rowKey values. diff --git a/sdk/tables/aztable/table_client_test.go b/sdk/tables/aztable/table_client_test.go index 53f841ca5e42..0c2f31f3c6e9 100644 --- a/sdk/tables/aztable/table_client_test.go +++ b/sdk/tables/aztable/table_client_test.go @@ -117,7 +117,7 @@ func (s *tableClientLiveTests) TestMergeEntity() { require.NoError(err) filter := "RowKey eq '1'" - queryOptions := &QueryOptions{Filter: &filter} + listOptions := &ListOptions{Filter: &filter} preMerge, err := client.GetEntity(ctx, entityToCreate.PartitionKey, entityToCreate.RowKey, nil) require.NoError(err) @@ -138,7 +138,7 @@ func (s *tableClientLiveTests) TestMergeEntity() { require.Nil(updateErr) var qResp TableEntityQueryByteResponseResponse - pager := client.Query(queryOptions) + pager := client.List(listOptions) for pager.NextPage(ctx) { qResp = pager.PageResponse() } @@ -167,7 +167,7 @@ func (s *tableClientLiveTests) TestUpsertEntity() { require.NoError(err) filter := "RowKey eq '1'" - query := &QueryOptions{Filter: &filter} + list := &ListOptions{Filter: &filter} // 2. Query for basic Entity preMerge, err := client.GetEntity(ctx, entityToCreate.PartitionKey, entityToCreate.RowKey, nil) @@ -189,7 +189,7 @@ func (s *tableClientLiveTests) TestUpsertEntity() { // 5. Query for new entity var qResp TableEntityQueryByteResponseResponse - pager := client.Query(query) + pager := client.List(list) for pager.NextPage(ctx) { qResp = pager.PageResponse() } @@ -220,11 +220,11 @@ func (s *tableClientLiveTests) TestQuerySimpleEntity() { } filter := "RowKey lt '5'" - query := &QueryOptions{Filter: &filter} + list := &ListOptions{Filter: &filter} expectedCount := 4 var resp TableEntityQueryByteResponseResponse - pager := client.Query(query) + pager := client.List(list) for pager.NextPage(ctx) { resp = pager.PageResponse() require.Equal(len(resp.TableEntityQueryResponse.Value), expectedCount) @@ -269,10 +269,10 @@ func (s *tableClientLiveTests) TestQueryComplexEntity() { filter := "RowKey lt '5'" expectedCount := 4 - query := &QueryOptions{Filter: &filter} + options := &ListOptions{Filter: &filter} var resp TableEntityQueryByteResponseResponse - pager := client.Query(query) + pager := client.List(options) for pager.NextPage(ctx) { resp = pager.PageResponse() require.Equal(expectedCount, len(resp.TableEntityQueryResponse.Value)) diff --git a/sdk/tables/aztable/table_pagers.go b/sdk/tables/aztable/table_pagers.go index 5e4dce565c0b..695014433428 100644 --- a/sdk/tables/aztable/table_pagers.go +++ b/sdk/tables/aztable/table_pagers.go @@ -29,7 +29,7 @@ import ( // // for pager.NextPage(ctx) { // resp = pager.PageResponse() -// fmt.sprintf("The page contains %i results", len(resp.TableEntityQueryResponse.Value)) +// fmt.Printf("The page contains %i results.\n", len(resp.TableEntityQueryResponse.Value)) // } // err := pager.Err() type TableEntityQueryResponsePager interface { @@ -43,7 +43,7 @@ type tableEntityQueryResponsePager struct { tableClient *TableClient current *TableEntityQueryByteResponseResponse tableQueryOptions *TableQueryEntitiesOptions - queryOptions *QueryOptions + queryOptions *ListOptions err error } @@ -55,7 +55,7 @@ func (p *tableEntityQueryResponsePager) NextPage(ctx context.Context) bool { return false } var resp TableEntityQueryResponseResponse - resp, p.err = p.tableClient.client.QueryEntities(ctx, p.tableClient.Name, p.tableQueryOptions, p.queryOptions) + resp, p.err = p.tableClient.client.QueryEntities(ctx, p.tableClient.Name, p.tableQueryOptions, p.queryOptions.toQueryOptions()) c, err := castToByteResponse(&resp) if err != nil { @@ -73,7 +73,7 @@ func (p *tableEntityQueryResponsePager) NextPage(ctx context.Context) bool { // // for pager.NextPage(ctx) { // resp = pager.PageResponse() -// fmt.sprintf("The page contains %i results", len(resp.TableEntityQueryResponse.Value)) +// fmt.Printf("The page contains %i results.\n", len(resp.TableEntityQueryResponse.Value)) // } // err := pager.Err() func (p *tableEntityQueryResponsePager) PageResponse() TableEntityQueryByteResponseResponse { @@ -97,7 +97,7 @@ func (p *tableEntityQueryResponsePager) Err() error { // // for pager.NextPage(ctx) { // resp = pager.PageResponse() -// fmt.sprintf("The page contains %i results", len(resp.TableEntityQueryResponse.Value)) +// fmt.Printf("The page contains %i results.\n", len(resp.TableEntityQueryResponse.Value)) // } // err := pager.Err() type TableQueryResponsePager interface { @@ -111,7 +111,7 @@ type tableQueryResponsePager struct { client *tableClient current *TableQueryResponseResponse tableQueryOptions *TableQueryOptions - queryOptions *QueryOptions + queryOptions *ListOptions err error } @@ -123,7 +123,7 @@ func (p *tableQueryResponsePager) NextPage(ctx context.Context) bool { return false } var resp TableQueryResponseResponse - resp, p.err = p.client.Query(ctx, p.tableQueryOptions, p.queryOptions) + resp, p.err = p.client.Query(ctx, p.tableQueryOptions, p.queryOptions.toQueryOptions()) p.current = &resp p.tableQueryOptions.NextTableName = resp.XMSContinuationNextTableName return p.err == nil && resp.TableQueryResponse.Value != nil && len(resp.TableQueryResponse.Value) > 0 @@ -134,7 +134,7 @@ func (p *tableQueryResponsePager) NextPage(ctx context.Context) bool { // // for pager.NextPage(ctx) { // resp = pager.PageResponse() -// fmt.sprintf("The page contains %i results", len(resp.TableEntityQueryResponse.Value)) +// fmt.Printf("The page contains %i results.\n", len(resp.TableEntityQueryResponse.Value)) // } func (p *tableQueryResponsePager) PageResponse() TableQueryResponseResponse { return *p.current diff --git a/sdk/tables/aztable/table_service_client.go b/sdk/tables/aztable/table_service_client.go index 4f5fa650d5fc..9a0e8c84da51 100644 --- a/sdk/tables/aztable/table_service_client.go +++ b/sdk/tables/aztable/table_service_client.go @@ -54,8 +54,8 @@ func (t *TableServiceClient) Delete(ctx context.Context, name string) (TableDele return t.client.Delete(ctx, name, nil) } -// Query queries the existing tables using the specified QueryOptions. -// QueryOptions can specify the following properties to affect the query results returned: +// List queries the existing tables using the specified ListOptions. +// ListOptions can specify the following properties to affect the query results returned: // // Filter: An Odata filter expression that limits results to those tables that satisfy the filter expression. // For example, the following expression would return only tables with a TableName of 'foo': "TableName eq 'foo'" @@ -63,16 +63,21 @@ func (t *TableServiceClient) Delete(ctx context.Context, name string) (TableDele // Top: The maximum number of tables that will be returned per page of results. // Note: This value does not limit the total number of results if NextPage is called on the returned Pager until it returns false. // -// Query returns a Pager, which allows iteration through each page of results. Example: +// List returns a Pager, which allows iteration through each page of results. Example: // -// pager := client.Query(nil) +// options := &ListOptions{Filter: to.StringPtr("PartitionKey eq 'pk001'"), Top: to.Int32Ptr(25)} +// pager := client.List(options) // Pass in 'nil' if you want to return all Tables for an account. // for pager.NextPage(ctx) { // resp = pager.PageResponse() -// fmt.sprintf("The page contains %i results", len(resp.TableQueryResponse.Value)) +// fmt.Printf("The page contains %i results.\n", len(resp.TableQueryResponse.Value)) // } // err := pager.Err() -func (t *TableServiceClient) Query(queryOptions *QueryOptions) TableQueryResponsePager { - return &tableQueryResponsePager{client: t.client, queryOptions: queryOptions, tableQueryOptions: new(TableQueryOptions)} +func (t *TableServiceClient) List(listOptions *ListOptions) TableQueryResponsePager { + return &tableQueryResponsePager{ + client: t.client, + queryOptions: listOptions, + tableQueryOptions: new(TableQueryOptions), + } } // GetStatistics retrieves all the statistics for an account with Geo-redundancy established. diff --git a/sdk/tables/aztable/table_service_client_test.go b/sdk/tables/aztable/table_service_client_test.go index c66839660353..db8e54145f25 100644 --- a/sdk/tables/aztable/table_service_client_test.go +++ b/sdk/tables/aztable/table_service_client_test.go @@ -101,7 +101,7 @@ func (s *tableServiceClientLiveTests) TestQueryTable() { // Query for tables with no pagination. The filter should exclude one table from the results filter := fmt.Sprintf("TableName ge '%s' and TableName lt '%s'", prefix1, prefix2) - pager := context.client.Query(&QueryOptions{Filter: &filter}) + pager := context.client.List(&ListOptions{Filter: &filter}) resultCount := 0 for pager.NextPage(ctx) { @@ -114,7 +114,7 @@ func (s *tableServiceClientLiveTests) TestQueryTable() { // Query for tables with pagination top := int32(2) - pager = context.client.Query(&QueryOptions{Filter: &filter, Top: &top}) + pager = context.client.List(&ListOptions{Filter: &filter, Top: &top}) resultCount = 0 pageCount := 0 @@ -129,6 +129,45 @@ func (s *tableServiceClientLiveTests) TestQueryTable() { require.Equal(pageCount, int(top)) } +func clearAllTables(context *testContext) error { + pager := context.client.List(nil) + for pager.NextPage(ctx) { + resp := pager.PageResponse() + for _, v := range resp.TableQueryResponse.Value { + _, err := context.client.Delete(ctx, *v.TableName) + if err != nil { + return err + } + } + } + return pager.Err() +} + +func (s *tableServiceClientLiveTests) TestListTables() { + require := require.New(s.T()) + context := getTestContext(s.T().Name()) + tableName, err := getTableName(context) + require.NoError(err) + + err = clearAllTables(context) + require.NoError(err) + + for i := 0; i < 5; i++ { + _, err := context.client.Create(ctx, fmt.Sprintf("%v%v", tableName, i)) + require.NoError(err) + } + + count := 0 + pager := context.client.List(nil) + for pager.NextPage(ctx) { + resp := pager.PageResponse() + count += len(resp.TableQueryResponse.Value) + } + + require.NoError(pager.Err()) + require.Equal(5, count) +} + func (s *tableServiceClientLiveTests) TestGetStatistics() { require := require.New(s.T()) context := getTestContext(s.T().Name()) diff --git a/sdk/tables/aztable/zt_table_recorded_tests.go b/sdk/tables/aztable/zt_table_recorded_tests.go index 5b2edcd5a0cb..d32bcb23330b 100644 --- a/sdk/tables/aztable/zt_table_recorded_tests.go +++ b/sdk/tables/aztable/zt_table_recorded_tests.go @@ -103,11 +103,30 @@ func recordedTestTeardown(key string) { } } +func insertNEntities(pk string, n int, client *TableClient) error { + for i := 0; i < n; i++ { + e := &map[string]interface{}{ + "PartitionKey": pk, + "RowKey": fmt.Sprint(i), + "Value": i + 1, + } + marshalled, err := json.Marshal(e) + if err != nil { + return err + } + _, err = client.AddEntity(ctx, marshalled) + if err != nil { + return err + } + } + return nil +} + // cleans up the specified tables. If tables is nil, all tables will be deleted func cleanupTables(context *testContext, tables *[]string) { c := context.client if tables == nil { - pager := c.Query(nil) + pager := c.List(nil) for pager.NextPage(ctx) { for _, t := range pager.PageResponse().TableQueryResponse.Value { _, err := c.Delete(ctx, *t.TableName)