From 739cc4a88c2e68054b835f2db79926ccbcad1923 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Fri, 2 Jul 2021 11:33:35 -0400 Subject: [PATCH 1/8] adding a way to skip cosmos tests, adding access policies --- .../TestSetAccessPolicy-variables.yaml | 5 + .../TestSetAccessPolicy.yaml | 129 ++++++++++++++++++ .../TestSetEmptyAccessPolicy-variables.yaml | 5 + .../TestSetEmptyAccessPolicy.yaml | 122 +++++++++++++++++ sdk/tables/aztable/table_access_policy.go | 18 +++ .../aztable/table_access_policy_test.go | 51 +++++++ sdk/tables/aztable/table_client.go | 12 ++ sdk/tables/aztable/zt_table_recorded_tests.go | 2 + 8 files changed, 344 insertions(+) create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy-variables.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy.yaml create mode 100644 sdk/tables/aztable/table_access_policy.go create mode 100644 sdk/tables/aztable/table_access_policy_test.go 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..df7baedae6be --- /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: "1625239229" 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..d82ad862f7be --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml @@ -0,0 +1,129 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotablezvn943r8v2n2f"}' + 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 15:20:29 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":"gotablezvn943r8v2n2f"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 02 Jul 2021 15:20:29 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablezvn943r8v2n2f') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 6055a553-e002-00a9-3455-6f2907000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: rw2021-07-02T12:20:30.0789136-04:002021-07-02T11:20:30.0789136-04:00 + form: {} + headers: + Accept: + - application/xml + Authorization: + - sanitized + Content-Length: + - "230" + 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, 02 Jul 2021 15:20:30 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablezvn943r8v2n2f?comp=acl + method: PUT + response: + body: |- + InvalidXmlDocumentXML specified is not syntactically valid. + RequestId:6055a58c-e002-00a9-6a55-6f2907000000 + Time:2021-07-02T15:20:30.1559981Z + headers: + Content-Length: + - "327" + Content-Type: + - application/xml + Date: + - Fri, 02 Jul 2021 15:20:29 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Error-Code: + - InvalidXmlDocument + X-Ms-Request-Id: + - 6055a58c-e002-00a9-6a55-6f2907000000 + 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, 02 Jul 2021 15:20:30 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablezvn943r8v2n2f') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 02 Jul 2021 15:20:30 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 6055a5f4-e002-00a9-4b55-6f2907000000 + 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..4f3732124997 --- /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: "1625239513" 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..458feb032eb1 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy.yaml @@ -0,0 +1,122 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotablebcqrkewuxnzia"}' + 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 15:25:13 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":"gotablebcqrkewuxnzia"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 02 Jul 2021 15:25:13 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablebcqrkewuxnzia') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 8bfd0f8b-1002-0092-6456-6f6ca3000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: + form: {} + headers: + Accept: + - application/xml + Authorization: + - sanitized + Content-Length: + - "39" + 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, 02 Jul 2021 15:25:13 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablebcqrkewuxnzia?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 02 Jul 2021 15:25:13 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8bfd100a-1002-0092-5d56-6f6ca3000000 + 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 15:25:13 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablebcqrkewuxnzia') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 02 Jul 2021 15:25:14 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 8bfd1052-1002-0092-2556-6f6ca3000000 + X-Ms-Version: + - "2019-02-02" + status: 204 No Content + code: 204 + duration: "" diff --git a/sdk/tables/aztable/table_access_policy.go b/sdk/tables/aztable/table_access_policy.go new file mode 100644 index 000000000000..a4874f7208e9 --- /dev/null +++ b/sdk/tables/aztable/table_access_policy.go @@ -0,0 +1,18 @@ +package aztable + +import "time" + +type TableAccessPolicy struct { + Start time.Time + Expiry time.Time + Permission string +} + +func castAccessPolicyToSignedIdentifier(accessPolicies []*AccessPolicy) []*SignedIdentifier { + ret := make([]*SignedIdentifier, 0) + + for _, accessPolicy := range accessPolicies { + ret = append(ret, &SignedIdentifier{AccessPolicy: accessPolicy}) + } + return ret +} 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..a29a206f30f3 --- /dev/null +++ b/sdk/tables/aztable/table_access_policy_test.go @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package aztable + +import ( + "time" + + "github.com/stretchr/testify/assert" +) + +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() + + now := time.Now() + expiration := now.Add(time.Duration(time.Hour * 1)) + permission := "rw" + + accessPolicies := make([]*AccessPolicy, 0) + accessPolicies = append(accessPolicies, &AccessPolicy{ + Expiry: &expiration, + Start: &now, + Permission: &permission, + }) + + _, err := client.SetAccessPolicy(ctx, accessPolicies) + assert.Nil(err, "Set access policy failed") +} + +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()) + // context := getTestContext(s.T().Name()) + client, delete := s.init(true) + defer delete() + + accessPolicies := make([]*AccessPolicy, 0) + + _, err := client.SetAccessPolicy(ctx, accessPolicies) + assert.Nil(err, "Set access policy failed") +} diff --git a/sdk/tables/aztable/table_client.go b/sdk/tables/aztable/table_client.go index 55e1490defa2..df3cf2052b00 100644 --- a/sdk/tables/aztable/table_client.go +++ b/sdk/tables/aztable/table_client.go @@ -132,3 +132,15 @@ 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, accessPolicies []*AccessPolicy) (TableSetAccessPolicyResponse, error) { + signedIdentifiers := castAccessPolicyToSignedIdentifier(accessPolicies) + response, err := t.client.SetAccessPolicy(ctx, t.Name, &TableSetAccessPolicyOptions{TableACL: signedIdentifiers}) + return response, err +} 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}}) From ce74ade23433494d01d2df32fc237f522c675ab8 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Fri, 2 Jul 2021 12:11:23 -0400 Subject: [PATCH 2/8] adding support for getting/setting access policies --- .../TestSetAccessPolicy-variables.yaml | 4 + .../TestSetEmptyAccessPolicy-variables.yaml | 4 + .../TestSetAccessPolicy-variables.yaml | 1 - .../TestSetAccessPolicy.yaml | 129 ------------------ .../TestSetEmptyAccessPolicy-variables.yaml | 2 +- .../TestSetEmptyAccessPolicy.yaml | 34 ++--- .../aztable/table_access_policy_test.go | 34 +++-- sdk/tables/aztable/table_client.go | 5 +- 8 files changed, 47 insertions(+), 166 deletions(-) create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetAccessPolicy-variables.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetEmptyAccessPolicy-variables.yaml delete mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml 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_Storage/TestSetAccessPolicy-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml index df7baedae6be..57d67241a73e 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml @@ -2,4 +2,3 @@ STORAGE_ENDPOINT_SUFFIX: core.windows.net TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== TABLES_STORAGE_ACCOUNT_NAME: seankaneprim -randomSeed: "1625239229" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml deleted file mode 100644 index d82ad862f7be..000000000000 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml +++ /dev/null @@ -1,129 +0,0 @@ ---- -version: 1 -interactions: -- request: - body: '{"TableName":"gotablezvn943r8v2n2f"}' - 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 15:20:29 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":"gotablezvn943r8v2n2f"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - Date: - - Fri, 02 Jul 2021 15:20:29 GMT - Location: - - https://seankaneprim.table.core.windows.net/Tables('gotablezvn943r8v2n2f') - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 6055a553-e002-00a9-3455-6f2907000000 - X-Ms-Version: - - "2019-02-02" - status: 201 Created - code: 201 - duration: "" -- request: - body: rw2021-07-02T12:20:30.0789136-04:002021-07-02T11:20:30.0789136-04:00 - form: {} - headers: - Accept: - - application/xml - Authorization: - - sanitized - Content-Length: - - "230" - 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, 02 Jul 2021 15:20:30 GMT - X-Ms-Version: - - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/gotablezvn943r8v2n2f?comp=acl - method: PUT - response: - body: |- - InvalidXmlDocumentXML specified is not syntactically valid. - RequestId:6055a58c-e002-00a9-6a55-6f2907000000 - Time:2021-07-02T15:20:30.1559981Z - headers: - Content-Length: - - "327" - Content-Type: - - application/xml - Date: - - Fri, 02 Jul 2021 15:20:29 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Error-Code: - - InvalidXmlDocument - X-Ms-Request-Id: - - 6055a58c-e002-00a9-6a55-6f2907000000 - 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, 02 Jul 2021 15:20:30 GMT - X-Ms-Version: - - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/Tables('gotablezvn943r8v2n2f') - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Fri, 02 Jul 2021 15:20:30 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 6055a5f4-e002-00a9-4b55-6f2907000000 - 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 index 4f3732124997..75da5d52f9a0 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy-variables.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy-variables.yaml @@ -2,4 +2,4 @@ STORAGE_ENDPOINT_SUFFIX: core.windows.net TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== TABLES_STORAGE_ACCOUNT_NAME: seankaneprim -randomSeed: "1625239513" +randomSeed: "1625242264" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy.yaml index 458feb032eb1..78cfefca3141 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetEmptyAccessPolicy.yaml @@ -2,7 +2,7 @@ version: 1 interactions: - request: - body: '{"TableName":"gotablebcqrkewuxnzia"}' + body: '{"TableName":"gotablemp92a68btv51b"}' form: {} headers: Accept: @@ -19,53 +19,49 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 15:25:13 GMT + - 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":"gotablebcqrkewuxnzia"}' + 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 15:25:13 GMT + - Fri, 02 Jul 2021 16:11:04 GMT Location: - - https://seankaneprim.table.core.windows.net/Tables('gotablebcqrkewuxnzia') + - 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: - - 8bfd0f8b-1002-0092-6456-6f6ca3000000 + - 6acd05cd-4002-006b-295c-6f6f81000000 X-Ms-Version: - "2019-02-02" status: 201 Created code: 201 duration: "" - request: - body: + body: "" form: {} headers: Accept: - application/xml Authorization: - sanitized - Content-Length: - - "39" - 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, 02 Jul 2021 15:25:13 GMT + - Fri, 02 Jul 2021 16:11:04 GMT X-Ms-Version: - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/gotablebcqrkewuxnzia?comp=acl + url: https://seankaneprim.table.core.windows.net/gotablemp92a68btv51b?comp=acl method: PUT response: body: "" @@ -73,11 +69,11 @@ interactions: Content-Length: - "0" Date: - - Fri, 02 Jul 2021 15:25:13 GMT + - Fri, 02 Jul 2021 16:11:04 GMT Server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 X-Ms-Request-Id: - - 8bfd100a-1002-0092-5d56-6f6ca3000000 + - 6acd0623-4002-006b-7c5c-6f6f81000000 X-Ms-Version: - "2019-02-02" status: 204 No Content @@ -95,10 +91,10 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 15:25:13 GMT + - Fri, 02 Jul 2021 16:11:05 GMT X-Ms-Version: - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/Tables('gotablebcqrkewuxnzia') + url: https://seankaneprim.table.core.windows.net/Tables('gotablemp92a68btv51b') method: DELETE response: body: "" @@ -108,13 +104,13 @@ interactions: Content-Length: - "0" Date: - - Fri, 02 Jul 2021 15:25:14 GMT + - 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: - - 8bfd1052-1002-0092-2556-6f6ca3000000 + - 6acd066d-4002-006b-405c-6f6f81000000 X-Ms-Version: - "2019-02-02" status: 204 No Content diff --git a/sdk/tables/aztable/table_access_policy_test.go b/sdk/tables/aztable/table_access_policy_test.go index a29a206f30f3..361dad7139b4 100644 --- a/sdk/tables/aztable/table_access_policy_test.go +++ b/sdk/tables/aztable/table_access_policy_test.go @@ -14,23 +14,34 @@ func (s *tableClientLiveTests) TestSetAccessPolicy() { s.T().Skip("TableAccessPolicies are not available on Cosmos Accounts") } + s.T().Skip("Skipping for now, Body of request needs to include ID") + assert := assert.New(s.T()) // context := getTestContext(s.T().Name()) client, delete := s.init(true) defer delete() - now := time.Now() - expiration := now.Add(time.Duration(time.Hour * 1)) - permission := "rw" + 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) - accessPolicies := make([]*AccessPolicy, 0) - accessPolicies = append(accessPolicies, &AccessPolicy{ - Expiry: &expiration, - Start: &now, - Permission: &permission, + signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ + AccessPolicy: &AccessPolicy{ + Expiry: &expiration, + Start: &start, + Permission: &permission, + }, + ID: &id, }) - _, err := client.SetAccessPolicy(ctx, accessPolicies) + param := TableSetAccessPolicyOptions{ + TableACL: signedIdentifiers, + } + + _, err := client.SetAccessPolicy(ctx, ¶m) assert.Nil(err, "Set access policy failed") } @@ -40,12 +51,9 @@ func (s *tableClientLiveTests) TestSetEmptyAccessPolicy() { } assert := assert.New(s.T()) - // context := getTestContext(s.T().Name()) client, delete := s.init(true) defer delete() - accessPolicies := make([]*AccessPolicy, 0) - - _, err := client.SetAccessPolicy(ctx, accessPolicies) + _, err := client.SetAccessPolicy(ctx, &TableSetAccessPolicyOptions{}) assert.Nil(err, "Set access policy failed") } diff --git a/sdk/tables/aztable/table_client.go b/sdk/tables/aztable/table_client.go index df3cf2052b00..8e5606399fcd 100644 --- a/sdk/tables/aztable/table_client.go +++ b/sdk/tables/aztable/table_client.go @@ -139,8 +139,7 @@ func (t *TableClient) GetAccessPolicy(ctx context.Context) (SignedIdentifierArra } // SetAccessPolicy sets stored access policies for the table that may be used with SharedAccessSignature -func (t *TableClient) SetAccessPolicy(ctx context.Context, accessPolicies []*AccessPolicy) (TableSetAccessPolicyResponse, error) { - signedIdentifiers := castAccessPolicyToSignedIdentifier(accessPolicies) - response, err := t.client.SetAccessPolicy(ctx, t.Name, &TableSetAccessPolicyOptions{TableACL: signedIdentifiers}) +func (t *TableClient) SetAccessPolicy(ctx context.Context, options *TableSetAccessPolicyOptions) (TableSetAccessPolicyResponse, error) { + response, err := t.client.SetAccessPolicy(ctx, t.Name, options) return response, err } From 16bcdaf13b1a7e0d66d69dbb8e8598e201c51973 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Fri, 2 Jul 2021 12:48:57 -0400 Subject: [PATCH 3/8] tests working --- ...stSetMultipleAccessPolicies-variables.yaml | 4 + ...TestSetMultipleAccessPolicy-variables.yaml | 4 + ...estSetTooManyAccessPolicies-variables.yaml | 4 + .../TestSetAccessPolicy-variables.yaml | 1 + .../TestSetAccessPolicy.yaml | 122 ++++++++++++++++++ ...estSetTooManyAccessPolicies-variables.yaml | 5 + .../TestSetTooManyAccessPolicies.yaml | 47 +++++++ sdk/tables/aztable/table_access_policy.go | 1 + .../aztable/table_access_policy_test.go | 100 +++++++++++++- 9 files changed, 285 insertions(+), 3 deletions(-) create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetMultipleAccessPolicies-variables.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetMultipleAccessPolicy-variables.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetTooManyAccessPolicies-variables.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies-variables.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml 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/TestSetMultipleAccessPolicy-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetMultipleAccessPolicy-variables.yaml new file mode 100644 index 000000000000..4944bc270a8f --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetMultipleAccessPolicy-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 index 57d67241a73e..b27f9ce13bef 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml @@ -2,3 +2,4 @@ STORAGE_ENDPOINT_SUFFIX: core.windows.net TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== TABLES_STORAGE_ACCOUNT_NAME: seankaneprim +randomSeed: "1625244086" 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..0913b86084c1 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml @@ -0,0 +1,122 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotable3al01usrtv68f"}' + 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:41:26 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":"gotable3al01usrtv68f"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 02 Jul 2021 16:41:26 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotable3al01usrtv68f') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 2c372cf6-9002-0035-3061-6f8461000000 + 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, 02 Jul 2021 16:41:27 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotable3al01usrtv68f?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 02 Jul 2021 16:41:26 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 2c372d45-9002-0035-7c61-6f8461000000 + 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:41:27 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotable3al01usrtv68f') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 02 Jul 2021 16:41:26 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 2c372d92-9002-0035-4861-6f8461000000 + 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..8b9e27ceb54f --- /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: "1625244087" 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..731b5a68384d --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml @@ -0,0 +1,47 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotable3cdz8jxllhlrx"}' + 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:41:27 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables + method: POST + response: + body: '{"odata.error":{"code":"TableBeingDeleted","message":{"lang":"en-US","value":"The + specified table is being deleted. Try operation later.\nRequestId:2c372f12-9002-0035-3f61-6f8461000000\nTime:2021-07-02T16:41:27.9766306Z"}}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 02 Jul 2021 16:41:27 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 2c372f12-9002-0035-3f61-6f8461000000 + X-Ms-Version: + - "2019-02-02" + status: 409 Conflict + code: 409 + duration: "" diff --git a/sdk/tables/aztable/table_access_policy.go b/sdk/tables/aztable/table_access_policy.go index a4874f7208e9..bdd0215b53a9 100644 --- a/sdk/tables/aztable/table_access_policy.go +++ b/sdk/tables/aztable/table_access_policy.go @@ -14,5 +14,6 @@ func castAccessPolicyToSignedIdentifier(accessPolicies []*AccessPolicy) []*Signe for _, accessPolicy := range accessPolicies { ret = append(ret, &SignedIdentifier{AccessPolicy: accessPolicy}) } + return ret } diff --git a/sdk/tables/aztable/table_access_policy_test.go b/sdk/tables/aztable/table_access_policy_test.go index 361dad7139b4..7abcb6ec24df 100644 --- a/sdk/tables/aztable/table_access_policy_test.go +++ b/sdk/tables/aztable/table_access_policy_test.go @@ -4,17 +4,63 @@ 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") } - s.T().Skip("Skipping for now, Body of request needs to include ID") + 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()) // context := getTestContext(s.T().Name()) @@ -37,23 +83,71 @@ func (s *tableClientLiveTests) TestSetAccessPolicy() { ID: &id, }) + expiration = time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) + permission = "rw" + id = "2" + + 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") + + // 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), 2) } -func (s *tableClientLiveTests) TestSetEmptyAccessPolicy() { +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() - _, err := client.SetAccessPolicy(ctx, &TableSetAccessPolicyOptions{}) + 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.Nil(err, "Set access policy failed") + + // Make a Get to assert two access policies + _, err = client.GetAccessPolicy(ctx) + assert.NotNil(err) + // assert.Nil(err, "Get Access Policy failed") + // assert.Equal(len(resp.SignedIdentifiers), 2) } From f4a44dbd708544d7810354a553e70e3923cdf087 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Fri, 2 Jul 2021 13:01:14 -0400 Subject: [PATCH 4/8] does not work for multiple access policies --- ...stSetMultipleAccessPolicies-variables.yaml | 5 + .../TestSetMultipleAccessPolicies.yaml | 162 ++++++++++++++++++ .../aztable/table_access_policy_test.go | 14 +- 3 files changed, 174 insertions(+), 7 deletions(-) create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies-variables.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies.yaml 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..cf1eb2c36ef1 --- /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: "1625244989" 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..fead2d7e5497 --- /dev/null +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies.yaml @@ -0,0 +1,162 @@ +--- +version: 1 +interactions: +- request: + body: '{"TableName":"gotablejmrpbulv642or"}' + 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:56:29 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":"gotablejmrpbulv642or"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 02 Jul 2021 16:56:29 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablejmrpbulv642or') + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - cf86799c-2002-0089-0263-6f52a0000000 + X-Ms-Version: + - "2019-02-02" + status: 201 Created + code: 201 + duration: "" +- request: + body: r2024-01-01T00:00:00Z2020-01-01T00:00:00Z1rw2025-01-01T00:00:00Z2020-01-01T00:00:00Z2 + form: {} + headers: + Accept: + - application/xml + Authorization: + - sanitized + Content-Length: + - "388" + 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, 02 Jul 2021 16:56:29 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablejmrpbulv642or?comp=acl + method: PUT + response: + body: |- + InvalidXmlDocumentXML specified is not syntactically valid. + RequestId:cf8679f2-2002-0089-5063-6f52a0000000 + Time:2021-07-02T16:56:29.8374293Z + headers: + Content-Length: + - "327" + Content-Type: + - application/xml + Date: + - Fri, 02 Jul 2021 16:56:29 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Error-Code: + - InvalidXmlDocument + X-Ms-Request-Id: + - cf8679f2-2002-0089-5063-6f52a0000000 + X-Ms-Version: + - "2019-02-02" + status: 400 XML specified is not syntactically valid. + code: 400 + 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:56:29 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablejmrpbulv642or?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\x20\x2F\x3E" + headers: + Content-Type: + - application/xml + Date: + - Fri, 02 Jul 2021 16:56:29 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - cf867a3c-2002-0089-1a63-6f52a0000000 + 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, 02 Jul 2021 16:56:29 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablejmrpbulv642or') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 02 Jul 2021 16:56:29 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - cf867a82-2002-0089-5663-6f52a0000000 + 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 index 7abcb6ec24df..3b39471c94ea 100644 --- a/sdk/tables/aztable/table_access_policy_test.go +++ b/sdk/tables/aztable/table_access_policy_test.go @@ -75,25 +75,25 @@ func (s *tableClientLiveTests) TestSetMultipleAccessPolicies() { signedIdentifiers := make([]*SignedIdentifier, 0) signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ + ID: &id, AccessPolicy: &AccessPolicy{ Expiry: &expiration, Start: &start, Permission: &permission, }, - ID: &id, }) - expiration = time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) - permission = "rw" - id = "2" + expiration2 := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) + permission2 := "rw" + id2 := "2" signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ + ID: &id2, AccessPolicy: &AccessPolicy{ - Expiry: &expiration, + Expiry: &expiration2, Start: &start, - Permission: &permission, + Permission: &permission2, }, - ID: &id, }) param := TableSetAccessPolicyOptions{ From 839975c1be0cbd60d98f404cfded2da2bf479925 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Fri, 2 Jul 2021 13:23:08 -0400 Subject: [PATCH 5/8] adding post validation --- ...estSetTooManyAccessPolicies-variables.yaml | 2 +- .../TestSetTooManyAccessPolicies.yaml | 98 +++++++++++++++++-- .../aztable/table_access_policy_test.go | 10 +- sdk/tables/aztable/table_client.go | 3 + 4 files changed, 97 insertions(+), 16 deletions(-) diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies-variables.yaml index 8b9e27ceb54f..ad5473b76495 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies-variables.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies-variables.yaml @@ -2,4 +2,4 @@ STORAGE_ENDPOINT_SUFFIX: core.windows.net TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== TABLES_STORAGE_ACCOUNT_NAME: seankaneprim -randomSeed: "1625244087" +randomSeed: "1625245373" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml index 731b5a68384d..08ddbc3c82ec 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml @@ -2,7 +2,7 @@ version: 1 interactions: - request: - body: '{"TableName":"gotable3cdz8jxllhlrx"}' + body: '{"TableName":"gotablek44he1q6rgunh"}' form: {} headers: Accept: @@ -19,29 +19,111 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 16:41:27 GMT + - Fri, 02 Jul 2021 17:02:53 GMT X-Ms-Version: - "2019-02-02" url: https://seankaneprim.table.core.windows.net/Tables method: POST response: - body: '{"odata.error":{"code":"TableBeingDeleted","message":{"lang":"en-US","value":"The - specified table is being deleted. Try operation later.\nRequestId:2c372f12-9002-0035-3f61-6f8461000000\nTime:2021-07-02T16:41:27.9766306Z"}}}' + body: '{"odata.metadata":"https://seankaneprim.table.core.windows.net/$metadata#Tables/@Element","TableName":"gotablek44he1q6rgunh"}' headers: Cache-Control: - no-cache Content-Type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 Date: - - Fri, 02 Jul 2021 16:41:27 GMT + - Fri, 02 Jul 2021 17:02:53 GMT + Location: + - https://seankaneprim.table.core.windows.net/Tables('gotablek44he1q6rgunh') Server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 X-Content-Type-Options: - nosniff X-Ms-Request-Id: - - 2c372f12-9002-0035-3f61-6f8461000000 + - 6ae78084-4002-006b-1564-6f6f81000000 X-Ms-Version: - "2019-02-02" - status: 409 Conflict - code: 409 + 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, 02 Jul 2021 17:02:54 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/gotablek44he1q6rgunh?comp=acl + method: PUT + response: + body: |- + InvalidXmlDocumentXML specified is not syntactically valid. + RequestId:6ae780ae-4002-006b-3864-6f6f81000000 + Time:2021-07-02T17:02:54.4477447Z + headers: + Content-Length: + - "327" + Content-Type: + - application/xml + Date: + - Fri, 02 Jul 2021 17:02:53 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Error-Code: + - InvalidXmlDocument + X-Ms-Request-Id: + - 6ae780ae-4002-006b-3864-6f6f81000000 + 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, 02 Jul 2021 17:02:54 GMT + X-Ms-Version: + - "2019-02-02" + url: https://seankaneprim.table.core.windows.net/Tables('gotablek44he1q6rgunh') + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 02 Jul 2021 17:02:53 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 6ae780d7-4002-006b-5f64-6f6f81000000 + 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 index 3b39471c94ea..6a031045b413 100644 --- a/sdk/tables/aztable/table_access_policy_test.go +++ b/sdk/tables/aztable/table_access_policy_test.go @@ -143,11 +143,7 @@ func (s *tableClientLiveTests) TestSetTooManyAccessPolicies() { param := TableSetAccessPolicyOptions{TableACL: signedIdentifiers} _, err := client.SetAccessPolicy(ctx, ¶m) - assert.Nil(err, "Set access policy failed") - - // Make a Get to assert two access policies - _, err = client.GetAccessPolicy(ctx) - assert.NotNil(err) - // assert.Nil(err, "Get Access Policy failed") - // assert.Equal(len(resp.SignedIdentifiers), 2) + assert.NotNil(err, "Set access policy succeeded but should have failed") + assert.Contains(err.Error(), "InvalidXmlDocument") + // TODO: Should we add post-validation that only 5 access policies can be set at a time? } diff --git a/sdk/tables/aztable/table_client.go b/sdk/tables/aztable/table_client.go index 8e5606399fcd..79574070c068 100644 --- a/sdk/tables/aztable/table_client.go +++ b/sdk/tables/aztable/table_client.go @@ -141,5 +141,8 @@ func (t *TableClient) GetAccessPolicy(ctx context.Context) (SignedIdentifierArra // 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 = errors.New("You cannot set more than five (5) access policies at a time.") + } return response, err } From 9a213fef87945b3ab8cf9890b77d90b7c4c047c7 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Fri, 2 Jul 2021 13:31:13 -0400 Subject: [PATCH 6/8] added error validation, note about possible issue --- sdk/tables/aztable/table_access_policy_test.go | 3 ++- sdk/tables/aztable/table_client.go | 2 +- sdk/tables/aztable/zc_table_constants.go | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/tables/aztable/table_access_policy_test.go b/sdk/tables/aztable/table_access_policy_test.go index 6a031045b413..e3ccf1f940cf 100644 --- a/sdk/tables/aztable/table_access_policy_test.go +++ b/sdk/tables/aztable/table_access_policy_test.go @@ -58,6 +58,7 @@ func (s *tableClientLiveTests) TestSetAccessPolicy() { } func (s *tableClientLiveTests) TestSetMultipleAccessPolicies() { + // TODO: I think what's wrong here is the XML is formatted wrong, should be before . This only throws if there's multiple if _, ok := cosmosTestsMap[s.T().Name()]; ok { s.T().Skip("TableAccessPolicies are not available on Cosmos Accounts") } @@ -144,6 +145,6 @@ func (s *tableClientLiveTests) TestSetTooManyAccessPolicies() { _, err := client.SetAccessPolicy(ctx, ¶m) assert.NotNil(err, "Set access policy succeeded but should have failed") - assert.Contains(err.Error(), "InvalidXmlDocument") + assert.Contains(err.Error(), tooManyAccessPoliciesError.Error()) // TODO: Should we add post-validation that only 5 access policies can be set at a time? } diff --git a/sdk/tables/aztable/table_client.go b/sdk/tables/aztable/table_client.go index 7b11762bc4bd..55da4ba7c9b1 100644 --- a/sdk/tables/aztable/table_client.go +++ b/sdk/tables/aztable/table_client.go @@ -143,7 +143,7 @@ func (t *TableClient) GetAccessPolicy(ctx context.Context) (SignedIdentifierArra 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 = errors.New("You cannot set more than five (5) access policies at a time.") + 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.") From 14d0a48ec39ff85673c2f794cb32c407d33baacc Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Fri, 9 Jul 2021 13:00:11 -0400 Subject: [PATCH 7/8] set policy works --- ...=> TestSetNullAccessPolicy-variables.yaml} | 0 .../TestSetAccessPolicy-variables.yaml | 2 +- .../TestSetAccessPolicy.yaml | 28 ++-- ...stSetMultipleAccessPolicies-variables.yaml | 2 +- .../TestSetMultipleAccessPolicies.yaml | 57 +++---- .../TestSetNullAccessPolicy-variables.yaml | 5 + .../TestSetNullAccessPolicy.yaml | 155 ++++++++++++++++++ ...estSetTooManyAccessPolicies-variables.yaml | 2 +- .../TestSetTooManyAccessPolicies.yaml | 32 ++-- .../aztable/table_access_policy_test.go | 69 +++++--- 10 files changed, 268 insertions(+), 84 deletions(-) rename sdk/tables/aztable/recordings/TestTableClient_Cosmos/{TestSetMultipleAccessPolicy-variables.yaml => TestSetNullAccessPolicy-variables.yaml} (100%) create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetNullAccessPolicy-variables.yaml create mode 100644 sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetNullAccessPolicy.yaml diff --git a/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetMultipleAccessPolicy-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetNullAccessPolicy-variables.yaml similarity index 100% rename from sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetMultipleAccessPolicy-variables.yaml rename to sdk/tables/aztable/recordings/TestTableClient_Cosmos/TestSetNullAccessPolicy-variables.yaml diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml index b27f9ce13bef..f41dcb551e19 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy-variables.yaml @@ -2,4 +2,4 @@ STORAGE_ENDPOINT_SUFFIX: core.windows.net TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== TABLES_STORAGE_ACCOUNT_NAME: seankaneprim -randomSeed: "1625244086" +randomSeed: "1625849358" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml index 0913b86084c1..370066baf737 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetAccessPolicy.yaml @@ -2,7 +2,7 @@ version: 1 interactions: - request: - body: '{"TableName":"gotable3al01usrtv68f"}' + body: '{"TableName":"gotable0qolgueqbqo8m"}' form: {} headers: Accept: @@ -19,28 +19,28 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 16:41:26 GMT + - 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":"gotable3al01usrtv68f"}' + 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, 02 Jul 2021 16:41:26 GMT + - Fri, 09 Jul 2021 16:49:18 GMT Location: - - https://seankaneprim.table.core.windows.net/Tables('gotable3al01usrtv68f') + - 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: - - 2c372cf6-9002-0035-3061-6f8461000000 + - 77af8ed1-c002-0081-0ce2-7448af000000 X-Ms-Version: - "2019-02-02" status: 201 Created @@ -62,10 +62,10 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 16:41:27 GMT + - Fri, 09 Jul 2021 16:49:19 GMT X-Ms-Version: - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/gotable3al01usrtv68f?comp=acl + url: https://seankaneprim.table.core.windows.net/gotable0qolgueqbqo8m?comp=acl method: PUT response: body: "" @@ -73,11 +73,11 @@ interactions: Content-Length: - "0" Date: - - Fri, 02 Jul 2021 16:41:26 GMT + - Fri, 09 Jul 2021 16:49:18 GMT Server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 X-Ms-Request-Id: - - 2c372d45-9002-0035-7c61-6f8461000000 + - 77af8f20-c002-0081-58e2-7448af000000 X-Ms-Version: - "2019-02-02" status: 204 No Content @@ -95,10 +95,10 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 16:41:27 GMT + - Fri, 09 Jul 2021 16:49:19 GMT X-Ms-Version: - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/Tables('gotable3al01usrtv68f') + url: https://seankaneprim.table.core.windows.net/Tables('gotable0qolgueqbqo8m') method: DELETE response: body: "" @@ -108,13 +108,13 @@ interactions: Content-Length: - "0" Date: - - Fri, 02 Jul 2021 16:41:26 GMT + - 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: - - 2c372d92-9002-0035-4861-6f8461000000 + - 77af8f95-c002-0081-4ae2-7448af000000 X-Ms-Version: - "2019-02-02" status: 204 No Content diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies-variables.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies-variables.yaml index cf1eb2c36ef1..546d40d8997e 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies-variables.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies-variables.yaml @@ -2,4 +2,4 @@ STORAGE_ENDPOINT_SUFFIX: core.windows.net TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== TABLES_STORAGE_ACCOUNT_NAME: seankaneprim -randomSeed: "1625244989" +randomSeed: "1625849315" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies.yaml index fead2d7e5497..84feff7b92a6 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetMultipleAccessPolicies.yaml @@ -2,7 +2,7 @@ version: 1 interactions: - request: - body: '{"TableName":"gotablejmrpbulv642or"}' + body: '{"TableName":"gotable4rpn1oqouhbus"}' form: {} headers: Accept: @@ -19,35 +19,35 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 16:56:29 GMT + - 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":"gotablejmrpbulv642or"}' + 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, 02 Jul 2021 16:56:29 GMT + - Fri, 09 Jul 2021 16:48:34 GMT Location: - - https://seankaneprim.table.core.windows.net/Tables('gotablejmrpbulv642or') + - 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: - - cf86799c-2002-0089-0263-6f52a0000000 + - eeaea336-1002-0014-1be2-74a01a000000 X-Ms-Version: - "2019-02-02" status: 201 Created code: 201 duration: "" - request: - body: r2024-01-01T00:00:00Z2020-01-01T00:00:00Z1rw2025-01-01T00:00:00Z2020-01-01T00:00:00Z2 + body: emptyrpartialr2021-06-08T02:10:09Z2021-06-08T02:10:09Zfull form: {} headers: Accept: @@ -55,40 +55,33 @@ interactions: Authorization: - sanitized Content-Length: - - "388" + - "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, 02 Jul 2021 16:56:29 GMT + - Fri, 09 Jul 2021 16:48:35 GMT X-Ms-Version: - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/gotablejmrpbulv642or?comp=acl + url: https://seankaneprim.table.core.windows.net/gotable4rpn1oqouhbus?comp=acl method: PUT response: - body: |- - InvalidXmlDocumentXML specified is not syntactically valid. - RequestId:cf8679f2-2002-0089-5063-6f52a0000000 - Time:2021-07-02T16:56:29.8374293Z + body: "" headers: Content-Length: - - "327" - Content-Type: - - application/xml + - "0" Date: - - Fri, 02 Jul 2021 16:56:29 GMT + - Fri, 09 Jul 2021 16:48:34 GMT Server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Error-Code: - - InvalidXmlDocument X-Ms-Request-Id: - - cf8679f2-2002-0089-5063-6f52a0000000 + - eeaea364-1002-0014-47e2-74a01a000000 X-Ms-Version: - "2019-02-02" - status: 400 XML specified is not syntactically valid. - code: 400 + status: 204 No Content + code: 204 duration: "" - request: body: "" @@ -102,22 +95,22 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 16:56:29 GMT + - Fri, 09 Jul 2021 16:48:36 GMT X-Ms-Version: - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/gotablejmrpbulv642or?comp=acl + 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\x20\x2F\x3E" + 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, 02 Jul 2021 16:56:29 GMT + - Fri, 09 Jul 2021 16:48:35 GMT Server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 X-Ms-Request-Id: - - cf867a3c-2002-0089-1a63-6f52a0000000 + - eeaea3c2-1002-0014-24e2-74a01a000000 X-Ms-Version: - "2019-02-02" status: 200 OK @@ -135,10 +128,10 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 16:56:29 GMT + - Fri, 09 Jul 2021 16:48:36 GMT X-Ms-Version: - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/Tables('gotablejmrpbulv642or') + url: https://seankaneprim.table.core.windows.net/Tables('gotable4rpn1oqouhbus') method: DELETE response: body: "" @@ -148,13 +141,13 @@ interactions: Content-Length: - "0" Date: - - Fri, 02 Jul 2021 16:56:29 GMT + - 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: - - cf867a82-2002-0089-5663-6f52a0000000 + - eeaea417-1002-0014-77e2-74a01a000000 X-Ms-Version: - "2019-02-02" status: 204 No Content 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 index ad5473b76495..f429532bb617 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies-variables.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies-variables.yaml @@ -2,4 +2,4 @@ STORAGE_ENDPOINT_SUFFIX: core.windows.net TABLES_PRIMARY_STORAGE_ACCOUNT_KEY: Kg== TABLES_STORAGE_ACCOUNT_NAME: seankaneprim -randomSeed: "1625245373" +randomSeed: "1625849388" diff --git a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml index 08ddbc3c82ec..22521cfec224 100644 --- a/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml +++ b/sdk/tables/aztable/recordings/TestTableClient_Storage/TestSetTooManyAccessPolicies.yaml @@ -2,7 +2,7 @@ version: 1 interactions: - request: - body: '{"TableName":"gotablek44he1q6rgunh"}' + body: '{"TableName":"gotableal7ltzl6kugfg"}' form: {} headers: Accept: @@ -19,28 +19,28 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 17:02:53 GMT + - 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":"gotablek44he1q6rgunh"}' + 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, 02 Jul 2021 17:02:53 GMT + - Fri, 09 Jul 2021 16:49:48 GMT Location: - - https://seankaneprim.table.core.windows.net/Tables('gotablek44he1q6rgunh') + - 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: - - 6ae78084-4002-006b-1564-6f6f81000000 + - 86dd59fb-e002-0086-56e2-7424cc000000 X-Ms-Version: - "2019-02-02" status: 201 Created @@ -62,29 +62,29 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 17:02:54 GMT + - Fri, 09 Jul 2021 16:49:49 GMT X-Ms-Version: - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/gotablek44he1q6rgunh?comp=acl + url: https://seankaneprim.table.core.windows.net/gotableal7ltzl6kugfg?comp=acl method: PUT response: body: |- InvalidXmlDocumentXML specified is not syntactically valid. - RequestId:6ae780ae-4002-006b-3864-6f6f81000000 - Time:2021-07-02T17:02:54.4477447Z + RequestId:86dd5a4e-e002-0086-23e2-7424cc000000 + Time:2021-07-09T16:49:48.6605382Z headers: Content-Length: - "327" Content-Type: - application/xml Date: - - Fri, 02 Jul 2021 17:02:53 GMT + - 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: - - 6ae780ae-4002-006b-3864-6f6f81000000 + - 86dd5a4e-e002-0086-23e2-7424cc000000 X-Ms-Version: - "2019-02-02" status: 400 XML specified is not syntactically valid. @@ -102,10 +102,10 @@ interactions: - azsdk-go-aztable/ azsdk-go-aztable/ azcore/v0.16.2 (go1.16.5; Windows_NT) X-Ms-Date: - - Fri, 02 Jul 2021 17:02:54 GMT + - Fri, 09 Jul 2021 16:49:49 GMT X-Ms-Version: - "2019-02-02" - url: https://seankaneprim.table.core.windows.net/Tables('gotablek44he1q6rgunh') + url: https://seankaneprim.table.core.windows.net/Tables('gotableal7ltzl6kugfg') method: DELETE response: body: "" @@ -115,13 +115,13 @@ interactions: Content-Length: - "0" Date: - - Fri, 02 Jul 2021 17:02:53 GMT + - 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: - - 6ae780d7-4002-006b-5f64-6f6f81000000 + - 86dd5a85-e002-0086-57e2-7424cc000000 X-Ms-Version: - "2019-02-02" status: 204 No Content diff --git a/sdk/tables/aztable/table_access_policy_test.go b/sdk/tables/aztable/table_access_policy_test.go index e3ccf1f940cf..d5b9813725f1 100644 --- a/sdk/tables/aztable/table_access_policy_test.go +++ b/sdk/tables/aztable/table_access_policy_test.go @@ -58,42 +58,42 @@ func (s *tableClientLiveTests) TestSetAccessPolicy() { } func (s *tableClientLiveTests) TestSetMultipleAccessPolicies() { - // TODO: I think what's wrong here is the XML is formatted wrong, should be before . This only throws if there's multiple 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" + id := "empty" signedIdentifiers := make([]*SignedIdentifier, 0) - signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ ID: &id, + }) + + permission2 := "r" + id2 := "partial" + + signedIdentifiers = append(signedIdentifiers, &SignedIdentifier{ + ID: &id2, AccessPolicy: &AccessPolicy{ - Expiry: &expiration, - Start: &start, - Permission: &permission, + Permission: &permission2, }, }) - expiration2 := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) - permission2 := "rw" - id2 := "2" + 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: &id2, + ID: &id3, AccessPolicy: &AccessPolicy{ - Expiry: &expiration2, Start: &start, - Permission: &permission2, + Expiry: &expiry, + Permission: &permission3, }, }) @@ -102,12 +102,14 @@ func (s *tableClientLiveTests) TestSetMultipleAccessPolicies() { } _, err := client.SetAccessPolicy(ctx, ¶m) - assert.Nil(err, "Set access policy failed") + 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), 2) + assert.Equal(len(resp.SignedIdentifiers), 3) } func (s *tableClientLiveTests) TestSetTooManyAccessPolicies() { @@ -146,5 +148,34 @@ func (s *tableClientLiveTests) TestSetTooManyAccessPolicies() { _, err := client.SetAccessPolicy(ctx, ¶m) assert.NotNil(err, "Set access policy succeeded but should have failed") assert.Contains(err.Error(), tooManyAccessPoliciesError.Error()) - // TODO: Should we add post-validation that only 5 access policies can be set at a time? +} + +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) } From 47d30d4f8842ed3bf290c2b78053797531e9a101 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Fri, 9 Jul 2021 13:12:22 -0400 Subject: [PATCH 8/8] removing table access policy file --- sdk/tables/aztable/table_access_policy.go | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 sdk/tables/aztable/table_access_policy.go diff --git a/sdk/tables/aztable/table_access_policy.go b/sdk/tables/aztable/table_access_policy.go deleted file mode 100644 index bdd0215b53a9..000000000000 --- a/sdk/tables/aztable/table_access_policy.go +++ /dev/null @@ -1,19 +0,0 @@ -package aztable - -import "time" - -type TableAccessPolicy struct { - Start time.Time - Expiry time.Time - Permission string -} - -func castAccessPolicyToSignedIdentifier(accessPolicies []*AccessPolicy) []*SignedIdentifier { - ret := make([]*SignedIdentifier, 0) - - for _, accessPolicy := range accessPolicies { - ret = append(ret, &SignedIdentifier{AccessPolicy: accessPolicy}) - } - - return ret -}