-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [AppContainers]Fix for issue #42663 * Update ContainerAppVnetConfiguration.Serialization.cs * add test case * Update Co-authored-by: Dapeng Zhang <ufo54153@gmail.com> --------- Co-authored-by: Dapeng Zhang <ufo54153@gmail.com>
- Loading branch information
1 parent
5d7be7d
commit 9ce35d5
Showing
4 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...rceManager.AppContainers/src/Custom/Models/ContainerAppVnetConfiguration.Serialization.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.ClientModel.Primitives; | ||
using System.Runtime.CompilerServices; | ||
using System.Text.Json; | ||
using Azure.Core; | ||
|
||
namespace Azure.ResourceManager.AppContainers.Models | ||
{ | ||
[CodeGenSerialization(nameof(InfrastructureSubnetId), DeserializationValueHook = nameof(DeserializeInfrastructureSubnetIdValue))] | ||
public partial class ContainerAppVnetConfiguration : IUtf8JsonSerializable, IJsonModel<ContainerAppVnetConfiguration> | ||
{ | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
internal static void DeserializeInfrastructureSubnetIdValue(JsonProperty property, ref ResourceIdentifier infrastructureSubnetId) | ||
{ | ||
if (property.Value.ValueKind == JsonValueKind.Null) | ||
return; | ||
var str = property.Value.GetString(); | ||
if (!string.IsNullOrEmpty(str)) | ||
{ | ||
infrastructureSubnetId = new ResourceIdentifier(property.Value.GetString()); | ||
} | ||
} | ||
} | ||
} |
6 changes: 1 addition & 5 deletions
6
...Manager.AppContainers/src/Generated/Models/ContainerAppVnetConfiguration.Serialization.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
...ps/Azure.ResourceManager.AppContainers/tests/TestCase/ManagedEnvironmentOperationTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Threading.Tasks; | ||
using Azure.Core.TestFramework; | ||
using Azure.Core; | ||
using NUnit.Framework; | ||
using Azure.ResourceManager.AppContainers.Models; | ||
|
||
namespace Azure.ResourceManager.AppContainers.Tests | ||
{ | ||
public class ManagedEnvironmentOperationTests : AppContainersManagementTestBase | ||
{ | ||
public ManagedEnvironmentOperationTests(bool isAsync) | ||
: base(isAsync)//, RecordedTestMode.Record) | ||
{ | ||
} | ||
|
||
[TestCase] | ||
[RecordedTest] | ||
public async Task GetContainerAppManagedEnvironmentResource() | ||
{ | ||
var resourceGroup = await CreateResourceGroupAsync(); | ||
var containerAppManagedEnvironmentCollection = resourceGroup.GetContainerAppManagedEnvironments(); | ||
var managedEnvironmentName = Recording.GenerateAssetName("ManagedEnvironment"); | ||
var data = new ContainerAppManagedEnvironmentData(AzureLocation.EastUS) | ||
{ | ||
VnetConfiguration = new ContainerAppVnetConfiguration() | ||
{ | ||
DockerBridgeCidr = "172.17.0.1/16" | ||
}, | ||
}; | ||
var containerAppManagedEnvironment = (await containerAppManagedEnvironmentCollection.CreateOrUpdateAsync(WaitUntil.Completed, managedEnvironmentName, data)).Value; | ||
var managedEnvironment = Client.GetContainerAppManagedEnvironmentResource(containerAppManagedEnvironment.Id); | ||
Assert.IsNotNull(managedEnvironment); | ||
} | ||
} | ||
} |