Skip to content

Commit 3841461

Browse files
Storage STG94 features (Azure#23367)
* [Storage] Swagger update for STG 94 (Azure#23236) * Update swagger to stg94 - azblob and azfiles * service version update * datalake code generated * remove extra line from autorest transform * datalake generated code * datalake generated code * datalake generated code * storage bearer challenge for azqueue * Revert "storage bearer challenge for azqueue" This reverts commit 655211f. * Added AuthenticationErrorDetail test * error check * get error from file error * reverted change * Revert "Added AuthenticationErrorDetail test" (Azure#23316) This reverts commit bdf95c4. * Added AuthenticationErrorDetail (Azure#23310) * Added AuthenticationErrorDetail test * error check * corrected file error code * [Storage] Support latest service version in Queue, propagate StorageBearer Challenge to queues (Azure#23311) * Revert "[Storage] Swagger update for STG 94 (Azure#23236)" This reverts commit 7d70d0f. * Revert "storage bearer challenge for azqueue" This reverts commit 655211f. * Reapply "[Storage] Swagger update for STG 94 (Azure#23236)" This reverts commit 5050c0c. * Reapply "storage bearer challenge for azqueue" This reverts commit 6d6123a. * added challenge_policy_test.go (Azure#23317) * Add custom audience test * update queue_client_test.go test * review comments address by using type alias * NFS share snapshot (Azure#23359) * nfs snapshot changes * added new string to sign algorithm * azblob - new stringtosign algorithm * azdatalake - new string to sign algorithm * azfile recordings * linter errors resolve * linter error * comments resolve, add a new test and recording * refactor azdatalake and azblob acc to comments * update dependencies * changelog updates
1 parent 72d79eb commit 3841461

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1152
-332
lines changed

sdk/storage/azblob/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
## 1.4.1 (Unreleased)
44

55
### Features Added
6+
* Upgraded service version to `2024-08-04`.
67

78
### Breaking Changes
89

910
### Bugs Fixed
1011

1112
### Other Changes
13+
* Updated `azcore` version to `1.14.0`
1214

1315
## 1.4.0 (2024-07-18)
1416

sdk/storage/azblob/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/storage/azblob
33
go 1.18
44

55
require (
6-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0
6+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0
77
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
88
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0
99
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.6.0

sdk/storage/azblob/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww=
2-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0=
1+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 h1:nyQWyZvwGTvunIMxi1Y9uXkcyr+I7TeNrr/foo4Kpk8=
2+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0=
33
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc=
44
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg=
55
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY=

sdk/storage/azblob/internal/exported/shared_key_credential.go

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,85 @@ func getHeader(key string, headers map[string][]string) string {
109109
return ""
110110
}
111111

112+
func getWeightTables() [][]int {
113+
tableLv0 := [...]int{
114+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
115+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
116+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x71c, 0x0, 0x71f, 0x721, 0x723, 0x725,
117+
0x0, 0x0, 0x0, 0x72d, 0x803, 0x0, 0x0, 0x733, 0x0, 0xd03, 0xd1a, 0xd1c, 0xd1e,
118+
0xd20, 0xd22, 0xd24, 0xd26, 0xd28, 0xd2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
119+
0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51,
120+
0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9,
121+
0x0, 0x0, 0x0, 0x743, 0x744, 0x748, 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25,
122+
0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99,
123+
0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x74c, 0x0, 0x750, 0x0,
124+
}
125+
tableLv2 := [...]int{
126+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
127+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
128+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8212, 0x0, 0x0,
129+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
130+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
131+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
132+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
133+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
134+
}
135+
tables := [][]int{tableLv0[:], tableLv2[:]}
136+
return tables
137+
}
138+
139+
// NewHeaderStringComparer performs a multi-level, weight-based comparison of two strings
140+
func compareHeaders(lhs, rhs string, tables [][]int) int {
141+
currLevel, i, j := 0, 0, 0
142+
n := len(tables)
143+
lhsLen := len(lhs)
144+
rhsLen := len(rhs)
145+
146+
for currLevel < n {
147+
if currLevel == (n-1) && i != j {
148+
if i > j {
149+
return -1
150+
}
151+
if i < j {
152+
return 1
153+
}
154+
return 0
155+
}
156+
157+
w1 := tables[currLevel][lhs[i]]
158+
if i >= lhsLen {
159+
w1 = 0x1
160+
}
161+
162+
w2 := tables[currLevel][rhs[j]]
163+
if j >= rhsLen {
164+
w2 = 0x1
165+
}
166+
167+
if w1 == 0x1 && w2 == 0x1 {
168+
i = 0
169+
j = 0
170+
currLevel++
171+
} else if w1 == w2 {
172+
i++
173+
j++
174+
} else if w1 == 0 {
175+
i++
176+
} else if w2 == 0 {
177+
j++
178+
} else {
179+
if w1 < w2 {
180+
return -1
181+
}
182+
if w1 > w2 {
183+
return 1
184+
}
185+
return 0
186+
}
187+
}
188+
return 0
189+
}
190+
112191
func (c *SharedKeyCredential) buildCanonicalizedHeader(headers http.Header) string {
113192
cm := map[string][]string{}
114193
for k, v := range headers {
@@ -125,7 +204,11 @@ func (c *SharedKeyCredential) buildCanonicalizedHeader(headers http.Header) stri
125204
for key := range cm {
126205
keys = append(keys, key)
127206
}
128-
sort.Strings(keys)
207+
tables := getWeightTables()
208+
// Sort the keys using the custom comparator
209+
sort.Slice(keys, func(i, j int) bool {
210+
return compareHeaders(keys[i], keys[j], tables) < 0
211+
})
129212
ch := bytes.NewBufferString("")
130213
for i, key := range keys {
131214
if i > 0 {

sdk/storage/azblob/internal/generated/autorest.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ go: true
77
clear-output-folder: false
88
version: "^3.0.0"
99
license-header: MICROSOFT_MIT_NO_VERSION
10-
input-file: "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a32d0b2423d19835246bb2ef92941503bfd5e734/specification/storage/data-plane/Microsoft.BlobStorage/preview/2021-12-02/blob.json"
10+
input-file: "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f6f50c6388fd5836fa142384641b8353a99874ef/specification/storage/data-plane/Microsoft.BlobStorage/stable/2024-08-04/blob.json"
1111
credential-scope: "https://storage.azure.com/.default"
1212
output-folder: ../generated
1313
file-prefix: "zz_"
@@ -22,7 +22,7 @@ export-clients: true
2222
use: "@autorest/[email protected]"
2323
```
2424
25-
### Updating service version to 2024-05-04
25+
### Updating service version to 2024-08-04
2626
```yaml
2727
directive:
2828
- from:
@@ -35,8 +35,7 @@ directive:
3535
where: $
3636
transform: >-
3737
return $.
38-
replaceAll(`[]string{"2021-12-02"}`, `[]string{ServiceVersion}`).
39-
replaceAll(`2021-12-02`, `2024-05-04`);
38+
replaceAll(`[]string{"2021-12-02"}`, `[]string{ServiceVersion}`);
4039
```
4140
4241
### Undo breaking change with BlobName

sdk/storage/azblob/internal/generated/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
package generated
88

9-
const ServiceVersion = "2024-05-04"
9+
const ServiceVersion = "2024-08-04"

sdk/storage/azblob/internal/generated/zz_appendblob_client.go

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)