diff --git a/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetAccessPolicy-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetAccessPolicy-variables.yaml new file mode 100644 index 000000000000..4944bc270a8f --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetAccessPolicy-variables.yaml @@ -0,0 +1,4 @@ +--- +COSMOS_TABLES_ENDPOINT_SUFFIX: cosmos.azure.com +TABLES_COSMOS_ACCOUNT_NAME: seankaneprim +TABLES_PRIMARY_COSMOS_ACCOUNT_KEY: Kg== diff --git a/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetEmptyAccessPolicy-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetEmptyAccessPolicy-variables.yaml new file mode 100644 index 000000000000..4944bc270a8f --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetEmptyAccessPolicy-variables.yaml @@ -0,0 +1,4 @@ +--- +COSMOS_TABLES_ENDPOINT_SUFFIX: cosmos.azure.com +TABLES_COSMOS_ACCOUNT_NAME: seankaneprim +TABLES_PRIMARY_COSMOS_ACCOUNT_KEY: Kg== diff --git a/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetMultipleAccessPolicies-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetMultipleAccessPolicies-variables.yaml new file mode 100644 index 000000000000..4944bc270a8f --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetMultipleAccessPolicies-variables.yaml @@ -0,0 +1,4 @@ +--- +COSMOS_TABLES_ENDPOINT_SUFFIX: cosmos.azure.com +TABLES_COSMOS_ACCOUNT_NAME: seankaneprim +TABLES_PRIMARY_COSMOS_ACCOUNT_KEY: Kg== diff --git a/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetNullAccessPolicy-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetNullAccessPolicy-variables.yaml new file mode 100644 index 000000000000..4944bc270a8f --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetNullAccessPolicy-variables.yaml @@ -0,0 +1,4 @@ +--- +COSMOS_TABLES_ENDPOINT_SUFFIX: cosmos.azure.com +TABLES_COSMOS_ACCOUNT_NAME: seankaneprim +TABLES_PRIMARY_COSMOS_ACCOUNT_KEY: Kg== diff --git a/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetTooManyAccessPolicies-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetTooManyAccessPolicies-variables.yaml new file mode 100644 index 000000000000..4944bc270a8f --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetTooManyAccessPolicies-variables.yaml @@ -0,0 +1,4 @@ +--- +COSMOS_TABLES_ENDPOINT_SUFFIX: cosmos.azure.com +TABLES_COSMOS_ACCOUNT_NAME: seankaneprim +TABLES_PRIMARY_COSMOS_ACCOUNT_KEY: Kg== diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml new file mode 100644 index 000000000000..f41dcb551e19 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml @@ -0,0 +1,5 @@ +--- +STORAGE_ENDPOINT_SUFFIX: core.windows.net +TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== +TABLES_STORAGE_ACCOUNT_NAME: seankaneprim +randomSeed: "1625849358" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml new file mode 100644 index 000000000000..370066baf737 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml @@ -0,0 +1,122 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotable0qolgueqbqo8m"}' + 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: + - Fri, 09 Jul 2021 16:49:18 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":"gotable0qolgueqbqo8m"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 09 Jul 2021 16:49:18 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotable0qolgueqbqo8m') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 77af8ed1-c002-0081-0ce2-7448af000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: r2024-01-01T00:00:00Z2020-01-01T00:00:00Z1 + form: {} + headers: + Accept: + - application/xml + Authorization: + - sanitized + Content-Length: + - "213" + Content-Type: + - application/xml + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Fri, 09 Jul 2021 16:49:19 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotable0qolgueqbqo8m?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 09 Jul 2021 16:49:18 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 77af8f20-c002-0081-58e2-7448af000000 + 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: + - Fri, 09 Jul 2021 16:49:19 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotable0qolgueqbqo8m') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 09 Jul 2021 16:49:18 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 77af8f95-c002-0081-4ae2-7448af000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy-variables.yaml new file mode 100644 index 000000000000..75da5d52f9a0 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy-variables.yaml @@ -0,0 +1,5 @@ +--- +STORAGE_ENDPOINT_SUFFIX: core.windows.net +TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== +TABLES_STORAGE_ACCOUNT_NAME: seankaneprim +randomSeed: "1625242264" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy.yaml new file mode 100644 index 000000000000..78cfefca3141 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy.yaml @@ -0,0 +1,118 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotablemp92a68btv51b"}' + 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: + - Fri, 02 Jul 2021 16:11:04 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":"gotablemp92a68btv51b"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 02 Jul 2021 16:11:04 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablemp92a68btv51b') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 6acd05cd-4002-006b-295c-6f6f81000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/xml + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Fri, 02 Jul 2021 16:11:04 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablemp92a68btv51b?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 02 Jul 2021 16:11:04 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 6acd0623-4002-006b-7c5c-6f6f81000000 + 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: + - Fri, 02 Jul 2021 16:11:05 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablemp92a68btv51b') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 02 Jul 2021 16:11:04 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 6acd066d-4002-006b-405c-6f6f81000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies-variables.yaml new file mode 100644 index 000000000000..546d40d8997e --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies-variables.yaml @@ -0,0 +1,5 @@ +--- +STORAGE_ENDPOINT_SUFFIX: core.windows.net +TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== +TABLES_STORAGE_ACCOUNT_NAME: seankaneprim +randomSeed: "1625849315" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies.yaml new file mode 100644 index 000000000000..84feff7b92a6 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies.yaml @@ -0,0 +1,155 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotable4rpn1oqouhbus"}' + 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: + - Fri, 09 Jul 2021 16:48: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":"gotable4rpn1oqouhbus"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 09 Jul 2021 16:48:34 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotable4rpn1oqouhbus') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - eeaea336-1002-0014-1be2-74a01a000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: emptyrpartialr2021-06-08T02:10:09Z2021-06-08T02:10:09Zfull + form: {} + headers: + Accept: + - application/xml + Authorization: + - sanitized + Content-Length: + - "375" + Content-Type: + - application/xml + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Fri, 09 Jul 2021 16:48:35 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotable4rpn1oqouhbus?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 09 Jul 2021 16:48:34 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - eeaea364-1002-0014-47e2-74a01a000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/xml + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Fri, 09 Jul 2021 16:48:36 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotable4rpn1oqouhbus?comp=acl + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x65\x6D\x70\x74\x79\x3C\x2F\x49\x64\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x70\x61\x72\x74\x69\x61\x6C\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x66\x75\x6C\x6C\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x32\x31\x2D\x30\x36\x2D\x30\x38\x54\x30\x32\x3A\x31\x30\x3A\x30\x39\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x32\x31\x2D\x30\x36\x2D\x30\x38\x54\x30\x32\x3A\x31\x30\x3A\x30\x39\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Fri, 09 Jul 2021 16:48:35 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - eeaea3c2-1002-0014-24e2-74a01a000000 + 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: + - Fri, 09 Jul 2021 16:48:36 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotable4rpn1oqouhbus') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 09 Jul 2021 16:48:35 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - eeaea417-1002-0014-77e2-74a01a000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetNullAccessPolicy-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetNullAccessPolicy-variables.yaml new file mode 100644 index 000000000000..1182b61d3747 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetNullAccessPolicy-variables.yaml @@ -0,0 +1,5 @@ +--- +STORAGE_ENDPOINT_SUFFIX: core.windows.net +TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== +TABLES_STORAGE_ACCOUNT_NAME: seankaneprim +randomSeed: "1625849998" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetNullAccessPolicy.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetNullAccessPolicy.yaml new file mode 100644 index 000000000000..e3ae9a2c669f --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetNullAccessPolicy.yaml @@ -0,0 +1,155 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotableuz6wghsqjmdrx"}' + 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: + - Fri, 09 Jul 2021 16:59:58 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":"gotableuz6wghsqjmdrx"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 09 Jul 2021 16:59:57 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotableuz6wghsqjmdrx') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - b41c3fb8-5002-0015-22e3-74ffc6000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: null + form: {} + headers: + Accept: + - application/xml + Authorization: + - sanitized + Content-Length: + - "89" + Content-Type: + - application/xml + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Fri, 09 Jul 2021 16:59:59 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotableuz6wghsqjmdrx?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 09 Jul 2021 16:59:58 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - b41c3ff7-5002-0015-5de3-74ffc6000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/xml + Authorization: + - sanitized + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Fri, 09 Jul 2021 16:59:59 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotableuz6wghsqjmdrx?comp=acl + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x6E\x75\x6C\x6C\x3C\x2F\x49\x64\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Fri, 09 Jul 2021 16:59:58 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - b41c401f-5002-0015-05e3-74ffc6000000 + 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: + - Fri, 09 Jul 2021 16:59:59 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotableuz6wghsqjmdrx') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 09 Jul 2021 16:59:58 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - b41c4068-5002-0015-4ce3-74ffc6000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies-variables.yaml new file mode 100644 index 000000000000..f429532bb617 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies-variables.yaml @@ -0,0 +1,5 @@ +--- +STORAGE_ENDPOINT_SUFFIX: core.windows.net +TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== +TABLES_STORAGE_ACCOUNT_NAME: seankaneprim +randomSeed: "1625849388" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml new file mode 100644 index 000000000000..22521cfec224 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml @@ -0,0 +1,129 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotableal7ltzl6kugfg"}' + 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: + - Fri, 09 Jul 2021 16:49:48 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":"gotableal7ltzl6kugfg"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 09 Jul 2021 16:49:48 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotableal7ltzl6kugfg') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 86dd59fb-e002-0086-56e2-7424cc000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: r2029-01-01T00:00:00Z2020-01-01T00:00:00Z5r2029-01-01T00:00:00Z2020-01-01T00:00:00Z5r2029-01-01T00:00:00Z2020-01-01T00:00:00Z5r2029-01-01T00:00:00Z2020-01-01T00:00:00Z5r2029-01-01T00:00:00Z2020-01-01T00:00:00Z5r2029-01-01T00:00:00Z2020-01-01T00:00:00Z5 + form: {} + headers: + Accept: + - application/xml + Authorization: + - sanitized + Content-Length: + - "1083" + Content-Type: + - application/xml + User-Agent: + - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; + Windows_NT) + X-Ms-Date: + - Fri, 09 Jul 2021 16:49:49 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotableal7ltzl6kugfg?comp=acl + method: PUT + response: + body: |- + InvalidXmlDocumentXML specified is not syntactically valid. + RequestId:86dd5a4e-e002-0086-23e2-7424cc000000 + Time:2021-07-09T16:49:48.6605382Z + headers: + Content-Length: + - "327" + Content-Type: + - application/xml + Date: + - Fri, 09 Jul 2021 16:49:48 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Error-Code: + - InvalidXmlDocument + X-Ms-Request-Id: + - 86dd5a4e-e002-0086-23e2-7424cc000000 + X-Ms-Version: + - "2019-02-02" + status: 400 XML specified is not syntactically valid. + code: 400 + 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: + - Fri, 09 Jul 2021 16:49:49 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotableal7ltzl6kugfg') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 09 Jul 2021 16:49:48 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 86dd5a85-e002-0086-57e2-7424cc000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" diff --git a/sdk/tables/aztable/table_access_policy_test.go b/sdk/tables/aztable/table_access_policy_test.go new file mode 100644 index 000000000000..d5b9813725f1 --- /dev/null +++ b/sdk/tables/aztable/table_access_policy_test.go @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package aztable + +import ( + "strconv" + "time" + + "github.com/stretchr/testify/assert" +) + +func (s *tableClientLiveTests) TestSetEmptyAccessPolicy() { + if _, ok := cosmosTestsMap[s.T().Name()]; ok { + s.T().Skip("TableAccessPolicies are not available on Cosmos Accounts") + } + + assert := assert.New(s.T()) + client, delete := s.init(true) + defer delete() + + _, err := client.SetAccessPolicy(ctx, &TableSetAccessPolicyOptions{}) + assert.Nil(err, "Set access policy failed") +} + +func (s *tableClientLiveTests) TestSetAccessPolicy() { + if _, ok := cosmosTestsMap[s.T().Name()]; ok { + s.T().Skip("TableAccessPolicies are not available on Cosmos Accounts") + } + + assert := assert.New(s.T()) + // context := getTestContext(s.T().Name()) + client, delete := s.init(true) + defer delete() + + start := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) + expiration := time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC) + permission := "r" + id := "1" + + signedIdentifiers := make([]*SignedIdentifier, 0) + + signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ + AccessPolicy: &AccessPolicy{ + Expiry: &expiration, + Start: &start, + Permission: &permission, + }, + ID: &id, + }) + + param := TableSetAccessPolicyOptions{ + TableACL: signedIdentifiers, + } + + _, err := client.SetAccessPolicy(ctx, ¶m) + assert.Nil(err, "Set access policy failed") +} + +func (s *tableClientLiveTests) TestSetMultipleAccessPolicies() { + if _, ok := cosmosTestsMap[s.T().Name()]; ok { + s.T().Skip("TableAccessPolicies are not available on Cosmos Accounts") + } + + assert := assert.New(s.T()) + client, delete := s.init(true) + defer delete() + + id := "empty" + + signedIdentifiers := make([]*SignedIdentifier, 0) + signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ + ID: &id, + }) + + permission2 := "r" + id2 := "partial" + + signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ + ID: &id2, + AccessPolicy: &AccessPolicy{ + Permission: &permission2, + }, + }) + + id3 := "full" + permission3 := "r" + start := time.Date(2021, 6, 8, 2, 10, 9, 0, time.UTC) + expiry := time.Date(2021, 6, 8, 2, 10, 9, 0, time.UTC) + + signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ + ID: &id3, + AccessPolicy: &AccessPolicy{ + Start: &start, + Expiry: &expiry, + Permission: &permission3, + }, + }) + + param := TableSetAccessPolicyOptions{ + TableACL: signedIdentifiers, + } + + _, err := client.SetAccessPolicy(ctx, ¶m) + if err != nil { + assert.FailNow("Set access policy failed") + } + + // Make a Get to assert two access policies + resp, err := client.GetAccessPolicy(ctx) + assert.Nil(err, "Get Access Policy failed") + assert.Equal(len(resp.SignedIdentifiers), 3) +} + +func (s *tableClientLiveTests) TestSetTooManyAccessPolicies() { + if _, ok := cosmosTestsMap[s.T().Name()]; ok { + s.T().Skip("TableAccessPolicies are not available on Cosmos Accounts") + } + + assert := assert.New(s.T()) + // context := getTestContext(s.T().Name()) + client, delete := s.init(true) + defer delete() + + start := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) + expiration := time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC) + permission := "r" + id := "1" + signedIdentifiers := make([]*SignedIdentifier, 0) + + for i := 0; i < 6; i++ { + expiration = time.Date(2024+i, 1, 1, 0, 0, 0, 0, time.UTC) + id = strconv.Itoa(i) + + signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ + AccessPolicy: &AccessPolicy{ + Expiry: &expiration, + Start: &start, + Permission: &permission, + }, + ID: &id, + }) + + } + + param := TableSetAccessPolicyOptions{TableACL: signedIdentifiers} + + _, err := client.SetAccessPolicy(ctx, ¶m) + assert.NotNil(err, "Set access policy succeeded but should have failed") + assert.Contains(err.Error(), tooManyAccessPoliciesError.Error()) +} + +func (s *tableClientLiveTests) TestSetNullAccessPolicy() { + if _, ok := cosmosTestsMap[s.T().Name()]; ok { + s.T().Skip("TableAccessPolicies are not available on Cosmos Accounts") + } + + assert := assert.New(s.T()) + client, delete := s.init(true) + defer delete() + + id := "null" + + signedIdentifiers := make([]*SignedIdentifier, 0) + signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ + ID: &id, + }) + + param := TableSetAccessPolicyOptions{ + TableACL: signedIdentifiers, + } + + _, err := client.SetAccessPolicy(ctx, ¶m) + if err != nil { + assert.FailNow("Set access policy failed") + } + + resp, err := client.GetAccessPolicy(ctx) + assert.Nil(err, "Get Access Policy failed") + assert.Equal(len(resp.SignedIdentifiers), 1) +} diff --git a/sdk/tables/aztable/table_client.go b/sdk/tables/aztable/table_client.go index 3a5fc2d9de22..55da4ba7c9b1 100644 --- a/sdk/tables/aztable/table_client.go +++ b/sdk/tables/aztable/table_client.go @@ -133,3 +133,17 @@ func (t *TableClient) UpsertEntity(ctx context.Context, entity map[string]interf } return nil, errors.New("Invalid TableUpdateMode") } + +// GetAccessPolicy retrieves details about any stored access policies specified on the table that may be used with the Shared Access Signature +func (t *TableClient) GetAccessPolicy(ctx context.Context) (SignedIdentifierArrayResponse, error) { + return t.client.GetAccessPolicy(ctx, t.Name, nil) +} + +// SetAccessPolicy sets stored access policies for the table that may be used with SharedAccessSignature +func (t *TableClient) SetAccessPolicy(ctx context.Context, options *TableSetAccessPolicyOptions) (TableSetAccessPolicyResponse, error) { + response, err := t.client.SetAccessPolicy(ctx, t.Name, options) + if len(*&options.TableACL) > 5 { + err = tooManyAccessPoliciesError + } + return response, err +} diff --git a/sdk/tables/aztable/zc_table_constants.go b/sdk/tables/aztable/zc_table_constants.go index ee29206d8195..476cd2ba81e0 100644 --- a/sdk/tables/aztable/zc_table_constants.go +++ b/sdk/tables/aztable/zc_table_constants.go @@ -25,3 +25,4 @@ const ( ) var partitionKeyRowKeyError = errors.New("Entity must have a PartitionKey and RowKey") +var tooManyAccessPoliciesError = errors.New("You cannot set more than five (5) access policies at a time.") diff --git a/sdk/tables/aztable/zt_table_recorded_tests.go b/sdk/tables/aztable/zt_table_recorded_tests.go index 257bef5e34fe..1d159f194614 100644 --- a/sdk/tables/aztable/zt_table_recorded_tests.go +++ b/sdk/tables/aztable/zt_table_recorded_tests.go @@ -44,6 +44,7 @@ const ( var ctx = context.Background() var clientsMap map[string]*testContext = make(map[string]*testContext) +var cosmosTestsMap map[string]bool = make(map[string]bool) func storageURI(accountName string, endpointSuffix string) string { return "https://" + accountName + ".table." + endpointSuffix @@ -79,6 +80,7 @@ func recordedTestSetup(t *testing.T, testName string, endpointType EndpointType, secret, err = r.GetRecordedVariable(cosmosAccountKeyEnvVar, recording.Secret_Base64String) cred, _ = NewSharedKeyCredential(accountName, secret) uri = cosmosURI(accountName, suffix) + cosmosTestsMap[testName] = true } client, err := NewTableServiceClient(uri, cred, &TableClientOptions{HTTPClient: r, Retry: azcore.RetryOptions{MaxRetries: -1}})