Skip to content

Commit f962fe1

Browse files
authored
[AppService] Add status code 202 and allow some properties to be empty (Azure#46960)
1 parent e081f8a commit f962fe1

File tree

7 files changed

+71
-42
lines changed

7 files changed

+71
-42
lines changed

sdk/websites/Azure.ResourceManager.AppService/CHANGELOG.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# Release History
22

3-
## 1.3.0-beta.2 (Unreleased)
4-
5-
### Features Added
6-
7-
### Breaking Changes
3+
## 1.3.0-beta.2 (2024-11-11)
84

95
### Bugs Fixed
106

11-
### Other Changes
7+
- Add status code 202 and allow some properties to be empty. Issue at 'https://github.com/Azure/azure-sdk-for-net/issues/46854.
128

139
## 1.3.0-beta.1 (2024-10-14)
1410

sdk/websites/Azure.ResourceManager.AppService/src/Customization/Models/AppCertificateData.Serialization.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
130130
{
131131
if (property0.Value.ValueKind == JsonValueKind.Null)
132132
{
133-
property0.ThrowNonNullablePropertyIsNull();
134133
continue;
135134
}
136135
List<string> array = new List<string>();
@@ -145,7 +144,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
145144
{
146145
if (property0.Value.ValueKind == JsonValueKind.Null)
147146
{
148-
property0.ThrowNonNullablePropertyIsNull();
149147
continue;
150148
}
151149
pfxBlob = property0.Value.GetBytesFromBase64("D");
@@ -170,7 +168,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
170168
{
171169
if (property0.Value.ValueKind == JsonValueKind.Null)
172170
{
173-
property0.ThrowNonNullablePropertyIsNull();
174171
continue;
175172
}
176173
issueDate = property0.Value.GetDateTimeOffset("O");
@@ -180,7 +177,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
180177
{
181178
if (property0.Value.ValueKind == JsonValueKind.Null)
182179
{
183-
property0.ThrowNonNullablePropertyIsNull();
184180
continue;
185181
}
186182
expirationDate = property0.Value.GetDateTimeOffset("O");
@@ -190,7 +186,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
190186
{
191187
if (property0.Value.ValueKind == JsonValueKind.Null)
192188
{
193-
property0.ThrowNonNullablePropertyIsNull();
194189
continue;
195190
}
196191
thumbprintString = property0.Value.GetString();
@@ -200,7 +195,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
200195
{
201196
if (property0.Value.ValueKind == JsonValueKind.Null)
202197
{
203-
property0.ThrowNonNullablePropertyIsNull();
204198
continue;
205199
}
206200
valid = property0.Value.GetBoolean();
@@ -210,7 +204,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
210204
{
211205
if (property0.Value.ValueKind == JsonValueKind.Null)
212206
{
213-
property0.ThrowNonNullablePropertyIsNull();
214207
continue;
215208
}
216209
cerBlob = property0.Value.GetBytesFromBase64("D");
@@ -225,7 +218,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
225218
{
226219
if (property0.Value.ValueKind == JsonValueKind.Null)
227220
{
228-
property0.ThrowNonNullablePropertyIsNull();
229221
continue;
230222
}
231223
hostingEnvironmentProfile = HostingEnvironmentProfile.DeserializeHostingEnvironmentProfile(property0.Value);
@@ -235,7 +227,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
235227
{
236228
if (property0.Value.ValueKind == JsonValueKind.Null || property0.Value.GetString().Length == 0)
237229
{
238-
property0.ThrowNonNullablePropertyIsNull();
239230
continue;
240231
}
241232
keyVaultId = new ResourceIdentifier(property0.Value.GetString());
@@ -250,7 +241,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
250241
{
251242
if (property0.Value.ValueKind == JsonValueKind.Null)
252243
{
253-
property0.ThrowNonNullablePropertyIsNull();
254244
continue;
255245
}
256246
keyVaultSecretStatus = property0.Value.GetString().ToKeyVaultSecretStatus();
@@ -260,7 +250,6 @@ internal static AppCertificateData DeserializeAppCertificateData(JsonElement ele
260250
{
261251
if (property0.Value.ValueKind == JsonValueKind.Null)
262252
{
263-
property0.ThrowNonNullablePropertyIsNull();
264253
continue;
265254
}
266255
serverFarmId = new ResourceIdentifier(property0.Value.GetString());

sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateCollection.cs

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

sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/AppCertificateOperationSource.cs

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

sdk/websites/Azure.ResourceManager.AppService/src/Generated/RestOperations/CertificatesRestOperations.cs

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

sdk/websites/Azure.ResourceManager.AppService/src/autorest.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,4 +1052,27 @@ directive:
10521052
$.properties.properties.properties.threads.items = {
10531053
"$ref": "#/definitions/ProcessThreadProperties"
10541054
};
1055+
# Fix for issue: https://github.com/Azure/azure-sdk-for-net/issues/46854
1056+
# TODO: Remove this workaround after the issue is resolved. Issue link: https://github.com/Azure/azure-rest-api-specs/issues/19022
1057+
- from: Certificates.json
1058+
where: $.paths['/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}'].put
1059+
transform: >
1060+
$["x-ms-long-running-operation"] = true;
1061+
$['responses'] = {
1062+
"200": {
1063+
"description": "OK.",
1064+
"schema": {
1065+
"$ref": "#/definitions/Certificate"
1066+
}
1067+
},
1068+
"202": {
1069+
"description": "OK.",
1070+
},
1071+
"default": {
1072+
"description": "App Service error response.",
1073+
"schema": {
1074+
"$ref": "./CommonDefinitions.json#/definitions/DefaultErrorResponse"
1075+
}
1076+
}
1077+
};
10551078
```

sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/CertificatesCollectionTests.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,10 @@ public async Task CreateOrUpdateWithNullKeyVaultId()
5050
KeyVaultId = null // Test to see that if service works fine when we set KeyVaultId to null.
5151
};
5252
var collection = Client.GetResourceGroupResource(ResourceGroupResource.CreateResourceIdentifier("db1ab6f0-4769-4b27-930e-01e2ef9c123c", "testRG-666")).GetAppCertificates();
53-
#if DEBUG
54-
Assert.ThrowsAsync<JsonException>(async delegate { await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); });
55-
await Task.CompletedTask;
56-
#else
5753
var lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data);
5854
var certificate = lro.Value;
5955
Assert.AreEqual(name, certificate.Data.Name);
6056
Assert.IsNull(certificate.Data.KeyVaultId);
61-
#endif
6257
}
6358

6459
[TestCase]

0 commit comments

Comments
 (0)