Skip to content

Commit

Permalink
[AppContainers] Fix for issue #42663 (#42944)
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
melina5656 and ArcturusZhang authored Apr 2, 2024
1 parent 5d7be7d commit 9ce35d5
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/containerapps/Azure.ResourceManager.AppContainers",
"Tag": "net/containerapps/Azure.ResourceManager.AppContainers_d294f68485"
"Tag": "net/containerapps/Azure.ResourceManager.AppContainers_3e459fe9a9"
}
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());
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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);
}
}
}

0 comments on commit 9ce35d5

Please sign in to comment.