diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotCollection.cs index 5863b1521d9f..23b8005964e1 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_AgentPoolSnapshotCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsCreate.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/SnapshotsCreate.json // this example is just showing the usage of "Snapshots_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -63,7 +63,7 @@ public async Task CreateOrUpdate_CreateUpdateSnapshot() [Ignore("Only validating compilation of examples")] public async Task Get_GetSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/SnapshotsGet.json // this example is just showing the usage of "Snapshots_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -96,7 +96,7 @@ public async Task Get_GetSnapshot() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListSnapshotsByResourceGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsListByResourceGroup.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/SnapshotsListByResourceGroup.json // this example is just showing the usage of "Snapshots_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -131,7 +131,7 @@ public async Task GetAll_ListSnapshotsByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_GetSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/SnapshotsGet.json // this example is just showing the usage of "Snapshots_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -160,7 +160,7 @@ public async Task Exists_GetSnapshot() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/SnapshotsGet.json // this example is just showing the usage of "Snapshots_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotResource.cs index 18f0d6f5f8fc..0b4d314356bb 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolSnapshotResource.cs @@ -20,7 +20,7 @@ public partial class Sample_AgentPoolSnapshotResource [Ignore("Only validating compilation of examples")] public async Task Get_GetSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/SnapshotsGet.json // this example is just showing the usage of "Snapshots_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetSnapshot() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsDelete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/SnapshotsDelete.json // this example is just showing the usage of "Snapshots_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,7 +76,7 @@ public async Task Delete_DeleteSnapshot() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateSnapshotTags() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsUpdateTags.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/SnapshotsUpdateTags.json // this example is just showing the usage of "Snapshots_UpdateTags" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolUpgradeProfileResource.cs index 16685e88b2e2..6518ef04365b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AgentPoolUpgradeProfileResource.cs @@ -19,7 +19,7 @@ public partial class Sample_AgentPoolUpgradeProfileResource [Ignore("Only validating compilation of examples")] public async Task Get_GetUpgradeProfileForAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGetUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsGetUpgradeProfile.json // this example is just showing the usage of "AgentPools_GetUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolCollection.cs index d89556d52e00..4706b4bc435c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolCollection.cs @@ -16,11 +16,54 @@ namespace Azure.ResourceManager.ContainerService.Samples { public partial class Sample_ContainerServiceAgentPoolCollection { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AssociateAgentPoolWithCapacityReservationGroup() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsAssociate_CRG.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this ContainerServiceAgentPoolResource + ContainerServiceAgentPoolCollection collection = containerServiceManagedCluster.GetContainerServiceAgentPools(); + + // invoke the operation + string agentPoolName = "agentpool1"; + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + Count = 3, + VmSize = "Standard_DS2_v2", + OSType = ContainerServiceOSType.Linux, + OrchestratorVersion = "", + CapacityReservationGroupId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agentPoolName, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolUsingAnAgentPoolSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Snapshot.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_Snapshot.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -48,7 +91,7 @@ public async Task CreateOrUpdate_CreateAgentPoolUsingAnAgentPoolSnapshot() OSType = ContainerServiceOSType.Linux, OrchestratorVersion = "", EnableFips = true, - CreationDataSourceResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"), + CreationDataSourceResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"), }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agentPoolName, data); ContainerServiceAgentPoolResource result = lro.Value; @@ -62,9 +105,9 @@ public async Task CreateOrUpdate_CreateAgentPoolUsingAnAgentPoolSnapshot() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateAgentPoolWithCapacityReservationGroup() + public async Task CreateOrUpdate_CreateAgentPoolWithCustomCATrustEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_CRG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_EnableCustomCATrust.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +134,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithCapacityReservationGroup() VmSize = "Standard_DS2_v2", OSType = ContainerServiceOSType.Linux, OrchestratorVersion = "", - CapacityReservationGroupId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"), + EnableCustomCATrust = true, }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agentPoolName, data); ContainerServiceAgentPoolResource result = lro.Value; @@ -107,7 +150,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithCapacityReservationGroup() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithDedicatedHostGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_DedicatedHostGroup.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_DedicatedHostGroup.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -150,7 +193,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithDedicatedHostGroup() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithEncryptionAtHostEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_EnableEncryptionAtHost.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -193,7 +236,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithEncryptionAtHostEnabled() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithEphemeralOSDisk() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Ephemeral.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_Ephemeral.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -237,7 +280,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithEphemeralOSDisk() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithFIPSEnabledOS() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableFIPS.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_EnableFIPS.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -280,7 +323,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithFIPSEnabledOS() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithGPUMIG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_GPUMIG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_GPUMIG.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -347,7 +390,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithGPUMIG() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithKrustletAndTheWASIRuntime() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_WasmWasi.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_WasmWasi.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -392,7 +435,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithKrustletAndTheWASIRuntime() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithKubeletConfigAndLinuxOSConfig() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_CustomNodeConfig.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_CustomNodeConfig.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -454,11 +497,56 @@ public async Task CreateOrUpdate_CreateAgentPoolWithKubeletConfigAndLinuxOSConfi Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateAgentPoolWithMessageOfTheDay() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_MessageOfTheDay.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this ContainerServiceAgentPoolResource + ContainerServiceAgentPoolCollection collection = containerServiceManagedCluster.GetContainerServiceAgentPools(); + + // invoke the operation + string agentPoolName = "agentpool1"; + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + Count = 3, + VmSize = "Standard_DS2_v2", + OSDiskSizeInGB = 64, + MessageOfTheDay = "Zm9vCg==", + OSType = ContainerServiceOSType.Linux, + Mode = AgentPoolMode.User, + OrchestratorVersion = "", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agentPoolName, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithOSSKU() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_OSSKU.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_OSSKU.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -525,7 +613,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithOSSKU() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithPPG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_PPG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_PPG.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -568,7 +656,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithPPG() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithUltraSSDEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableUltraSSD.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_EnableUltraSSD.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -607,11 +695,132 @@ public async Task CreateOrUpdate_CreateAgentPoolWithUltraSSDEnabled() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateAgentPoolWithVirtualMachinesPoolType() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_TypeVirtualMachines.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this ContainerServiceAgentPoolResource + ContainerServiceAgentPoolCollection collection = containerServiceManagedCluster.GetContainerServiceAgentPools(); + + // invoke the operation + string agentPoolName = "agentpool1"; + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + OSType = ContainerServiceOSType.Linux, + TypePropertiesType = AgentPoolType.VirtualMachines, + OrchestratorVersion = "1.9.6", + Tags = +{ +["name1"] = "val1" +}, + NodeLabels = +{ +["key1"] = "val1" +}, + NodeTaints = { "Key1=Value1:NoSchedule" }, + VirtualMachinesScale = new ScaleProfile + { + Manual = {new ManualScaleProfile +{ +Size = "Standard_D2_v2", +Count = 3, +}, new ManualScaleProfile +{ +Size = "Standard_D2_v3", +Count = 2, +}}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agentPoolName, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateAgentPoolWithVirtualMachinesPoolTypeWithAutoscalingEnabled() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_TypeVirtualMachines_Autoscale.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this ContainerServiceAgentPoolResource + ContainerServiceAgentPoolCollection collection = containerServiceManagedCluster.GetContainerServiceAgentPools(); + + // invoke the operation + string agentPoolName = "agentpool1"; + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + OSType = ContainerServiceOSType.Linux, + TypePropertiesType = AgentPoolType.VirtualMachines, + OrchestratorVersion = "1.29.0", + Tags = +{ +["name1"] = "val1" +}, + NodeLabels = +{ +["key1"] = "val1" +}, + NodeTaints = { "Key1=Value1:NoSchedule" }, + VirtualMachinesScale = new ScaleProfile + { + Autoscale = BinaryData.FromObjectAsJson(new + { + maxCount = "5", + minCount = "1", + size = "Standard_D2_v2", + }), + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agentPoolName, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateAgentPoolWithWindowsOSSKU() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_WindowsOSSKU.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_WindowsOSSKU.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -654,7 +863,7 @@ public async Task CreateOrUpdate_CreateAgentPoolWithWindowsOSSKU() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateSpotAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Spot.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_Spot.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -703,11 +912,55 @@ public async Task CreateOrUpdate_CreateSpotAgentPool() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateWindowsAgentPoolWithDisablingOutboundNAT() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_WindowsDisableOutboundNAT.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this ContainerServiceAgentPoolResource + ContainerServiceAgentPoolCollection collection = containerServiceManagedCluster.GetContainerServiceAgentPools(); + + // invoke the operation + string agentPoolName = "wnp2"; + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + Count = 3, + VmSize = "Standard_D4s_v3", + OSType = ContainerServiceOSType.Windows, + OSSku = ContainerServiceOSSku.Windows2022, + OrchestratorVersion = "1.23.8", + DisableOutboundNat = true, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agentPoolName, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_Update.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -761,7 +1014,7 @@ public async Task CreateOrUpdate_CreateUpdateAgentPool() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_StartAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Start.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPools_Start.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -800,7 +1053,7 @@ public async Task CreateOrUpdate_StartAgentPool() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_StopAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Stop.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPools_Stop.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -839,7 +1092,7 @@ public async Task CreateOrUpdate_StopAgentPool() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_UpdateAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPools_Update.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -887,7 +1140,7 @@ public async Task CreateOrUpdate_UpdateAgentPool() [Ignore("Only validating compilation of examples")] public async Task Get_GetAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsGet.json // this example is just showing the usage of "AgentPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -921,7 +1174,7 @@ public async Task Get_GetAgentPool() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListAgentPoolsByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsList.json // this example is just showing the usage of "AgentPools_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -957,7 +1210,7 @@ public async Task GetAll_ListAgentPoolsByManagedCluster() [Ignore("Only validating compilation of examples")] public async Task Exists_GetAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsGet.json // this example is just showing the usage of "AgentPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -987,7 +1240,7 @@ public async Task Exists_GetAgentPool() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsGet.json // this example is just showing the usage of "AgentPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolResource.cs index 8f449f069239..cc363e44e57f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceAgentPoolResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServiceAgentPoolResource [Ignore("Only validating compilation of examples")] public async Task Get_GetAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsGet.json // this example is just showing the usage of "AgentPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetAgentPool() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsDelete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsDelete.json // this example is just showing the usage of "AgentPools_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -74,11 +74,78 @@ public async Task Delete_DeleteAgentPool() Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteAgentPoolByIgnoringPodDisruptionBudget() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsDelete_IgnorePodDisruptionBudget.json + // this example is just showing the usage of "AgentPools_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + await containerServiceAgentPool.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AssociateAgentPoolWithCapacityReservationGroup() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsAssociate_CRG.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + Count = 3, + VmSize = "Standard_DS2_v2", + OSType = ContainerServiceOSType.Linux, + OrchestratorVersion = "", + CapacityReservationGroupId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"), + }; + ArmOperation lro = await containerServiceAgentPool.UpdateAsync(WaitUntil.Completed, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolUsingAnAgentPoolSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Snapshot.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_Snapshot.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -103,7 +170,7 @@ public async Task Update_CreateAgentPoolUsingAnAgentPoolSnapshot() OSType = ContainerServiceOSType.Linux, OrchestratorVersion = "", EnableFips = true, - CreationDataSourceResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"), + CreationDataSourceResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"), }; ArmOperation lro = await containerServiceAgentPool.UpdateAsync(WaitUntil.Completed, data); ContainerServiceAgentPoolResource result = lro.Value; @@ -117,9 +184,9 @@ public async Task Update_CreateAgentPoolUsingAnAgentPoolSnapshot() [Test] [Ignore("Only validating compilation of examples")] - public async Task Update_CreateAgentPoolWithCapacityReservationGroup() + public async Task Update_CreateAgentPoolWithCustomCATrustEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_CRG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_EnableCustomCATrust.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -143,7 +210,7 @@ public async Task Update_CreateAgentPoolWithCapacityReservationGroup() VmSize = "Standard_DS2_v2", OSType = ContainerServiceOSType.Linux, OrchestratorVersion = "", - CapacityReservationGroupId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"), + EnableCustomCATrust = true, }; ArmOperation lro = await containerServiceAgentPool.UpdateAsync(WaitUntil.Completed, data); ContainerServiceAgentPoolResource result = lro.Value; @@ -159,7 +226,7 @@ public async Task Update_CreateAgentPoolWithCapacityReservationGroup() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithDedicatedHostGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_DedicatedHostGroup.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_DedicatedHostGroup.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -199,7 +266,7 @@ public async Task Update_CreateAgentPoolWithDedicatedHostGroup() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithEncryptionAtHostEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_EnableEncryptionAtHost.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -239,7 +306,7 @@ public async Task Update_CreateAgentPoolWithEncryptionAtHostEnabled() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithEphemeralOSDisk() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Ephemeral.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_Ephemeral.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -280,7 +347,7 @@ public async Task Update_CreateAgentPoolWithEphemeralOSDisk() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithFIPSEnabledOS() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableFIPS.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_EnableFIPS.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -320,7 +387,7 @@ public async Task Update_CreateAgentPoolWithFIPSEnabledOS() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithGPUMIG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_GPUMIG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_GPUMIG.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -384,7 +451,7 @@ public async Task Update_CreateAgentPoolWithGPUMIG() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithKrustletAndTheWASIRuntime() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_WasmWasi.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_WasmWasi.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -426,7 +493,7 @@ public async Task Update_CreateAgentPoolWithKrustletAndTheWASIRuntime() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithKubeletConfigAndLinuxOSConfig() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_CustomNodeConfig.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_CustomNodeConfig.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -485,11 +552,53 @@ public async Task Update_CreateAgentPoolWithKubeletConfigAndLinuxOSConfig() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateAgentPoolWithMessageOfTheDay() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_MessageOfTheDay.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + Count = 3, + VmSize = "Standard_DS2_v2", + OSDiskSizeInGB = 64, + MessageOfTheDay = "Zm9vCg==", + OSType = ContainerServiceOSType.Linux, + Mode = AgentPoolMode.User, + OrchestratorVersion = "", + }; + ArmOperation lro = await containerServiceAgentPool.UpdateAsync(WaitUntil.Completed, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithOSSKU() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_OSSKU.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_OSSKU.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -553,7 +662,7 @@ public async Task Update_CreateAgentPoolWithOSSKU() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithPPG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_PPG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_PPG.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -593,7 +702,7 @@ public async Task Update_CreateAgentPoolWithPPG() [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithUltraSSDEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_EnableUltraSSD.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_EnableUltraSSD.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -629,11 +738,126 @@ public async Task Update_CreateAgentPoolWithUltraSSDEnabled() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateAgentPoolWithVirtualMachinesPoolType() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_TypeVirtualMachines.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + OSType = ContainerServiceOSType.Linux, + TypePropertiesType = AgentPoolType.VirtualMachines, + OrchestratorVersion = "1.9.6", + Tags = +{ +["name1"] = "val1" +}, + NodeLabels = +{ +["key1"] = "val1" +}, + NodeTaints = { "Key1=Value1:NoSchedule" }, + VirtualMachinesScale = new ScaleProfile + { + Manual = {new ManualScaleProfile +{ +Size = "Standard_D2_v2", +Count = 3, +}, new ManualScaleProfile +{ +Size = "Standard_D2_v3", +Count = 2, +}}, + }, + }; + ArmOperation lro = await containerServiceAgentPool.UpdateAsync(WaitUntil.Completed, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateAgentPoolWithVirtualMachinesPoolTypeWithAutoscalingEnabled() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_TypeVirtualMachines_Autoscale.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + OSType = ContainerServiceOSType.Linux, + TypePropertiesType = AgentPoolType.VirtualMachines, + OrchestratorVersion = "1.29.0", + Tags = +{ +["name1"] = "val1" +}, + NodeLabels = +{ +["key1"] = "val1" +}, + NodeTaints = { "Key1=Value1:NoSchedule" }, + VirtualMachinesScale = new ScaleProfile + { + Autoscale = BinaryData.FromObjectAsJson(new + { + maxCount = "5", + minCount = "1", + size = "Standard_D2_v2", + }), + }, + }; + ArmOperation lro = await containerServiceAgentPool.UpdateAsync(WaitUntil.Completed, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Update_CreateAgentPoolWithWindowsOSSKU() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_WindowsOSSKU.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_WindowsOSSKU.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -673,7 +897,7 @@ public async Task Update_CreateAgentPoolWithWindowsOSSKU() [Ignore("Only validating compilation of examples")] public async Task Update_CreateSpotAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Spot.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_Spot.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -719,11 +943,52 @@ public async Task Update_CreateSpotAgentPool() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateWindowsAgentPoolWithDisablingOutboundNAT() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_WindowsDisableOutboundNAT.json + // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "wnp2"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + ContainerServiceAgentPoolData data = new ContainerServiceAgentPoolData + { + Count = 3, + VmSize = "Standard_D4s_v3", + OSType = ContainerServiceOSType.Windows, + OSSku = ContainerServiceOSSku.Windows2022, + OrchestratorVersion = "1.23.8", + DisableOutboundNat = true, + }; + ArmOperation lro = await containerServiceAgentPool.UpdateAsync(WaitUntil.Completed, data); + ContainerServiceAgentPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Update_CreateUpdateAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsCreate_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsCreate_Update.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -774,7 +1039,7 @@ public async Task Update_CreateUpdateAgentPool() [Ignore("Only validating compilation of examples")] public async Task Update_StartAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Start.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPools_Start.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -810,7 +1075,7 @@ public async Task Update_StartAgentPool() [Ignore("Only validating compilation of examples")] public async Task Update_StopAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Stop.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPools_Stop.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -846,7 +1111,7 @@ public async Task Update_StopAgentPool() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPools_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPools_Update.json // this example is just showing the usage of "AgentPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -891,7 +1156,7 @@ public async Task Update_UpdateAgentPool() [Ignore("Only validating compilation of examples")] public async Task AbortLatestOperation_AbortOperationOnAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsAbortOperation.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsAbortOperation.json // this example is just showing the usage of "AgentPools_AbortLatestOperation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -914,11 +1179,39 @@ public async Task AbortLatestOperation_AbortOperationOnAgentPool() Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task DeleteMachines_DeleteSpecificMachinesInAnAgentPool() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsDeleteMachines.json + // this example is just showing the usage of "AgentPools_DeleteMachines" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + AgentPoolDeleteMachinesParameter machines = new AgentPoolDeleteMachinesParameter(new string[] { "aks-nodepool1-42263519-vmss00000a", "aks-nodepool1-42263519-vmss00000b" }); + await containerServiceAgentPool.DeleteMachinesAsync(WaitUntil.Completed, machines); + + Console.WriteLine("Succeeded"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task UpgradeNodeImageVersion_UpgradeAgentPoolNodeImageVersion() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsUpgradeNodeImageVersion.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsUpgradeNodeImageVersion.json // this example is just showing the usage of "AgentPools_UpgradeNodeImageVersion" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -940,5 +1233,33 @@ public async Task UpgradeNodeImageVersion_UpgradeAgentPoolNodeImageVersion() Console.WriteLine("Succeeded"); } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetByAgentPoolOperationStatusResult_GetOperationStatusResult() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/OperationStatusResultGetByAgentPool.json + // this example is just showing the usage of "OperationStatusResult_GetByAgentPool" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // invoke the operation + string operationId = "00000000-0000-0000-0000-000000000001"; + OperationStatusResult result = await containerServiceAgentPool.GetByAgentPoolOperationStatusResultAsync(operationId); + + Console.WriteLine($"Succeeded: {result}"); + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationCollection.cs index 6c6340f77ea6..ad85d82b4ecd 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServiceMaintenanceConfigurationCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsCreate_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsCreate_Update.json // this example is just showing the usage of "MaintenanceConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -68,7 +68,7 @@ public async Task CreateOrUpdate_CreateUpdateMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateMaintenanceConfigurationWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsCreate_Update_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsCreate_Update_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +115,7 @@ public async Task CreateOrUpdate_CreateUpdateMaintenanceConfigurationWithMainten [Ignore("Only validating compilation of examples")] public async Task Get_GetMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsGet.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -149,7 +149,7 @@ public async Task Get_GetMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task Get_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -183,7 +183,7 @@ public async Task Get_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow [Ignore("Only validating compilation of examples")] public async Task GetAll_ListMaintenanceConfigurationsByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsList.json // this example is just showing the usage of "MaintenanceConfigurations_ListByManagedCluster" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -219,7 +219,7 @@ public async Task GetAll_ListMaintenanceConfigurationsByManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListMaintenanceConfigurationsConfiguredWithMaintenanceWindowByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsList_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsList_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_ListByManagedCluster" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -255,7 +255,7 @@ public async Task GetAll_ListMaintenanceConfigurationsConfiguredWithMaintenanceW [Ignore("Only validating compilation of examples")] public async Task Exists_GetMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsGet.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -285,7 +285,7 @@ public async Task Exists_GetMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task Exists_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -315,7 +315,7 @@ public async Task Exists_GetMaintenanceConfigurationConfiguredWithMaintenanceWin [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsGet.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -357,7 +357,7 @@ public async Task GetIfExists_GetMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationResource.cs index bacc1890041f..30f61b28b584 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceMaintenanceConfigurationResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServiceMaintenanceConfigurationResource [Ignore("Only validating compilation of examples")] public async Task Get_GetMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsGet.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task Get_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -82,7 +82,7 @@ public async Task Get_GetMaintenanceConfigurationConfiguredWithMaintenanceWindow [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsDelete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsDelete.json // this example is just showing the usage of "MaintenanceConfigurations_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -109,7 +109,7 @@ public async Task Delete_DeleteMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteMaintenanceConfigurationForNodeOSUpgrade() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsDelete_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsDelete_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -136,7 +136,7 @@ public async Task Delete_DeleteMaintenanceConfigurationForNodeOSUpgrade() [Ignore("Only validating compilation of examples")] public async Task Update_CreateUpdateMaintenanceConfiguration() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsCreate_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsCreate_Update.json // this example is just showing the usage of "MaintenanceConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -181,7 +181,7 @@ public async Task Update_CreateUpdateMaintenanceConfiguration() [Ignore("Only validating compilation of examples")] public async Task Update_CreateUpdateMaintenanceConfigurationWithMaintenanceWindow() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/MaintenanceConfigurationsCreate_Update_MaintenanceWindow.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MaintenanceConfigurationsCreate_Update_MaintenanceWindow.json // this example is just showing the usage of "MaintenanceConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterCollection.cs index 76550907a7de..c31d39d98390 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterCollection.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Text; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; @@ -18,11 +19,527 @@ namespace Azure.ResourceManager.ContainerService.Samples { public partial class Sample_ContainerServiceManagedClusterCollection { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AssociateManagedClusterWithCapacityReservationGroup() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersAssociate_CRG.json + // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerServiceManagedClusterResource + ContainerServiceManagedClusterCollection collection = resourceGroupResource.GetContainerServiceManagedClusters(); + + // invoke the operation + string resourceName = "clustername1"; + ContainerServiceManagedClusterData data = new ContainerServiceManagedClusterData(new AzureLocation("location1")) + { + Sku = new ManagedClusterSku + { + Name = new ManagedClusterSkuName("Basic"), + Tier = ManagedClusterSkuTier.Free, + }, + KubernetesVersion = "", + DnsPrefix = "dnsprefix1", + AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") +{ +Count = 3, +VmSize = "Standard_DS2_v2", +OSType = ContainerServiceOSType.Linux, +AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, +EnableNodePublicIP = true, +CapacityReservationGroupId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/capacityReservationGroups/crg1"), +}}, + LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] + { +new ContainerServiceSshPublicKey("keydata") + })), + WindowsProfile = new ManagedClusterWindowsProfile("azureuser") + { + AdminPassword = "replacePassword1234$", + }, + ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") + { + Secret = "secret", + }, + AddonProfiles = { }, + EnableRbac = true, + NetworkProfile = new ContainerServiceNetworkProfile + { + OutboundType = ContainerServiceOutboundType.LoadBalancer, + LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, + LoadBalancerProfile = new ManagedClusterLoadBalancerProfile + { + ManagedOutboundIPs = new ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + Count = 2, + }, + }, + }, + AutoScalerProfile = new ManagedClusterAutoScalerProfile + { + ScanIntervalInSeconds = "20s", + ScaleDownDelayAfterAdd = "15m", + }, + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ContainerServiceManagedClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateManagedClusterUsingAManagedClusterSnapshot() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_MCSnapshot.json + // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerServiceManagedClusterResource + ContainerServiceManagedClusterCollection collection = resourceGroupResource.GetContainerServiceManagedClusters(); + + // invoke the operation + string resourceName = "clustername1"; + ContainerServiceManagedClusterData data = new ContainerServiceManagedClusterData(new AzureLocation("location1")) + { + Sku = new ManagedClusterSku + { + Name = new ManagedClusterSkuName("Basic"), + Tier = ManagedClusterSkuTier.Free, + }, + CreationDataSourceResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedclustersnapshots/snapshot1"), + KubernetesVersion = "", + DnsPrefix = "dnsprefix1", + AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") +{ +Count = 3, +VmSize = "Standard_DS2_v2", +OSType = ContainerServiceOSType.Linux, +AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, +EnableNodePublicIP = true, +EnableFips = true, +}}, + LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] + { +new ContainerServiceSshPublicKey("keydata") + })), + ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") + { + Secret = "secret", + }, + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ContainerServiceManagedClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterUsingAnAgentPoolSnapshot() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_Snapshot.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_Snapshot.json + // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerServiceManagedClusterResource + ContainerServiceManagedClusterCollection collection = resourceGroupResource.GetContainerServiceManagedClusters(); + + // invoke the operation + string resourceName = "clustername1"; + ContainerServiceManagedClusterData data = new ContainerServiceManagedClusterData(new AzureLocation("location1")) + { + Sku = new ManagedClusterSku + { + Name = new ManagedClusterSkuName("Basic"), + Tier = ManagedClusterSkuTier.Free, + }, + KubernetesVersion = "", + DnsPrefix = "dnsprefix1", + AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") +{ +Count = 3, +VmSize = "Standard_DS2_v2", +OSType = ContainerServiceOSType.Linux, +AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, +EnableNodePublicIP = true, +EnableFips = true, +CreationDataSourceResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"), +}}, + LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] + { +new ContainerServiceSshPublicKey("keydata") + })), + WindowsProfile = new ManagedClusterWindowsProfile("azureuser") + { + AdminPassword = "replacePassword1234$", + }, + ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") + { + Secret = "secret", + }, + AddonProfiles = { }, + EnableRbac = true, + NetworkProfile = new ContainerServiceNetworkProfile + { + OutboundType = ContainerServiceOutboundType.LoadBalancer, + LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, + LoadBalancerProfile = new ManagedClusterLoadBalancerProfile + { + ManagedOutboundIPs = new ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + Count = 2, + }, + }, + }, + AutoScalerProfile = new ManagedClusterAutoScalerProfile + { + ScanIntervalInSeconds = "20s", + ScaleDownDelayAfterAdd = "15m", + }, + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ContainerServiceManagedClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateManagedClusterWithAIToolchainOperatorEnabled() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_EnableAIToolchainOperator.json + // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerServiceManagedClusterResource + ContainerServiceManagedClusterCollection collection = resourceGroupResource.GetContainerServiceManagedClusters(); + + // invoke the operation + string resourceName = "clustername1"; + ContainerServiceManagedClusterData data = new ContainerServiceManagedClusterData(new AzureLocation("location1")) + { + Sku = new ManagedClusterSku + { + Name = new ManagedClusterSkuName("Basic"), + Tier = ManagedClusterSkuTier.Free, + }, + KubernetesVersion = "", + DnsPrefix = "dnsprefix1", + AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") +{ +Count = 3, +VmSize = "Standard_DS2_v2", +OSType = ContainerServiceOSType.Linux, +AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, +EnableNodePublicIP = true, +}}, + LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] + { +new ContainerServiceSshPublicKey("keydata") + })), + ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") + { + Secret = "secret", + }, + AddonProfiles = { }, + EnableRbac = true, + NetworkProfile = new ContainerServiceNetworkProfile + { + NetworkPlugin = ContainerServiceNetworkPlugin.Azure, + NetworkPluginMode = ContainerServiceNetworkPluginMode.Overlay, + NetworkDataplane = NetworkDataplane.Cilium, + OutboundType = ContainerServiceOutboundType.LoadBalancer, + LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, + LoadBalancerProfile = new ManagedClusterLoadBalancerProfile + { + ManagedOutboundIPs = new ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + Count = 2, + }, + }, + }, + AiToolchainOperatorProfileEnabled = true, + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ContainerServiceManagedClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateManagedClusterWithAKSManagedNATGatewayAsOutboundType() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_ManagedNATGateway.json + // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerServiceManagedClusterResource + ContainerServiceManagedClusterCollection collection = resourceGroupResource.GetContainerServiceManagedClusters(); + + // invoke the operation + string resourceName = "clustername1"; + ContainerServiceManagedClusterData data = new ContainerServiceManagedClusterData(new AzureLocation("location1")) + { + Sku = new ManagedClusterSku + { + Name = new ManagedClusterSkuName("Basic"), + Tier = ManagedClusterSkuTier.Free, + }, + KubernetesVersion = "", + DnsPrefix = "dnsprefix1", + AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") +{ +Count = 3, +VmSize = "Standard_DS2_v2", +OSType = ContainerServiceOSType.Linux, +AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, +EnableNodePublicIP = false, +}}, + LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] + { +new ContainerServiceSshPublicKey("keydata") + })), + WindowsProfile = new ManagedClusterWindowsProfile("azureuser") + { + AdminPassword = "replacePassword1234$", + }, + ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") + { + Secret = "secret", + }, + AddonProfiles = { }, + EnableRbac = true, + NetworkProfile = new ContainerServiceNetworkProfile + { + OutboundType = ContainerServiceOutboundType.ManagedNatGateway, + LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, + NatGatewayProfile = new ManagedClusterNatGatewayProfile + { + ManagedOutboundIPCount = 2, + }, + }, + AutoScalerProfile = new ManagedClusterAutoScalerProfile + { + ScanIntervalInSeconds = "20s", + ScaleDownDelayAfterAdd = "15m", + }, + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ContainerServiceManagedClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateManagedClusterWithAdvancedNetworkingTransitEncryption() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AdvancedNetworkingTransitEncryption.json + // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerServiceManagedClusterResource + ContainerServiceManagedClusterCollection collection = resourceGroupResource.GetContainerServiceManagedClusters(); + + // invoke the operation + string resourceName = "clustername1"; + ContainerServiceManagedClusterData data = new ContainerServiceManagedClusterData(new AzureLocation("location1")) + { + Sku = new ManagedClusterSku + { + Name = new ManagedClusterSkuName("Basic"), + Tier = ManagedClusterSkuTier.Free, + }, + KubernetesVersion = "", + DnsPrefix = "dnsprefix1", + AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") +{ +Count = 3, +VmSize = "Standard_DS2_v2", +OSType = ContainerServiceOSType.Linux, +AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, +EnableNodePublicIP = true, +}}, + LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] + { +new ContainerServiceSshPublicKey("keydata") + })), + ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") + { + Secret = "secret", + }, + AddonProfiles = { }, + EnableRbac = true, + NetworkProfile = new ContainerServiceNetworkProfile + { + NetworkPlugin = ContainerServiceNetworkPlugin.Azure, + NetworkPluginMode = ContainerServiceNetworkPluginMode.Overlay, + NetworkDataplane = NetworkDataplane.Cilium, + OutboundType = ContainerServiceOutboundType.LoadBalancer, + LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, + LoadBalancerProfile = new ManagedClusterLoadBalancerProfile + { + ManagedOutboundIPs = new ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + Count = 2, + }, + }, + AdvancedNetworking = new AdvancedNetworking + { + Enabled = true, + ObservabilityEnabled = false, + Security = new AdvancedNetworkingSecurity + { + Enabled = true, + AdvancedNetworkPolicies = AdvancedNetworkPolicy.Fqdn, + TransitEncryptionType = TransitEncryptionType.WireGuard, + }, + }, + }, + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ContainerServiceManagedClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateManagedClusterWithAzureKeyVaultSecretsProviderAddon() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_AzureKeyvaultSecretsProvider.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -59,8 +576,6 @@ public async Task CreateOrUpdate_CreateManagedClusterUsingAnAgentPoolSnapshot() AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, -EnableFips = true, -CreationDataSourceResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"), }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -74,9 +589,18 @@ public async Task CreateOrUpdate_CreateManagedClusterUsingAnAgentPoolSnapshot() { Secret = "secret", }, - AddonProfiles = { }, + AddonProfiles = +{ +["azureKeyvaultSecretsProvider"] = new ManagedClusterAddonProfile(true) +{ +Config = +{ +["enableSecretRotation"] = "true", +["rotationPollInterval"] = "2m" +}, +} +}, EnableRbac = true, - EnablePodSecurityPolicy = false, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -94,7 +618,7 @@ public async Task CreateOrUpdate_CreateManagedClusterUsingAnAgentPoolSnapshot() ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -113,9 +637,9 @@ public async Task CreateOrUpdate_CreateManagedClusterUsingAnAgentPoolSnapshot() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithAKSManagedNATGatewayAsOutboundType() + public async Task CreateOrUpdate_CreateManagedClusterWithCustomCATrustCertificatesPopulatedAndCustomCATrustEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_ManagedNATGateway.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_EnableCustomCATrust.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -151,7 +675,8 @@ public async Task CreateOrUpdate_CreateManagedClusterWithAKSManagedNATGatewayAsO OSType = ContainerServiceOSType.Linux, AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, -EnableNodePublicIP = false, +EnableNodePublicIP = true, +EnableCustomCATrust = true, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -167,14 +692,16 @@ public async Task CreateOrUpdate_CreateManagedClusterWithAKSManagedNATGatewayAsO }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { - OutboundType = ContainerServiceOutboundType.ManagedNatGateway, + OutboundType = ContainerServiceOutboundType.LoadBalancer, LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, - NatGatewayProfile = new ManagedClusterNatGatewayProfile + LoadBalancerProfile = new ManagedClusterLoadBalancerProfile { - ManagedOutboundIPCount = 2, + ManagedOutboundIPs = new ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + Count = 2, + }, }, }, AutoScalerProfile = new ManagedClusterAutoScalerProfile @@ -182,7 +709,11 @@ public async Task CreateOrUpdate_CreateManagedClusterWithAKSManagedNATGatewayAsO ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + SecurityProfile = new ManagedClusterSecurityProfile + { + CustomCATrustCertificates = { Encoding.UTF8.GetBytes("ZHVtbXlFeGFtcGxlVGVzdFZhbHVlRm9yQ2VydGlmaWNhdGVUb0JlQWRkZWQ=") }, + }, Tags = { ["archv2"] = "", @@ -201,9 +732,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithAKSManagedNATGatewayAsO [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithAzureKeyVaultSecretsProviderAddon() + public async Task CreateOrUpdate_CreateManagedClusterWithDedicatedHostGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_AzureKeyvaultSecretsProvider.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_DedicatedHostGroup.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -238,8 +769,8 @@ public async Task CreateOrUpdate_CreateManagedClusterWithAzureKeyVaultSecretsPro VmSize = "Standard_DS2_v2", OSType = ContainerServiceOSType.Linux, AgentPoolType = AgentPoolType.VirtualMachineScaleSets, -Mode = AgentPoolMode.System, EnableNodePublicIP = true, +HostGroupId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"), }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -253,19 +784,8 @@ public async Task CreateOrUpdate_CreateManagedClusterWithAzureKeyVaultSecretsPro { Secret = "secret", }, - AddonProfiles = -{ -["azureKeyvaultSecretsProvider"] = new ManagedClusterAddonProfile(true) -{ -Config = -{ -["enableSecretRotation"] = "true", -["rotationPollInterval"] = "2m" -}, -} -}, + AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -283,7 +803,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithAzureKeyVaultSecretsPro ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -302,9 +822,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithAzureKeyVaultSecretsPro [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithCapacityReservationGroup() + public async Task CreateOrUpdate_CreateManagedClusterWithEncryptionAtHostEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_CRG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_EnableEncryptionAtHost.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -341,7 +861,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithCapacityReservationGrou AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, -CapacityReservationGroupId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/capacityReservationGroups/crg1"), +EnableEncryptionAtHost = true, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -357,7 +877,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithCapacityReservationGrou }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -394,9 +913,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithCapacityReservationGrou [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithDedicatedHostGroup() + public async Task CreateOrUpdate_CreateManagedClusterWithFIPSEnabledOS() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_DedicatedHostGroup.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_EnabledFIPS.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -431,8 +950,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithDedicatedHostGroup() VmSize = "Standard_DS2_v2", OSType = ContainerServiceOSType.Linux, AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, EnableNodePublicIP = true, -HostGroupId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"), +EnableFips = true, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -448,7 +968,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithDedicatedHostGroup() }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = false, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -466,7 +985,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithDedicatedHostGroup() ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -485,9 +1004,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithDedicatedHostGroup() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithEncryptionAtHostEnabled() + public async Task CreateOrUpdate_CreateManagedClusterWithGPUMIG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_GPUMIG.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -519,12 +1038,12 @@ public async Task CreateOrUpdate_CreateManagedClusterWithEncryptionAtHostEnabled AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") { Count = 3, -VmSize = "Standard_DS2_v2", +VmSize = "Standard_ND96asr_v4", OSType = ContainerServiceOSType.Linux, AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, -EnableEncryptionAtHost = true, +GpuInstanceProfile = GpuInstanceProfile.Mig3G, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -540,7 +1059,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithEncryptionAtHostEnabled }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -558,7 +1076,14 @@ public async Task CreateOrUpdate_CreateManagedClusterWithEncryptionAtHostEnabled ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + HttpProxyConfig = new ManagedClusterHttpProxyConfig + { + HttpProxy = "http://myproxy.server.com:8080", + HttpsProxy = "https://myproxy.server.com:8080", + NoProxy = { "localhost", "127.0.0.1" }, + TrustedCA = "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=", + }, Tags = { ["archv2"] = "", @@ -577,9 +1102,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithEncryptionAtHostEnabled [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithFIPSEnabledOS() + public async Task CreateOrUpdate_CreateManagedClusterWithHTTPProxyConfigured() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_EnabledFIPS.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_HTTPProxy.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -616,7 +1141,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithFIPSEnabledOS() AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, -EnableFips = true, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -632,7 +1156,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithFIPSEnabledOS() }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = false, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -650,7 +1173,109 @@ public async Task CreateOrUpdate_CreateManagedClusterWithFIPSEnabledOS() ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + HttpProxyConfig = new ManagedClusterHttpProxyConfig + { + HttpProxy = "http://myproxy.server.com:8080", + HttpsProxy = "https://myproxy.server.com:8080", + NoProxy = { "localhost", "127.0.0.1" }, + TrustedCA = "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=", + }, + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ContainerServiceManagedClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateManagedClusterWithLongTermSupport() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_Premium.json + // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerServiceManagedClusterResource + ContainerServiceManagedClusterCollection collection = resourceGroupResource.GetContainerServiceManagedClusters(); + + // invoke the operation + string resourceName = "clustername1"; + ContainerServiceManagedClusterData data = new ContainerServiceManagedClusterData(new AzureLocation("location1")) + { + Sku = new ManagedClusterSku + { + Name = ManagedClusterSkuName.Base, + Tier = ManagedClusterSkuTier.Premium, + }, + KubernetesVersion = "", + DnsPrefix = "dnsprefix1", + AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") +{ +Count = 3, +VmSize = "Standard_DS2_v2", +OSType = ContainerServiceOSType.Linux, +AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, +EnableNodePublicIP = true, +EnableEncryptionAtHost = true, +}}, + LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] + { +new ContainerServiceSshPublicKey("keydata") + })), + WindowsProfile = new ManagedClusterWindowsProfile("azureuser") + { + AdminPassword = "replacePassword1234$", + }, + ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") + { + Secret = "secret", + }, + AddonProfiles = { }, + EnableRbac = true, + SupportPlan = KubernetesSupportPlan.AKSLongTermSupport, + NetworkProfile = new ContainerServiceNetworkProfile + { + OutboundType = ContainerServiceOutboundType.LoadBalancer, + LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, + LoadBalancerProfile = new ManagedClusterLoadBalancerProfile + { + ManagedOutboundIPs = new ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + Count = 2, + }, + }, + }, + AutoScalerProfile = new ManagedClusterAutoScalerProfile + { + ScanIntervalInSeconds = "20s", + ScaleDownDelayAfterAdd = "15m", + }, + ApiServerAccessProfile = new ManagedClusterApiServerAccessProfile + { + DisableRunCommand = true, + }, Tags = { ["archv2"] = "", @@ -669,9 +1294,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithFIPSEnabledOS() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithGPUMIG() + public async Task CreateOrUpdate_CreateManagedClusterWithNodeAutoProvisioning() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_GPUMIG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_NodeAutoProvisioning.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -703,30 +1328,27 @@ public async Task CreateOrUpdate_CreateManagedClusterWithGPUMIG() AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") { Count = 3, -VmSize = "Standard_ND96asr_v4", +VmSize = "Standard_DS2_v2", OSType = ContainerServiceOSType.Linux, AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, -GpuInstanceProfile = GpuInstanceProfile.Mig3G, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { new ContainerServiceSshPublicKey("keydata") })), - WindowsProfile = new ManagedClusterWindowsProfile("azureuser") - { - AdminPassword = "replacePassword1234$", - }, ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") { Secret = "secret", }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { + NetworkPlugin = ContainerServiceNetworkPlugin.Azure, + NetworkPluginMode = ContainerServiceNetworkPluginMode.Overlay, + NetworkDataplane = NetworkDataplane.Cilium, OutboundType = ContainerServiceOutboundType.LoadBalancer, LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, LoadBalancerProfile = new ManagedClusterLoadBalancerProfile @@ -737,19 +1359,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithGPUMIG() }, }, }, - AutoScalerProfile = new ManagedClusterAutoScalerProfile - { - ScanIntervalInSeconds = "20s", - ScaleDownDelayAfterAdd = "15m", - }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), - HttpProxyConfig = new ManagedClusterHttpProxyConfig - { - HttpProxy = "http://myproxy.server.com:8080", - HttpsProxy = "https://myproxy.server.com:8080", - NoProxy = { "localhost", "127.0.0.1" }, - TrustedCA = "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=", - }, Tags = { ["archv2"] = "", @@ -768,9 +1377,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithGPUMIG() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithHTTPProxyConfigured() + public async Task CreateOrUpdate_CreateManagedClusterWithNodePublicIPPrefix() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_HTTPProxy.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_NodePublicIPPrefix.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -807,6 +1416,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithHTTPProxyConfigured() AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, +NodePublicIPPrefixId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Network/publicIPPrefixes/public-ip-prefix"), }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -822,7 +1432,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithHTTPProxyConfigured() }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -840,14 +1449,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithHTTPProxyConfigured() ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), - HttpProxyConfig = new ManagedClusterHttpProxyConfig - { - HttpProxy = "http://myproxy.server.com:8080", - HttpsProxy = "https://myproxy.server.com:8080", - NoProxy = { "localhost", "127.0.0.1" }, - TrustedCA = "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=", - }, + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -866,9 +1468,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithHTTPProxyConfigured() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithLongTermSupport() + public async Task CreateOrUpdate_CreateManagedClusterWithOSSKU() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_Premium.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_OSSKU.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -892,8 +1494,8 @@ public async Task CreateOrUpdate_CreateManagedClusterWithLongTermSupport() { Sku = new ManagedClusterSku { - Name = ManagedClusterSkuName.Base, - Tier = ManagedClusterSkuTier.Premium, + Name = new ManagedClusterSkuName("Basic"), + Tier = ManagedClusterSkuTier.Free, }, KubernetesVersion = "", DnsPrefix = "dnsprefix1", @@ -902,10 +1504,10 @@ public async Task CreateOrUpdate_CreateManagedClusterWithLongTermSupport() Count = 3, VmSize = "Standard_DS2_v2", OSType = ContainerServiceOSType.Linux, +OSSku = ContainerServiceOSSku.AzureLinux, AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, -EnableEncryptionAtHost = true, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -921,8 +1523,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithLongTermSupport() }, AddonProfiles = { }, EnableRbac = true, - SupportPlan = KubernetesSupportPlan.AKSLongTermSupport, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -940,9 +1540,13 @@ public async Task CreateOrUpdate_CreateManagedClusterWithLongTermSupport() ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - ApiServerAccessProfile = new ManagedClusterApiServerAccessProfile + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + HttpProxyConfig = new ManagedClusterHttpProxyConfig { - DisableRunCommand = true, + HttpProxy = "http://myproxy.server.com:8080", + HttpsProxy = "https://myproxy.server.com:8080", + NoProxy = { "localhost", "127.0.0.1" }, + TrustedCA = "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=", }, Tags = { @@ -962,9 +1566,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithLongTermSupport() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithNodePublicIPPrefix() + public async Task CreateOrUpdate_CreateManagedClusterWithPPG() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_PPG.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1001,7 +1605,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithNodePublicIPPrefix() AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, -NodePublicIPPrefixId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Network/publicIPPrefixes/public-ip-prefix"), +ProximityPlacementGroupId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"), }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -1017,7 +1621,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithNodePublicIPPrefix() }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -1035,7 +1638,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithNodePublicIPPrefix() ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -1054,9 +1657,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithNodePublicIPPrefix() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithOSSKU() + public async Task CreateOrUpdate_CreateManagedClusterWithPodIdentityEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_OSSKU.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_PodIdentity.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1090,7 +1693,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithOSSKU() Count = 3, VmSize = "Standard_DS2_v2", OSType = ContainerServiceOSType.Linux, -OSSku = ContainerServiceOSSku.AzureLinux, AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, @@ -1108,8 +1710,12 @@ public async Task CreateOrUpdate_CreateManagedClusterWithOSSKU() Secret = "secret", }, AddonProfiles = { }, + PodIdentityProfile = new ManagedClusterPodIdentityProfile + { + IsEnabled = true, + AllowNetworkPluginKubenet = true, + }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -1127,14 +1733,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithOSSKU() ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), - HttpProxyConfig = new ManagedClusterHttpProxyConfig - { - HttpProxy = "http://myproxy.server.com:8080", - HttpsProxy = "https://myproxy.server.com:8080", - NoProxy = { "localhost", "127.0.0.1" }, - TrustedCA = "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=", - }, + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -1153,9 +1752,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithOSSKU() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithPPG() + public async Task CreateOrUpdate_CreateManagedClusterWithRunCommandDisabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_PPG.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_DisableRunCommand.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1192,7 +1791,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithPPG() AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, -ProximityPlacementGroupId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"), +EnableEncryptionAtHost = true, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -1208,7 +1807,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithPPG() }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -1226,7 +1824,10 @@ public async Task CreateOrUpdate_CreateManagedClusterWithPPG() ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + ApiServerAccessProfile = new ManagedClusterApiServerAccessProfile + { + DisableRunCommand = true, + }, Tags = { ["archv2"] = "", @@ -1245,9 +1846,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithPPG() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithPodIdentityEnabled() + public async Task CreateOrUpdate_CreateManagedClusterWithSecurityProfileConfigured() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_PodIdentity.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_SecurityProfile.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1289,22 +1890,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithPodIdentityEnabled() { new ContainerServiceSshPublicKey("keydata") })), - WindowsProfile = new ManagedClusterWindowsProfile("azureuser") - { - AdminPassword = "replacePassword1234$", - }, - ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") - { - Secret = "secret", - }, - AddonProfiles = { }, - PodIdentityProfile = new ManagedClusterPodIdentityProfile - { - IsEnabled = true, - AllowNetworkPluginKubenet = true, - }, - EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -1317,12 +1902,28 @@ public async Task CreateOrUpdate_CreateManagedClusterWithPodIdentityEnabled() }, }, }, - AutoScalerProfile = new ManagedClusterAutoScalerProfile + SecurityProfile = new ManagedClusterSecurityProfile { - ScanIntervalInSeconds = "20s", - ScaleDownDelayAfterAdd = "15m", + Defender = new ManagedClusterSecurityProfileDefender + { + LogAnalyticsWorkspaceResourceId = new ResourceIdentifier("/subscriptions/SUB_ID/resourcegroups/RG_NAME/providers/microsoft.operationalinsights/workspaces/WORKSPACE_NAME"), + IsSecurityMonitoringEnabled = true, + SecurityGating = new ManagedClusterSecurityProfileDefenderSecurityGating + { + Enabled = true, + Identities = {new ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem +{ +AzureContainerRegistry = "registry1", +Identity = new ContainerServiceUserAssignedIdentity +{ +ResourceId = new ResourceIdentifier("/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.ManagedIdentity/userAssignedIdentities/IDENTITY_NAME"), +ClientId = Guid.Parse("client1"), +}, +}}, + AllowSecretAccess = true, + }, + }, }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -1341,9 +1942,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithPodIdentityEnabled() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithRunCommandDisabled() + public async Task CreateOrUpdate_CreateManagedClusterWithUltraSSDEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_DisableRunCommand.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_EnableUltraSSD.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1380,7 +1981,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithRunCommandDisabled() AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, -EnableEncryptionAtHost = true, +EnableUltraSsd = true, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { @@ -1396,7 +1997,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithRunCommandDisabled() }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -1414,10 +2014,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithRunCommandDisabled() ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - ApiServerAccessProfile = new ManagedClusterApiServerAccessProfile - { - DisableRunCommand = true, - }, + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -1436,9 +2033,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithRunCommandDisabled() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithSecurityProfileConfigured() + public async Task CreateOrUpdate_CreateManagedClusterWithVirtualMachinesPoolType() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_SecurityProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_VirtualMachines.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1472,14 +2069,20 @@ public async Task CreateOrUpdate_CreateManagedClusterWithSecurityProfileConfigur Count = 3, VmSize = "Standard_DS2_v2", OSType = ContainerServiceOSType.Linux, -AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +AgentPoolType = AgentPoolType.VirtualMachines, Mode = AgentPoolMode.System, -EnableNodePublicIP = true, +EnableFips = true, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { new ContainerServiceSshPublicKey("keydata") })), + ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") + { + Secret = "secret", + }, + AddonProfiles = { }, + EnableRbac = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -1492,15 +2095,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithSecurityProfileConfigur }, }, }, - SecurityProfile = new ManagedClusterSecurityProfile - { - Defender = new ManagedClusterSecurityProfileDefender - { - LogAnalyticsWorkspaceResourceId = new ResourceIdentifier("/subscriptions/SUB_ID/resourcegroups/RG_NAME/providers/microsoft.operationalinsights/workspaces/WORKSPACE_NAME"), - IsSecurityMonitoringEnabled = true, - }, - IsWorkloadIdentityEnabled = true, - }, + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -1519,9 +2114,9 @@ public async Task CreateOrUpdate_CreateManagedClusterWithSecurityProfileConfigur [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateManagedClusterWithUltraSSDEnabled() + public async Task CreateOrUpdate_CreateManagedClusterWithWebAppRoutingIngressProfileConfigured() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_EnableUltraSSD.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_IngressProfile_WebAppRouting.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1558,23 +2153,11 @@ public async Task CreateOrUpdate_CreateManagedClusterWithUltraSSDEnabled() AgentPoolType = AgentPoolType.VirtualMachineScaleSets, Mode = AgentPoolMode.System, EnableNodePublicIP = true, -EnableUltraSsd = true, }}, LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] { new ContainerServiceSshPublicKey("keydata") })), - WindowsProfile = new ManagedClusterWindowsProfile("azureuser") - { - AdminPassword = "replacePassword1234$", - }, - ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") - { - Secret = "secret", - }, - AddonProfiles = { }, - EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -1587,12 +2170,11 @@ public async Task CreateOrUpdate_CreateManagedClusterWithUltraSSDEnabled() }, }, }, - AutoScalerProfile = new ManagedClusterAutoScalerProfile + IngressWebAppRouting = new ManagedClusterIngressProfileWebAppRouting { - ScanIntervalInSeconds = "20s", - ScaleDownDelayAfterAdd = "15m", + Enabled = true, + DnsZoneResourceIds = { new ResourceIdentifier("/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/dnszones/DNS_ZONE_NAME") }, }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -1613,7 +2195,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithUltraSSDEnabled() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedClusterWithUserAssignedNATGatewayAsOutboundType() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_UserAssignedNATGateway.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1665,7 +2247,6 @@ public async Task CreateOrUpdate_CreateManagedClusterWithUserAssignedNATGatewayA }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.UserAssignedNatGateway, @@ -1676,7 +2257,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithUserAssignedNATGatewayA ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -1697,7 +2278,7 @@ public async Task CreateOrUpdate_CreateManagedClusterWithUserAssignedNATGatewayA [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedPrivateClusterWithPublicFQDNSpecified() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1750,7 +2331,6 @@ public async Task CreateOrUpdate_CreateManagedPrivateClusterWithPublicFQDNSpecif }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -1793,7 +2373,7 @@ public async Task CreateOrUpdate_CreateManagedPrivateClusterWithPublicFQDNSpecif [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedPrivateClusterWithFqdnSubdomainSpecified() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1846,7 +2426,6 @@ public async Task CreateOrUpdate_CreateManagedPrivateClusterWithFqdnSubdomainSpe }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -1889,7 +2468,7 @@ public async Task CreateOrUpdate_CreateManagedPrivateClusterWithFqdnSubdomainSpe [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateAADManagedClusterWithEnableAzureRBAC() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -1942,7 +2521,6 @@ public async Task CreateOrUpdate_CreateUpdateAADManagedClusterWithEnableAzureRBA }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -1965,7 +2543,7 @@ public async Task CreateOrUpdate_CreateUpdateAADManagedClusterWithEnableAzureRBA ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -1986,7 +2564,7 @@ public async Task CreateOrUpdate_CreateUpdateAADManagedClusterWithEnableAzureRBA [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_Update.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_Update.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2018,7 +2596,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedCluster() ResourceIdentityType = "UserAssigned", UserAssignedIdentities = { -[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1")] = new UserAssignedIdentity() +[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1")] = new UserAssignedIdentity() }, }, KubernetesVersion = "", @@ -2048,7 +2626,6 @@ public async Task CreateOrUpdate_CreateUpdateManagedCluster() }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -2063,7 +2640,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedCluster() }, UpgradeOverrideSettings = new UpgradeOverrideSettings { - ForceUpgrade = false, + ForceUpgrade = true, Until = DateTimeOffset.Parse("2022-11-01T13:00:00Z"), }, AutoScalerProfile = new ManagedClusterAutoScalerProfile @@ -2076,7 +2653,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedCluster() ScaleDownDelayAfterAdd = "15m", SkipNodesWithSystemPods = "false", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -2097,7 +2674,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedCluster() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateManagedClusterWithAzureServiceMesh() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_AzureServiceMesh.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_AzureServiceMesh.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2159,7 +2736,6 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithAzureServiceMesh( } }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -2177,7 +2753,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithAzureServiceMesh( ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), ServiceMeshProfile = new ServiceMeshProfile(ServiceMeshMode.Istio) { Istio = new IstioServiceMesh @@ -2185,13 +2761,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithAzureServiceMesh( Components = new IstioComponents { IngressGateways = { new IstioIngressGateway(IstioIngressGatewayMode.Internal, true) }, - EgressGateways = {new IstioEgressGateway(true) -{ -NodeSelector = -{ -["istio"] = "egress" -}, -}}, + EgressGateways = { new IstioEgressGateway(true, "istioegress1") }, }, CertificateAuthorityPlugin = new IstioPluginCertificateAuthority { @@ -2223,7 +2793,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithAzureServiceMesh( [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateManagedClusterWithEnableAHUB() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_UpdateWithAHUB.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_UpdateWithAHUB.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2255,7 +2825,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithEnableAHUB() ResourceIdentityType = "UserAssigned", UserAssignedIdentities = { -[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1")] = new UserAssignedIdentity() +[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1")] = new UserAssignedIdentity() }, }, KubernetesVersion = "", @@ -2285,7 +2855,6 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithEnableAHUB() }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -2303,7 +2872,99 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithEnableAHUB() ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ContainerServiceManagedClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerServiceManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateUpdateManagedClusterWithEnableNamespaceResources() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_UpdateWithEnableNamespaceResources.json + // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerServiceManagedClusterResource + ContainerServiceManagedClusterCollection collection = resourceGroupResource.GetContainerServiceManagedClusters(); + + // invoke the operation + string resourceName = "clustername1"; + ContainerServiceManagedClusterData data = new ContainerServiceManagedClusterData(new AzureLocation("location1")) + { + Sku = new ManagedClusterSku + { + Name = new ManagedClusterSkuName("Basic"), + Tier = ManagedClusterSkuTier.Free, + }, + KubernetesVersion = "", + DnsPrefix = "dnsprefix1", + AgentPoolProfiles = {new ManagedClusterAgentPoolProfile("nodepool1") +{ +Count = 3, +VmSize = "Standard_DS1_v2", +OSType = ContainerServiceOSType.Linux, +AgentPoolType = AgentPoolType.VirtualMachineScaleSets, +Mode = AgentPoolMode.System, +AvailabilityZones = {"1", "2", "3"}, +EnableNodePublicIP = true, +}}, + LinuxProfile = new ContainerServiceLinuxProfile("azureuser", new ContainerServiceSshConfiguration(new ContainerServiceSshPublicKey[] + { +new ContainerServiceSshPublicKey("keydata") + })), + WindowsProfile = new ManagedClusterWindowsProfile("azureuser") + { + AdminPassword = "replacePassword1234$", + }, + ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile("clientid") + { + Secret = "secret", + }, + AddonProfiles = { }, + EnableRbac = true, + EnableNamespaceResources = true, + NetworkProfile = new ContainerServiceNetworkProfile + { + OutboundType = ContainerServiceOutboundType.LoadBalancer, + LoadBalancerSku = ContainerServiceLoadBalancerSku.Standard, + LoadBalancerProfile = new ManagedClusterLoadBalancerProfile + { + ManagedOutboundIPs = new ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + Count = 2, + }, + }, + }, + AutoScalerProfile = new ManagedClusterAutoScalerProfile + { + ScanIntervalInSeconds = "20s", + ScaleDownDelayAfterAdd = "15m", + }, + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -2324,7 +2985,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithEnableAHUB() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateManagedClusterWithWindowsGMSAEnabled() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_UpdateWindowsGmsa.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2356,7 +3017,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithWindowsGMSAEnable ResourceIdentityType = "UserAssigned", UserAssignedIdentities = { -[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1")] = new UserAssignedIdentity() +[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1")] = new UserAssignedIdentity() }, }, KubernetesVersion = "", @@ -2389,7 +3050,6 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithWindowsGMSAEnable }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -2407,7 +3067,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithWindowsGMSAEnable ScanIntervalInSeconds = "20s", ScaleDownDelayAfterAdd = "15m", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -2428,7 +3088,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithWindowsGMSAEnable [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateUpdateManagedClusterWithDualStackNetworking() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersCreate_DualStackNetworking.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersCreate_DualStackNetworking.json // this example is just showing the usage of "ManagedClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2460,7 +3120,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithDualStackNetworki ResourceIdentityType = "UserAssigned", UserAssignedIdentities = { -[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1")] = new UserAssignedIdentity() +[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1")] = new UserAssignedIdentity() }, }, KubernetesVersion = "", @@ -2490,7 +3150,6 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithDualStackNetworki }, AddonProfiles = { }, EnableRbac = true, - EnablePodSecurityPolicy = true, NetworkProfile = new ContainerServiceNetworkProfile { OutboundType = ContainerServiceOutboundType.LoadBalancer, @@ -2514,7 +3173,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithDualStackNetworki ScaleDownDelayAfterAdd = "15m", SkipNodesWithSystemPods = "false", }, - DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), Tags = { ["archv2"] = "", @@ -2535,7 +3194,7 @@ public async Task CreateOrUpdate_CreateUpdateManagedClusterWithDualStackNetworki [Ignore("Only validating compilation of examples")] public async Task Get_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet.json // this example is just showing the usage of "ManagedClusters_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2568,7 +3227,7 @@ public async Task Get_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetAll_GetManagedClustersByResourceGroup() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersListByResourceGroup.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersListByResourceGroup.json // this example is just showing the usage of "ManagedClusters_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2603,7 +3262,7 @@ public async Task GetAll_GetManagedClustersByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet.json // this example is just showing the usage of "ManagedClusters_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -2632,7 +3291,7 @@ public async Task Exists_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet.json // this example is just showing the usage of "ManagedClusters_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterResource.cs index 6d601b6ae0e4..b4f45b63ac70 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceManagedClusterResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServiceManagedClusterResource [Ignore("Only validating compilation of examples")] public async Task Get_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet.json // this example is just showing the usage of "ManagedClusters_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersDelete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersDelete.json // this example is just showing the usage of "ManagedClusters_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,7 +76,7 @@ public async Task Delete_DeleteManagedCluster() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateManagedClusterTags() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersUpdateTags.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersUpdateTags.json // this example is just showing the usage of "ManagedClusters_UpdateTags" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +115,7 @@ public async Task Update_UpdateManagedClusterTags() [Ignore("Only validating compilation of examples")] public async Task GetAccessProfile_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGetAccessProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGetAccessProfile.json // this example is just showing the usage of "ManagedClusters_GetAccessProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -142,7 +142,7 @@ public async Task GetAccessProfile_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetClusterAdminCredentials_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersListClusterAdminCredentials.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersListClusterCredentialResult.json // this example is just showing the usage of "ManagedClusters_ListClusterAdminCredentials" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -168,7 +168,7 @@ public async Task GetClusterAdminCredentials_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetClusterUserCredentials_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersListClusterUserCredentials.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersListClusterCredentialResult.json // this example is just showing the usage of "ManagedClusters_ListClusterUserCredentials" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -194,7 +194,7 @@ public async Task GetClusterUserCredentials_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task GetClusterMonitoringUserCredentials_GetManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersListClusterMonitoringUserCredentials.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersListClusterCredentialResult.json // this example is just showing the usage of "ManagedClusters_ListClusterMonitoringUserCredentials" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -220,7 +220,7 @@ public async Task GetClusterMonitoringUserCredentials_GetManagedCluster() [Ignore("Only validating compilation of examples")] public async Task ResetServicePrincipalProfile_ResetServicePrincipalProfile() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersResetServicePrincipalProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersResetServicePrincipalProfile.json // this example is just showing the usage of "ManagedClusters_ResetServicePrincipalProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -250,7 +250,7 @@ public async Task ResetServicePrincipalProfile_ResetServicePrincipalProfile() [Ignore("Only validating compilation of examples")] public async Task ResetAadProfile_ResetAADProfile() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersResetAADProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersResetAADProfile.json // this example is just showing the usage of "ManagedClusters_ResetAadProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -281,10 +281,10 @@ public async Task ResetAadProfile_ResetAADProfile() [Test] [Ignore("Only validating compilation of examples")] - public async Task RotateClusterCertificates_RotateClusterCertificates() + public async Task AbortLatestOperation_AbortOperationOnManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersRotateClusterCertificates.json - // this example is just showing the usage of "ManagedClusters_RotateClusterCertificates" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersAbortOperation.json + // this example is just showing the usage of "ManagedClusters_AbortLatestOperation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -300,17 +300,17 @@ public async Task RotateClusterCertificates_RotateClusterCertificates() ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); // invoke the operation - await containerServiceManagedCluster.RotateClusterCertificatesAsync(WaitUntil.Completed); + await containerServiceManagedCluster.AbortLatestOperationAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task AbortLatestOperation_AbortOperationOnManagedCluster() + public async Task RotateClusterCertificates_RotateClusterCertificates() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersAbortOperation.json - // this example is just showing the usage of "ManagedClusters_AbortLatestOperation" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersRotateClusterCertificates.json + // this example is just showing the usage of "ManagedClusters_RotateClusterCertificates" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -326,7 +326,7 @@ public async Task AbortLatestOperation_AbortOperationOnManagedCluster() ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); // invoke the operation - await containerServiceManagedCluster.AbortLatestOperationAsync(WaitUntil.Completed); + await containerServiceManagedCluster.RotateClusterCertificatesAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } @@ -335,7 +335,7 @@ public async Task AbortLatestOperation_AbortOperationOnManagedCluster() [Ignore("Only validating compilation of examples")] public async Task RotateServiceAccountSigningKeys_RotateClusterServiceAccountSigningKeys() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersRotateServiceAccountSigningKeys.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersRotateServiceAccountSigningKeys.json // this example is just showing the usage of "ManagedClusters_RotateServiceAccountSigningKeys" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -361,7 +361,7 @@ public async Task RotateServiceAccountSigningKeys_RotateClusterServiceAccountSig [Ignore("Only validating compilation of examples")] public async Task Stop_StopManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersStop.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersStop.json // this example is just showing the usage of "ManagedClusters_Stop" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -387,7 +387,7 @@ public async Task Stop_StopManagedCluster() [Ignore("Only validating compilation of examples")] public async Task Start_StartManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersStart.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersStart.json // this example is just showing the usage of "ManagedClusters_Start" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -413,7 +413,7 @@ public async Task Start_StartManagedCluster() [Ignore("Only validating compilation of examples")] public async Task RunCommand_SubmitNewCommand() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/RunCommandRequest.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/RunCommandRequest.json // this example is just showing the usage of "ManagedClusters_RunCommand" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -445,7 +445,7 @@ public async Task RunCommand_SubmitNewCommand() [Ignore("Only validating compilation of examples")] public async Task GetCommandResult_CommandFailedResult() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/RunCommandResultFailed.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/RunCommandResultFailed.json // this example is just showing the usage of "ManagedClusters_GetCommandResult" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -472,7 +472,7 @@ public async Task GetCommandResult_CommandFailedResult() [Ignore("Only validating compilation of examples")] public async Task GetCommandResult_CommandSucceedResult() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/RunCommandResultSucceed.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/RunCommandResultSucceed.json // this example is just showing the usage of "ManagedClusters_GetCommandResult" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -499,7 +499,7 @@ public async Task GetCommandResult_CommandSucceedResult() [Ignore("Only validating compilation of examples")] public async Task GetOutboundNetworkDependenciesEndpoints_ListOutboundNetworkDependenciesEndpointsByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/OutboundNetworkDependenciesEndpointsList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/OutboundNetworkDependenciesEndpointsList.json // this example is just showing the usage of "ManagedClusters_ListOutboundNetworkDependenciesEndpoints" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -524,11 +524,41 @@ public async Task GetOutboundNetworkDependenciesEndpoints_ListOutboundNetworkDep Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task RebalanceLoadBalancers_ListAgentPoolsByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/LoadBalancers_Rebalance.json + // this example is just showing the usage of "ManagedClusters_RebalanceLoadBalancers" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // invoke the operation + RebalanceLoadBalancersRequestBody rebalanceLoadBalancersRequestBody = new RebalanceLoadBalancersRequestBody + { + LoadBalancerNames = { "kubernetes" }, + }; + await containerServiceManagedCluster.RebalanceLoadBalancersAsync(WaitUntil.Completed, rebalanceLoadBalancersRequestBody); + + Console.WriteLine("Succeeded"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task GetAvailableAgentPoolVersions_GetAvailableVersionsForAgentPool() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/AgentPoolsGetAgentPoolAvailableVersions.json // this example is just showing the usage of "AgentPools_GetAvailableAgentPoolVersions" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -554,7 +584,7 @@ public async Task GetAvailableAgentPoolVersions_GetAvailableVersionsForAgentPool [Ignore("Only validating compilation of examples")] public async Task GetPrivateLinkResources_ListPrivateLinkResourcesByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateLinkResourcesList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/PrivateLinkResourcesList.json // this example is just showing the usage of "PrivateLinkResources_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -583,7 +613,7 @@ public async Task GetPrivateLinkResources_ListPrivateLinkResourcesByManagedClust [Ignore("Only validating compilation of examples")] public async Task ResolvePrivateLinkServiceId_ResolveThePrivateLinkServiceIDForManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ResolvePrivateLinkServiceId.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ResolvePrivateLinkServiceId.json // this example is just showing the usage of "ResolvePrivateLinkServiceId_Post" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -608,5 +638,61 @@ public async Task ResolvePrivateLinkServiceId_ResolveThePrivateLinkServiceIDForM Console.WriteLine($"Succeeded: {result}"); } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetOperationStatusResults_ListOfOperationStatusResult() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/OperationStatusResultList.json + // this example is just showing the usage of "OperationStatusResult_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // invoke the operation and iterate over the result + await foreach (OperationStatusResult item in containerServiceManagedCluster.GetOperationStatusResultsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetOperationStatusResult_GetOperationStatusResult() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/OperationStatusResultGet.json + // this example is just showing the usage of "OperationStatusResult_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // invoke the operation + string operationId = "00000000-0000-0000-0000-000000000001"; + OperationStatusResult result = await containerServiceManagedCluster.GetOperationStatusResultAsync(operationId); + + Console.WriteLine($"Succeeded: {result}"); + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionCollection.cs index c86354e22e27..90a07a65427a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServicePrivateEndpointConnectionCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_UpdatePrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsUpdate.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/PrivateEndpointConnectionsUpdate.json // this example is just showing the usage of "PrivateEndpointConnections_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -62,7 +62,7 @@ public async Task CreateOrUpdate_UpdatePrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task Get_GetPrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/PrivateEndpointConnectionsGet.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -96,7 +96,7 @@ public async Task Get_GetPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListPrivateEndpointConnectionsByManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/PrivateEndpointConnectionsList.json // this example is just showing the usage of "PrivateEndpointConnections_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -132,7 +132,7 @@ public async Task GetAll_ListPrivateEndpointConnectionsByManagedCluster() [Ignore("Only validating compilation of examples")] public async Task Exists_GetPrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/PrivateEndpointConnectionsGet.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -162,7 +162,7 @@ public async Task Exists_GetPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetPrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/PrivateEndpointConnectionsGet.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionResource.cs index 9e5acc67aca0..df60d5b25b20 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServicePrivateEndpointConnectionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ContainerServicePrivateEndpointConnectionResource [Ignore("Only validating compilation of examples")] public async Task Get_GetPrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsGet.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/PrivateEndpointConnectionsGet.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task Delete_DeletePrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsDelete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/PrivateEndpointConnectionsDelete.json // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_DeletePrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task Update_UpdatePrivateEndpointConnection() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/PrivateEndpointConnectionsUpdate.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/PrivateEndpointConnectionsUpdate.json // this example is just showing the usage of "PrivateEndpointConnections_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingCollection.cs index 0b58e1ae96a7..30d254dbd597 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_ContainerServiceTrustedAccessRoleBindingCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateOrUpdateATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_CreateOrUpdate.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/TrustedAccessRoleBindings_CreateOrUpdate.json // this example is just showing the usage of "TrustedAccessRoleBindings_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task CreateOrUpdate_CreateOrUpdateATrustedAccessRoleBinding() [Ignore("Only validating compilation of examples")] public async Task Get_GetATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_Get.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/TrustedAccessRoleBindings_Get.json // this example is just showing the usage of "TrustedAccessRoleBindings_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task Get_GetATrustedAccessRoleBinding() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListTrustedAccessRoleBindings() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_List.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/TrustedAccessRoleBindings_List.json // this example is just showing the usage of "TrustedAccessRoleBindings_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task GetAll_ListTrustedAccessRoleBindings() [Ignore("Only validating compilation of examples")] public async Task Exists_GetATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_Get.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/TrustedAccessRoleBindings_Get.json // this example is just showing the usage of "TrustedAccessRoleBindings_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -155,7 +155,7 @@ public async Task Exists_GetATrustedAccessRoleBinding() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_Get.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/TrustedAccessRoleBindings_Get.json // this example is just showing the usage of "TrustedAccessRoleBindings_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingResource.cs index 6d9666b3d4c5..69e001bba26f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ContainerServiceTrustedAccessRoleBindingResource.cs @@ -19,7 +19,7 @@ public partial class Sample_ContainerServiceTrustedAccessRoleBindingResource [Ignore("Only validating compilation of examples")] public async Task Get_GetATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_Get.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/TrustedAccessRoleBindings_Get.json // this example is just showing the usage of "TrustedAccessRoleBindings_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetATrustedAccessRoleBinding() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_Delete.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/TrustedAccessRoleBindings_Delete.json // this example is just showing the usage of "TrustedAccessRoleBindings_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -77,7 +77,7 @@ public async Task Delete_DeleteATrustedAccessRoleBinding() [Ignore("Only validating compilation of examples")] public async Task Update_CreateOrUpdateATrustedAccessRoleBinding() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoleBindings_CreateOrUpdate.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/TrustedAccessRoleBindings_CreateOrUpdate.json // this example is just showing the usage of "TrustedAccessRoleBindings_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_GuardrailsAvailableVersionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_GuardrailsAvailableVersionCollection.cs new file mode 100644 index 000000000000..ae3a3e23b726 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_GuardrailsAvailableVersionCollection.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_GuardrailsAvailableVersionCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetGuardrailsAvailableVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/GetGuardrailsVersions.json + // this example is just showing the usage of "ManagedClusters_GetGuardrailsVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this GuardrailsAvailableVersionResource + AzureLocation location = new AzureLocation("location1"); + GuardrailsAvailableVersionCollection collection = subscriptionResource.GetGuardrailsAvailableVersions(location); + + // invoke the operation + string version = "v1.0.0"; + GuardrailsAvailableVersionResource result = await collection.GetAsync(version); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuardrailsAvailableVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListGuardrailsVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ListGuardrailsVersions.json + // this example is just showing the usage of "ManagedClusters_ListGuardrailsVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this GuardrailsAvailableVersionResource + AzureLocation location = new AzureLocation("location1"); + GuardrailsAvailableVersionCollection collection = subscriptionResource.GetGuardrailsAvailableVersions(location); + + // invoke the operation and iterate over the result + await foreach (GuardrailsAvailableVersionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuardrailsAvailableVersionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetGuardrailsAvailableVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/GetGuardrailsVersions.json + // this example is just showing the usage of "ManagedClusters_GetGuardrailsVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this GuardrailsAvailableVersionResource + AzureLocation location = new AzureLocation("location1"); + GuardrailsAvailableVersionCollection collection = subscriptionResource.GetGuardrailsAvailableVersions(location); + + // invoke the operation + string version = "v1.0.0"; + bool result = await collection.ExistsAsync(version); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetGuardrailsAvailableVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/GetGuardrailsVersions.json + // this example is just showing the usage of "ManagedClusters_GetGuardrailsVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this GuardrailsAvailableVersionResource + AzureLocation location = new AzureLocation("location1"); + GuardrailsAvailableVersionCollection collection = subscriptionResource.GetGuardrailsAvailableVersions(location); + + // invoke the operation + string version = "v1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(version); + GuardrailsAvailableVersionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuardrailsAvailableVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_GuardrailsAvailableVersionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_GuardrailsAvailableVersionResource.cs new file mode 100644 index 000000000000..1003f77f95bb --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_GuardrailsAvailableVersionResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_GuardrailsAvailableVersionResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetGuardrailsAvailableVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/GetGuardrailsVersions.json + // this example is just showing the usage of "ManagedClusters_GetGuardrailsVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GuardrailsAvailableVersionResource created on azure + // for more information of creating GuardrailsAvailableVersionResource, please refer to the document of GuardrailsAvailableVersionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + AzureLocation location = new AzureLocation("location1"); + string version = "v1.0.0"; + ResourceIdentifier guardrailsAvailableVersionResourceId = GuardrailsAvailableVersionResource.CreateResourceIdentifier(subscriptionId, location, version); + GuardrailsAvailableVersionResource guardrailsAvailableVersion = client.GetGuardrailsAvailableVersionResource(guardrailsAvailableVersionResourceId); + + // invoke the operation + GuardrailsAvailableVersionResource result = await guardrailsAvailableVersion.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuardrailsAvailableVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_LoadBalancerCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_LoadBalancerCollection.cs new file mode 100644 index 000000000000..5abc8a1b804a --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_LoadBalancerCollection.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_LoadBalancerCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateALoadBalancer() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/LoadBalancers_Create_Or_Update.json + // this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this LoadBalancerResource + LoadBalancerCollection collection = containerServiceManagedCluster.GetLoadBalancers(); + + // invoke the operation + string loadBalancerName = "kubernetes"; + LoadBalancerData data = new LoadBalancerData + { + PrimaryAgentPoolName = "agentpool1", + AllowServicePlacement = true, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data); + LoadBalancerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LoadBalancerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetLoadBalancer() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/LoadBalancers_Get.json + // this example is just showing the usage of "LoadBalancers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this LoadBalancerResource + LoadBalancerCollection collection = containerServiceManagedCluster.GetLoadBalancers(); + + // invoke the operation + string loadBalancerName = "kubernetes"; + LoadBalancerResource result = await collection.GetAsync(loadBalancerName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LoadBalancerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListLoadBalancersByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/LoadBalancers_List.json + // this example is just showing the usage of "LoadBalancers_ListByManagedCluster" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this LoadBalancerResource + LoadBalancerCollection collection = containerServiceManagedCluster.GetLoadBalancers(); + + // invoke the operation and iterate over the result + await foreach (LoadBalancerResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LoadBalancerData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetLoadBalancer() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/LoadBalancers_Get.json + // this example is just showing the usage of "LoadBalancers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this LoadBalancerResource + LoadBalancerCollection collection = containerServiceManagedCluster.GetLoadBalancers(); + + // invoke the operation + string loadBalancerName = "kubernetes"; + bool result = await collection.ExistsAsync(loadBalancerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetLoadBalancer() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/LoadBalancers_Get.json + // this example is just showing the usage of "LoadBalancers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this LoadBalancerResource + LoadBalancerCollection collection = containerServiceManagedCluster.GetLoadBalancers(); + + // invoke the operation + string loadBalancerName = "kubernetes"; + NullableResponse response = await collection.GetIfExistsAsync(loadBalancerName); + LoadBalancerResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LoadBalancerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_LoadBalancerResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_LoadBalancerResource.cs new file mode 100644 index 000000000000..4af6300d4cfd --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_LoadBalancerResource.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_LoadBalancerResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetLoadBalancer() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/LoadBalancers_Get.json + // this example is just showing the usage of "LoadBalancers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this LoadBalancerResource created on azure + // for more information of creating LoadBalancerResource, please refer to the document of LoadBalancerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string loadBalancerName = "kubernetes"; + ResourceIdentifier loadBalancerResourceId = LoadBalancerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, loadBalancerName); + LoadBalancerResource loadBalancer = client.GetLoadBalancerResource(loadBalancerResourceId); + + // invoke the operation + LoadBalancerResource result = await loadBalancer.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LoadBalancerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteALoadBalancer() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/LoadBalancers_Delete.json + // this example is just showing the usage of "LoadBalancers_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this LoadBalancerResource created on azure + // for more information of creating LoadBalancerResource, please refer to the document of LoadBalancerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string loadBalancerName = "kubernetes"; + ResourceIdentifier loadBalancerResourceId = LoadBalancerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, loadBalancerName); + LoadBalancerResource loadBalancer = client.GetLoadBalancerResource(loadBalancerResourceId); + + // invoke the operation + await loadBalancer.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateALoadBalancer() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/LoadBalancers_Create_Or_Update.json + // this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this LoadBalancerResource created on azure + // for more information of creating LoadBalancerResource, please refer to the document of LoadBalancerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string loadBalancerName = "kubernetes"; + ResourceIdentifier loadBalancerResourceId = LoadBalancerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, loadBalancerName); + LoadBalancerResource loadBalancer = client.GetLoadBalancerResource(loadBalancerResourceId); + + // invoke the operation + LoadBalancerData data = new LoadBalancerData + { + PrimaryAgentPoolName = "agentpool1", + AllowServicePlacement = true, + }; + ArmOperation lro = await loadBalancer.UpdateAsync(WaitUntil.Completed, data); + LoadBalancerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LoadBalancerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineCollection.cs new file mode 100644 index 000000000000..519ba042a6b9 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineCollection.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_MachineCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetAMachineInAnAgentPoolsByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MachineGet.json + // this example is just showing the usage of "Machines_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // get the collection of this MachineResource + MachineCollection collection = containerServiceAgentPool.GetMachines(); + + // invoke the operation + string machineName = "aks-nodepool1-42263519-vmss00000t"; + MachineResource result = await collection.GetAsync(machineName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListMachinesInAnAgentpoolByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MachineList.json + // this example is just showing the usage of "Machines_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // get the collection of this MachineResource + MachineCollection collection = containerServiceAgentPool.GetMachines(); + + // invoke the operation and iterate over the result + await foreach (MachineResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MachineData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetAMachineInAnAgentPoolsByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MachineGet.json + // this example is just showing the usage of "Machines_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // get the collection of this MachineResource + MachineCollection collection = containerServiceAgentPool.GetMachines(); + + // invoke the operation + string machineName = "aks-nodepool1-42263519-vmss00000t"; + bool result = await collection.ExistsAsync(machineName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetAMachineInAnAgentPoolsByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MachineGet.json + // this example is just showing the usage of "Machines_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceAgentPoolResource created on azure + // for more information of creating ContainerServiceAgentPoolResource, please refer to the document of ContainerServiceAgentPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + ResourceIdentifier containerServiceAgentPoolResourceId = ContainerServiceAgentPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName); + ContainerServiceAgentPoolResource containerServiceAgentPool = client.GetContainerServiceAgentPoolResource(containerServiceAgentPoolResourceId); + + // get the collection of this MachineResource + MachineCollection collection = containerServiceAgentPool.GetMachines(); + + // invoke the operation + string machineName = "aks-nodepool1-42263519-vmss00000t"; + NullableResponse response = await collection.GetIfExistsAsync(machineName); + MachineResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineResource.cs new file mode 100644 index 000000000000..3b1ef6a762c2 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MachineResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_MachineResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetAMachineInAnAgentPoolsByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/MachineGet.json + // this example is just showing the usage of "Machines_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MachineResource created on azure + // for more information of creating MachineResource, please refer to the document of MachineResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string agentPoolName = "agentpool1"; + string machineName = "aks-nodepool1-42263519-vmss00000t"; + ResourceIdentifier machineResourceId = MachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, agentPoolName, machineName); + MachineResource machine = client.GetMachineResource(machineResourceId); + + // invoke the operation + MachineResource result = await machine.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterSnapshotCollection.cs new file mode 100644 index 000000000000..4b6eef4ae8c6 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterSnapshotCollection.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_ManagedClusterSnapshotCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateUpdateManagedClusterSnapshot() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClusterSnapshotsCreate.json + // this example is just showing the usage of "ManagedClusterSnapshots_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedClusterSnapshotResource + ManagedClusterSnapshotCollection collection = resourceGroupResource.GetManagedClusterSnapshots(); + + // invoke the operation + string resourceName = "snapshot1"; + ManagedClusterSnapshotData data = new ManagedClusterSnapshotData(new AzureLocation("westus")) + { + CreationDataSourceResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1"), + Tags = +{ +["key1"] = "val1", +["key2"] = "val2" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + ManagedClusterSnapshotResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedClusterSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetManagedClusterSnapshot() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClusterSnapshotsGet.json + // this example is just showing the usage of "ManagedClusterSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedClusterSnapshotResource + ManagedClusterSnapshotCollection collection = resourceGroupResource.GetManagedClusterSnapshots(); + + // invoke the operation + string resourceName = "snapshot1"; + ManagedClusterSnapshotResource result = await collection.GetAsync(resourceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedClusterSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListManagedClusterSnapshotsByResourceGroup() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClusterSnapshotsListByResourceGroup.json + // this example is just showing the usage of "ManagedClusterSnapshots_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedClusterSnapshotResource + ManagedClusterSnapshotCollection collection = resourceGroupResource.GetManagedClusterSnapshots(); + + // invoke the operation and iterate over the result + await foreach (ManagedClusterSnapshotResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedClusterSnapshotData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetManagedClusterSnapshot() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClusterSnapshotsGet.json + // this example is just showing the usage of "ManagedClusterSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedClusterSnapshotResource + ManagedClusterSnapshotCollection collection = resourceGroupResource.GetManagedClusterSnapshots(); + + // invoke the operation + string resourceName = "snapshot1"; + bool result = await collection.ExistsAsync(resourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetManagedClusterSnapshot() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClusterSnapshotsGet.json + // this example is just showing the usage of "ManagedClusterSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedClusterSnapshotResource + ManagedClusterSnapshotCollection collection = resourceGroupResource.GetManagedClusterSnapshots(); + + // invoke the operation + string resourceName = "snapshot1"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + ManagedClusterSnapshotResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedClusterSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterSnapshotResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterSnapshotResource.cs new file mode 100644 index 000000000000..64ac7591ffe2 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterSnapshotResource.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.ContainerService.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_ManagedClusterSnapshotResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetManagedClusterSnapshot() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClusterSnapshotsGet.json + // this example is just showing the usage of "ManagedClusterSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagedClusterSnapshotResource created on azure + // for more information of creating ManagedClusterSnapshotResource, please refer to the document of ManagedClusterSnapshotResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "snapshot1"; + ResourceIdentifier managedClusterSnapshotResourceId = ManagedClusterSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ManagedClusterSnapshotResource managedClusterSnapshot = client.GetManagedClusterSnapshotResource(managedClusterSnapshotResourceId); + + // invoke the operation + ManagedClusterSnapshotResource result = await managedClusterSnapshot.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedClusterSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteManagedClusterSnapshot() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClusterSnapshotsDelete.json + // this example is just showing the usage of "ManagedClusterSnapshots_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagedClusterSnapshotResource created on azure + // for more information of creating ManagedClusterSnapshotResource, please refer to the document of ManagedClusterSnapshotResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "snapshot1"; + ResourceIdentifier managedClusterSnapshotResourceId = ManagedClusterSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ManagedClusterSnapshotResource managedClusterSnapshot = client.GetManagedClusterSnapshotResource(managedClusterSnapshotResourceId); + + // invoke the operation + await managedClusterSnapshot.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateManagedClusterSnapshotTags() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClusterSnapshotsUpdateTags.json + // this example is just showing the usage of "ManagedClusterSnapshots_UpdateTags" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagedClusterSnapshotResource created on azure + // for more information of creating ManagedClusterSnapshotResource, please refer to the document of ManagedClusterSnapshotResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "snapshot1"; + ResourceIdentifier managedClusterSnapshotResourceId = ManagedClusterSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ManagedClusterSnapshotResource managedClusterSnapshot = client.GetManagedClusterSnapshotResource(managedClusterSnapshotResourceId); + + // invoke the operation + ContainerServiceTagsObject containerServiceTagsObject = new ContainerServiceTagsObject + { + Tags = +{ +["key2"] = "new-val2", +["key3"] = "val3" +}, + }; + ManagedClusterSnapshotResource result = await managedClusterSnapshot.UpdateAsync(containerServiceTagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedClusterSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterUpgradeProfileResource.cs index 0481cdaf7948..f37c8f9dde0a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_ManagedClusterUpgradeProfileResource.cs @@ -19,7 +19,7 @@ public partial class Sample_ManagedClusterUpgradeProfileResource [Ignore("Only validating compilation of examples")] public async Task Get_GetUpgradeProfileForManagedCluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGetUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGetUpgradeProfile.json // this example is just showing the usage of "ManagedClusters_GetUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileCollection.cs index a12ea79e1106..c449183aced5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_MeshRevisionProfileCollection [Ignore("Only validating compilation of examples")] public async Task Get_GetAMeshRevisionProfileForAMeshMode() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshRevisionProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet_MeshRevisionProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshRevisionProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task Get_GetAMeshRevisionProfileForAMeshMode() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListMeshRevisionProfilesInALocation() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersList_MeshRevisionProfiles.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersList_MeshRevisionProfiles.json // this example is just showing the usage of "ManagedClusters_ListMeshRevisionProfiles" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +88,7 @@ public async Task GetAll_ListMeshRevisionProfilesInALocation() [Ignore("Only validating compilation of examples")] public async Task Exists_GetAMeshRevisionProfileForAMeshMode() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshRevisionProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet_MeshRevisionProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshRevisionProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -117,7 +117,7 @@ public async Task Exists_GetAMeshRevisionProfileForAMeshMode() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetAMeshRevisionProfileForAMeshMode() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshRevisionProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet_MeshRevisionProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshRevisionProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileResource.cs index 8e0938d5a73e..a8116e7a3cdc 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshRevisionProfileResource.cs @@ -19,7 +19,7 @@ public partial class Sample_MeshRevisionProfileResource [Ignore("Only validating compilation of examples")] public async Task Get_GetAMeshRevisionProfileForAMeshMode() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshRevisionProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet_MeshRevisionProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshRevisionProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileCollection.cs index 53dc0a0a6d5c..f04f749b4779 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_MeshUpgradeProfileCollection [Ignore("Only validating compilation of examples")] public async Task Get_GetsVersionCompatibilityAndUpgradeProfileForAServiceMeshInACluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet_MeshUpgradeProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task Get_GetsVersionCompatibilityAndUpgradeProfileForAServiceMeshIn [Ignore("Only validating compilation of examples")] public async Task GetAll_ListsVersionCompatibilityAndUpgradeProfileForAllServiceMeshesInACluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersList_MeshUpgradeProfiles.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersList_MeshUpgradeProfiles.json // this example is just showing the usage of "ManagedClusters_ListMeshUpgradeProfiles" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task GetAll_ListsVersionCompatibilityAndUpgradeProfileForAllService [Ignore("Only validating compilation of examples")] public async Task Exists_GetsVersionCompatibilityAndUpgradeProfileForAServiceMeshInACluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet_MeshUpgradeProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -119,7 +119,7 @@ public async Task Exists_GetsVersionCompatibilityAndUpgradeProfileForAServiceMes [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetsVersionCompatibilityAndUpgradeProfileForAServiceMeshInACluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet_MeshUpgradeProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileResource.cs index d2e1b5438892..a4af9431cef8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_MeshUpgradeProfileResource.cs @@ -19,7 +19,7 @@ public partial class Sample_MeshUpgradeProfileResource [Ignore("Only validating compilation of examples")] public async Task Get_GetsVersionCompatibilityAndUpgradeProfileForAServiceMeshInACluster() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersGet_MeshUpgradeProfile.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersGet_MeshUpgradeProfile.json // this example is just showing the usage of "ManagedClusters_GetMeshUpgradeProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_NamespaceCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_NamespaceCollection.cs new file mode 100644 index 000000000000..c9a343397108 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_NamespaceCollection.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.ContainerService.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_NamespaceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateUpdateNamespace() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/NamespacesCreate_Update.json + // this example is just showing the usage of "Namespaces_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this NamespaceResource + NamespaceCollection collection = containerServiceManagedCluster.GetNamespaces(); + + // invoke the operation + string namespaceName = "namespace1"; + NamespaceData data = new NamespaceData(default) + { + Properties = new NamespaceProperties + { + Labels = +{ +["kubernetes.io/metadata.name"] = "true" +}, + Annotations = +{ +["annatationKey"] = "annatationValue" +}, + DefaultResourceQuota = new ResourceQuota + { + CpuRequest = "3m", + CpuLimit = "3m", + MemoryRequest = "5Gi", + MemoryLimit = "5Gi", + }, + DefaultNetworkPolicy = new NetworkPolicies + { + Ingress = PolicyRule.AllowSameNamespace, + Egress = PolicyRule.AllowAll, + }, + AdoptionPolicy = AdoptionPolicy.IfIdentical, + DeletePolicy = DeletePolicy.Keep, + }, + Tags = +{ +["tagKey1"] = "tagValue1" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namespaceName, data); + NamespaceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetNamespace() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/NamespacesGet.json + // this example is just showing the usage of "Namespaces_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this NamespaceResource + NamespaceCollection collection = containerServiceManagedCluster.GetNamespaces(); + + // invoke the operation + string namespaceName = "namespace1"; + NamespaceResource result = await collection.GetAsync(namespaceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListNamespacesByManagedCluster() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/NamespacesList.json + // this example is just showing the usage of "Namespaces_ListByManagedCluster" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this NamespaceResource + NamespaceCollection collection = containerServiceManagedCluster.GetNamespaces(); + + // invoke the operation and iterate over the result + await foreach (NamespaceResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NamespaceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetNamespace() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/NamespacesGet.json + // this example is just showing the usage of "Namespaces_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this NamespaceResource + NamespaceCollection collection = containerServiceManagedCluster.GetNamespaces(); + + // invoke the operation + string namespaceName = "namespace1"; + bool result = await collection.ExistsAsync(namespaceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetNamespace() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/NamespacesGet.json + // this example is just showing the usage of "Namespaces_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerServiceManagedClusterResource created on azure + // for more information of creating ContainerServiceManagedClusterResource, please refer to the document of ContainerServiceManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + ResourceIdentifier containerServiceManagedClusterResourceId = ContainerServiceManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ContainerServiceManagedClusterResource containerServiceManagedCluster = client.GetContainerServiceManagedClusterResource(containerServiceManagedClusterResourceId); + + // get the collection of this NamespaceResource + NamespaceCollection collection = containerServiceManagedCluster.GetNamespaces(); + + // invoke the operation + string namespaceName = "namespace1"; + NullableResponse response = await collection.GetIfExistsAsync(namespaceName); + NamespaceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_NamespaceResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_NamespaceResource.cs new file mode 100644 index 000000000000..d2106815e3ac --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_NamespaceResource.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.ContainerService.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_NamespaceResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetNamespace() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/NamespacesGet.json + // this example is just showing the usage of "Namespaces_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NamespaceResource created on azure + // for more information of creating NamespaceResource, please refer to the document of NamespaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string namespaceName = "namespace1"; + ResourceIdentifier namespaceResourceId = NamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, namespaceName); + NamespaceResource @namespace = client.GetNamespaceResource(namespaceResourceId); + + // invoke the operation + NamespaceResource result = await @namespace.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteNamespace() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/NamespacesDelete.json + // this example is just showing the usage of "Namespaces_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NamespaceResource created on azure + // for more information of creating NamespaceResource, please refer to the document of NamespaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string namespaceName = "namespace1"; + ResourceIdentifier namespaceResourceId = NamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, namespaceName); + NamespaceResource @namespace = client.GetNamespaceResource(namespaceResourceId); + + // invoke the operation + await @namespace.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateNamespaceTags() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/NamespacesUpdateTags.json + // this example is just showing the usage of "Namespaces_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NamespaceResource created on azure + // for more information of creating NamespaceResource, please refer to the document of NamespaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string namespaceName = "namespace1"; + ResourceIdentifier namespaceResourceId = NamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, namespaceName); + NamespaceResource @namespace = client.GetNamespaceResource(namespaceResourceId); + + // invoke the operation + ContainerServiceTagsObject containerServiceTagsObject = new ContainerServiceTagsObject + { + Tags = +{ +["tagKey1"] = "tagValue1", +["tagKey2"] = "tagValue2" +}, + }; + NamespaceResource result = await @namespace.UpdateAsync(containerServiceTagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetCredential_ListNamespaceCredentials() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/NamespacesListCredentialResult.json + // this example is just showing the usage of "Namespaces_ListCredential" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NamespaceResource created on azure + // for more information of creating NamespaceResource, please refer to the document of NamespaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string resourceName = "clustername1"; + string namespaceName = "namespace1"; + ResourceIdentifier namespaceResourceId = NamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, namespaceName); + NamespaceResource @namespace = client.GetNamespaceResource(namespaceResourceId); + + // invoke the operation + ManagedClusterCredentials result = await @namespace.GetCredentialAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SafeguardsAvailableVersionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SafeguardsAvailableVersionCollection.cs new file mode 100644 index 000000000000..ba696399ffda --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SafeguardsAvailableVersionCollection.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_SafeguardsAvailableVersionCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetSafeguardsAvailableVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/GetSafeguardsVersions.json + // this example is just showing the usage of "ManagedClusters_GetSafeguardsVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SafeguardsAvailableVersionResource + AzureLocation location = new AzureLocation("location1"); + SafeguardsAvailableVersionCollection collection = subscriptionResource.GetSafeguardsAvailableVersions(location); + + // invoke the operation + string version = "v1.0.0"; + SafeguardsAvailableVersionResource result = await collection.GetAsync(version); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SafeguardsAvailableVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListSafeguardsVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ListSafeguardsVersions.json + // this example is just showing the usage of "ManagedClusters_ListSafeguardsVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SafeguardsAvailableVersionResource + AzureLocation location = new AzureLocation("location1"); + SafeguardsAvailableVersionCollection collection = subscriptionResource.GetSafeguardsAvailableVersions(location); + + // invoke the operation and iterate over the result + await foreach (SafeguardsAvailableVersionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SafeguardsAvailableVersionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetSafeguardsAvailableVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/GetSafeguardsVersions.json + // this example is just showing the usage of "ManagedClusters_GetSafeguardsVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SafeguardsAvailableVersionResource + AzureLocation location = new AzureLocation("location1"); + SafeguardsAvailableVersionCollection collection = subscriptionResource.GetSafeguardsAvailableVersions(location); + + // invoke the operation + string version = "v1.0.0"; + bool result = await collection.ExistsAsync(version); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetSafeguardsAvailableVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/GetSafeguardsVersions.json + // this example is just showing the usage of "ManagedClusters_GetSafeguardsVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SafeguardsAvailableVersionResource + AzureLocation location = new AzureLocation("location1"); + SafeguardsAvailableVersionCollection collection = subscriptionResource.GetSafeguardsAvailableVersions(location); + + // invoke the operation + string version = "v1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(version); + SafeguardsAvailableVersionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SafeguardsAvailableVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SafeguardsAvailableVersionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SafeguardsAvailableVersionResource.cs new file mode 100644 index 000000000000..91886d67059d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SafeguardsAvailableVersionResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_SafeguardsAvailableVersionResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetSafeguardsAvailableVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/GetSafeguardsVersions.json + // this example is just showing the usage of "ManagedClusters_GetSafeguardsVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SafeguardsAvailableVersionResource created on azure + // for more information of creating SafeguardsAvailableVersionResource, please refer to the document of SafeguardsAvailableVersionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + AzureLocation location = new AzureLocation("location1"); + string version = "v1.0.0"; + ResourceIdentifier safeguardsAvailableVersionResourceId = SafeguardsAvailableVersionResource.CreateResourceIdentifier(subscriptionId, location, version); + SafeguardsAvailableVersionResource safeguardsAvailableVersion = client.GetSafeguardsAvailableVersionResource(safeguardsAvailableVersionResourceId); + + // invoke the operation + SafeguardsAvailableVersionResource result = await safeguardsAvailableVersion.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SafeguardsAvailableVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index d4e1e40228ea..9f489770186c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -21,7 +21,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetKubernetesVersionsManagedCluster_ListKubernetesVersions() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/KubernetesVersions_List.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/KubernetesVersions_List.json // this example is just showing the usage of "ManagedClusters_ListKubernetesVersions" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -46,7 +46,7 @@ public async Task GetKubernetesVersionsManagedCluster_ListKubernetesVersions() [Ignore("Only validating compilation of examples")] public async Task GetContainerServiceManagedClusters_ListManagedClusters() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/ManagedClustersList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClustersList.json // this example is just showing the usage of "ManagedClusters_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -73,11 +73,39 @@ public async Task GetContainerServiceManagedClusters_ListManagedClusters() Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetNodeImageVersionsContainerServices_ListNodeImageVersions() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/NodeImageVersions_List.json + // this example is just showing the usage of "ContainerService_ListNodeImageVersions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + AzureLocation location = new AzureLocation("location1"); + await foreach (NodeImageVersion item in subscriptionResource.GetNodeImageVersionsContainerServicesAsync(location)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task GetAgentPoolSnapshots_ListSnapshots() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/SnapshotsList.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/SnapshotsList.json // this example is just showing the usage of "Snapshots_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -104,11 +132,42 @@ public async Task GetAgentPoolSnapshots_ListSnapshots() Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetManagedClusterSnapshots_ListManagedClusterSnapshots() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/ManagedClusterSnapshotsList.json + // this example is just showing the usage of "ManagedClusterSnapshots_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (ManagedClusterSnapshotResource item in subscriptionResource.GetManagedClusterSnapshotsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedClusterSnapshotData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task GetTrustedAccessRoles_ListTrustedAccessRoles() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/examples/TrustedAccessRoles_List.json + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2025-03-02-preview/examples/TrustedAccessRoles_List.json // this example is just showing the usage of "TrustedAccessRoles_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs index 327b8b63ae23..891edd60fb4f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdat /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string r /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string resourceName, Canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -287,7 +287,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -317,7 +317,7 @@ public virtual Pageable GetAll(CancellationToken canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -360,7 +360,7 @@ public virtual async Task> ExistsAsync(string resourceName, Cance /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -403,7 +403,7 @@ public virtual Response Exists(string resourceName, CancellationToken canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -448,7 +448,7 @@ public virtual async Task> GetIfExis /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs index 64208b02be45..510d0f55c8fe 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs @@ -69,7 +69,7 @@ public AgentPoolSnapshotData(AzureLocation location) : base(location) /// The version of Kubernetes. /// The version of node image. /// The operating system type. The default is Linux. - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. /// The size of the VM. /// Whether to use a FIPS-enabled OS. /// Keeps track of any properties unknown to the library. @@ -118,7 +118,7 @@ public ResourceIdentifier CreationDataSourceResourceId /// The operating system type. The default is Linux. [WirePath("properties.osType")] public ContainerServiceOSType? OSType { get; } - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. [WirePath("properties.osSku")] public ContainerServiceOSSku? OSSku { get; } /// The size of the VM. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs index 6045d3413e5b..c7694b0b8689 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> GetAsync(Cancella /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(CancellationToken cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -227,7 +227,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -271,7 +271,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -313,7 +313,7 @@ public virtual async Task> UpdateAsync(Conta /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual Response Update(ContainerServiceTagsOb /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -417,7 +417,7 @@ public virtual async Task> AddTagAsync(strin /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -479,7 +479,7 @@ public virtual Response AddTag(string key, string val /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -536,7 +536,7 @@ public virtual async Task> SetTagsAsync(IDic /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -593,7 +593,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -653,7 +653,7 @@ public virtual async Task> RemoveTagAsync(st /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.Serialization.cs index d12f3b4d035b..7fcf528a88ff 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.Serialization.cs @@ -55,6 +55,16 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } writer.WriteEndArray(); } + if (Optional.IsCollectionDefined(ComponentsByReleases)) + { + writer.WritePropertyName("componentsByReleases"u8); + writer.WriteStartArray(); + foreach (var item in ComponentsByReleases) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } if (Optional.IsDefined(LatestNodeImageVersion)) { writer.WritePropertyName("latestNodeImageVersion"u8); @@ -90,6 +100,7 @@ internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileDa string kubernetesVersion = default; ContainerServiceOSType osType = default; IReadOnlyList upgrades = default; + IReadOnlyList componentsByReleases = default; string latestNodeImageVersion = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -152,6 +163,20 @@ internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileDa upgrades = array; continue; } + if (property0.NameEquals("componentsByReleases"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ComponentsByRelease.DeserializeComponentsByRelease(item, options)); + } + componentsByReleases = array; + continue; + } if (property0.NameEquals("latestNodeImageVersion"u8)) { latestNodeImageVersion = property0.Value.GetString(); @@ -174,6 +199,7 @@ internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileDa kubernetesVersion, osType, upgrades ?? new ChangeTrackingList(), + componentsByReleases ?? new ChangeTrackingList(), latestNodeImageVersion, serializedAdditionalRawData); } @@ -302,6 +328,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ComponentsByReleases), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" componentsByReleases: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ComponentsByReleases)) + { + if (ComponentsByReleases.Any()) + { + builder.Append(" componentsByReleases: "); + builder.AppendLine("["); + foreach (var item in ComponentsByReleases) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " componentsByReleases: "); + } + builder.AppendLine(" ]"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LatestNodeImageVersion), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs index f38a54871b37..6b620e24786a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs @@ -62,6 +62,7 @@ internal AgentPoolUpgradeProfileData(string kubernetesVersion, ContainerServiceO KubernetesVersion = kubernetesVersion; OSType = osType; Upgrades = new ChangeTrackingList(); + ComponentsByReleases = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -72,13 +73,15 @@ internal AgentPoolUpgradeProfileData(string kubernetesVersion, ContainerServiceO /// The Kubernetes version (major.minor.patch). /// The operating system type. The default is Linux. /// List of orchestrator types and versions available for upgrade. + /// List of components grouped by kubernetes major.minor version. /// The latest AKS supported node image version. /// Keeps track of any properties unknown to the library. - internal AgentPoolUpgradeProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kubernetesVersion, ContainerServiceOSType osType, IReadOnlyList upgrades, string latestNodeImageVersion, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal AgentPoolUpgradeProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kubernetesVersion, ContainerServiceOSType osType, IReadOnlyList upgrades, IReadOnlyList componentsByReleases, string latestNodeImageVersion, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { KubernetesVersion = kubernetesVersion; OSType = osType; Upgrades = upgrades; + ComponentsByReleases = componentsByReleases; LatestNodeImageVersion = latestNodeImageVersion; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -97,6 +100,9 @@ internal AgentPoolUpgradeProfileData() /// List of orchestrator types and versions available for upgrade. [WirePath("properties.upgrades")] public IReadOnlyList Upgrades { get; } + /// List of components grouped by kubernetes major.minor version. + [WirePath("properties.componentsByReleases")] + public IReadOnlyList ComponentsByReleases { get; } /// The latest AKS supported node image version. [WirePath("properties.latestNodeImageVersion")] public string LatestNodeImageVersion { get; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs index 9c357b37cb3d..f44a5ee085dc 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync(Ca /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs index d8ce03a6d98a..b32c1f4ef60d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Net; using Azure.Core; @@ -18,35 +19,6 @@ namespace Azure.ResourceManager.ContainerService.Models /// Model factory for models. public static partial class ArmContainerServiceModelFactory { - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The list of OS options. - /// A new instance for mocking. - public static OSOptionProfileData OSOptionProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable osOptionPropertyList = null) - { - osOptionPropertyList ??= new List(); - - return new OSOptionProfileData( - id, - name, - resourceType, - systemData, - osOptionPropertyList?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The OS type. - /// Whether the image is FIPS-enabled. - /// A new instance for mocking. - public static ContainerServiceOSOptionProperty ContainerServiceOSOptionProperty(string osType = null, bool enableFipsImage = default) - { - return new ContainerServiceOSOptionProperty(osType, enableFipsImage, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// Array of AKS supported Kubernetes versions. /// A new instance for mocking. @@ -60,15 +32,22 @@ public static KubernetesVersionListResult KubernetesVersionListResult(IEnumerabl /// Initializes a new instance of . /// major.minor version of Kubernetes release. /// Capabilities on this Kubernetes version. + /// Whether this version is default. /// Whether this version is in preview mode. /// Patch versions of Kubernetes release. /// A new instance for mocking. - public static KubernetesVersion KubernetesVersion(string version = null, IEnumerable capabilitiesSupportPlan = null, bool? isPreview = null, IReadOnlyDictionary patchVersions = null) + public static KubernetesVersion KubernetesVersion(string version = null, IEnumerable capabilitiesSupportPlan = null, bool? isDefault = null, bool? isPreview = null, IReadOnlyDictionary patchVersions = null) { capabilitiesSupportPlan ??= new List(); patchVersions ??= new Dictionary(); - return new KubernetesVersion(version, capabilitiesSupportPlan != null ? new KubernetesVersionCapabilities(capabilitiesSupportPlan?.ToList(), serializedAdditionalRawData: null) : null, isPreview, patchVersions, serializedAdditionalRawData: null); + return new KubernetesVersion( + version, + capabilitiesSupportPlan != null ? new KubernetesVersionCapabilities(capabilitiesSupportPlan?.ToList(), serializedAdditionalRawData: null) : null, + isDefault, + isPreview, + patchVersions, + serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -81,6 +60,17 @@ public static KubernetesPatchVersion KubernetesPatchVersion(IEnumerable return new KubernetesPatchVersion(upgrades?.ToList(), serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The operating system of the node image. Example: AKSUbuntu. + /// The SKU or flavor of the node image. Example: 2004gen2containerd. + /// major.minor.patch version of the node image version release. Example: 2024.02.02. + /// The OS + SKU + version of the node image. Example: AKSUbuntu-1804gen2containerd-2024.02.02. + /// A new instance for mocking. + public static NodeImageVersion NodeImageVersion(string os = null, string sku = null, string version = null, string fullName = null) + { + return new NodeImageVersion(os, sku, version, fullName, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -88,14 +78,17 @@ public static KubernetesPatchVersion KubernetesPatchVersion(IEnumerable /// The systemData. /// The tags. /// The location. + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// The managed cluster SKU. /// The extended location of the Virtual Machine. /// The identity of the managed cluster, if configured. + /// This is primarily used to expose different UI experiences in the portal for different kinds. /// The current provisioning state. /// The Power State of the cluster. + /// CreationData to be used to specify the source Snapshot ID if the cluster will be created/upgraded using a snapshot. /// The max number of agent pools for the managed cluster. - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. - /// If kubernetesVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If kubernetesVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. + /// The version of Kubernetes the Managed Cluster is running. /// This cannot be updated once the Managed Cluster has been created. /// This cannot be updated once the Managed Cluster has been created. /// The FQDN of the master pool. @@ -109,9 +102,10 @@ public static KubernetesPatchVersion KubernetesPatchVersion(IEnumerable /// See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. /// The OIDC issuer profile of the Managed Cluster. /// The name of the resource group containing agent pool nodes. + /// The node resource group configuration profile. /// Whether to enable Kubernetes Role-Based Access Control. /// The support plan for the Managed Cluster. If unspecified, the default is 'KubernetesOfficial'. - /// (DEPRECATED) Whether to enable Kubernetes pod security policy (preview). PodSecurityPolicy was deprecated in Kubernetes v1.21, and removed from Kubernetes in v1.25. Learn more at https://aka.ms/k8s/psp and https://aka.ms/aks/psp. + /// The default value is false. It can be enabled/disabled on creation and updating of the managed cluster. See [https://aka.ms/NamespaceARMResource](https://aka.ms/NamespaceARMResource) for more details on Namespace as a ARM Resource. /// The network configuration profile. /// The Azure Active Directory configuration. /// The auto upgrade configuration. @@ -119,19 +113,27 @@ public static KubernetesPatchVersion KubernetesPatchVersion(IEnumerable /// Parameters to be applied to the cluster-autoscaler when enabled. /// The access profile for managed cluster API server. /// This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. - /// Identities associated with the cluster. + /// The user identity associated with the managed cluster. This identity will be used by the kubelet. Only one user assigned identity is allowed. The only accepted key is "kubeletidentity", with value of "resourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}". /// Private link resources associated with the cluster. /// If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview). /// Configurations for provisioning the cluster with HTTP proxy servers. /// Security profile for the managed cluster. /// Storage profile for the managed cluster. + /// Ingress profile for the managed cluster. /// Allow or deny public network access for AKS. /// Workload Auto-scaler profile for the managed cluster. - /// Azure Monitor addon profiles for monitoring the managed cluster. + /// Prometheus addon profile for the container service cluster. + /// The Safeguards profile holds all the safeguards information for a given cluster. /// Service mesh profile for a managed cluster. /// The resourceUID uniquely identifies ManagedClusters that reuse ARM ResourceIds (i.e: create, delete, create sequence). + /// Optional cluster metrics configuration. + /// AI toolchain operator settings that apply to the whole cluster. + /// Node provisioning settings that apply to the whole cluster. + /// Profile of the cluster bootstrap configuration. + /// Profile of the pod scheduler configuration. + /// Contains read-only information about the Managed Cluster. /// A new instance for mocking. - public static ContainerServiceManagedClusterData ContainerServiceManagedClusterData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedClusterSku sku = null, ExtendedLocation extendedLocation = null, ManagedClusterIdentity clusterIdentity = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, int? maxAgentPools = null, string kubernetesVersion = null, string currentKubernetesVersion = null, string dnsPrefix = null, string fqdnSubdomain = null, string fqdn = null, string privateFqdn = null, string azurePortalFqdn = null, IEnumerable agentPoolProfiles = null, ContainerServiceLinuxProfile linuxProfile = null, ManagedClusterWindowsProfile windowsProfile = null, ManagedClusterServicePrincipalProfile servicePrincipalProfile = null, IDictionary addonProfiles = null, ManagedClusterPodIdentityProfile podIdentityProfile = null, ManagedClusterOidcIssuerProfile oidcIssuerProfile = null, string nodeResourceGroup = null, bool? enableRbac = null, KubernetesSupportPlan? supportPlan = null, bool? enablePodSecurityPolicy = null, ContainerServiceNetworkProfile networkProfile = null, ManagedClusterAadProfile aadProfile = null, ManagedClusterAutoUpgradeProfile autoUpgradeProfile = null, UpgradeOverrideSettings upgradeOverrideSettings = null, ManagedClusterAutoScalerProfile autoScalerProfile = null, ManagedClusterApiServerAccessProfile apiServerAccessProfile = null, ResourceIdentifier diskEncryptionSetId = null, IDictionary identityProfile = null, IEnumerable privateLinkResources = null, bool? disableLocalAccounts = null, ManagedClusterHttpProxyConfig httpProxyConfig = null, ManagedClusterSecurityProfile securityProfile = null, ManagedClusterStorageProfile storageProfile = null, ContainerServicePublicNetworkAccess? publicNetworkAccess = null, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile = null, ManagedClusterMonitorProfileMetrics azureMonitorMetrics = null, ServiceMeshProfile serviceMeshProfile = null, ResourceIdentifier resourceId = null) + public static ContainerServiceManagedClusterData ContainerServiceManagedClusterData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, ManagedClusterSku sku = null, ExtendedLocation extendedLocation = null, ManagedClusterIdentity clusterIdentity = null, string kind = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, ResourceIdentifier creationDataSourceResourceId = null, int? maxAgentPools = null, string kubernetesVersion = null, string currentKubernetesVersion = null, string dnsPrefix = null, string fqdnSubdomain = null, string fqdn = null, string privateFqdn = null, string azurePortalFqdn = null, IEnumerable agentPoolProfiles = null, ContainerServiceLinuxProfile linuxProfile = null, ManagedClusterWindowsProfile windowsProfile = null, ManagedClusterServicePrincipalProfile servicePrincipalProfile = null, IDictionary addonProfiles = null, ManagedClusterPodIdentityProfile podIdentityProfile = null, ManagedClusterOidcIssuerProfile oidcIssuerProfile = null, string nodeResourceGroup = null, RestrictionLevel? nodeResourceGroupRestrictionLevel = null, bool? enableRbac = null, KubernetesSupportPlan? supportPlan = null, bool? enableNamespaceResources = null, ContainerServiceNetworkProfile networkProfile = null, ManagedClusterAadProfile aadProfile = null, ManagedClusterAutoUpgradeProfile autoUpgradeProfile = null, UpgradeOverrideSettings upgradeOverrideSettings = null, ManagedClusterAutoScalerProfile autoScalerProfile = null, ManagedClusterApiServerAccessProfile apiServerAccessProfile = null, ResourceIdentifier diskEncryptionSetId = null, IDictionary identityProfile = null, IEnumerable privateLinkResources = null, bool? disableLocalAccounts = null, ManagedClusterHttpProxyConfig httpProxyConfig = null, ManagedClusterSecurityProfile securityProfile = null, ManagedClusterStorageProfile storageProfile = null, ManagedClusterIngressProfileWebAppRouting ingressWebAppRouting = null, ContainerServicePublicNetworkAccess? publicNetworkAccess = null, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile = null, ManagedClusterAzureMonitorProfile azureMonitorProfile = null, SafeguardsProfile safeguardsProfile = null, ServiceMeshProfile serviceMeshProfile = null, ResourceIdentifier resourceId = null, bool? costAnalysisEnabled = null, bool? aiToolchainOperatorProfileEnabled = null, ManagedClusterNodeProvisioningProfile nodeProvisioningProfile = null, ManagedClusterBootstrapProfile bootstrapProfile = null, SchedulerConfigMode? upstreamSchedulerConfigMode = null, ResponseError statusProvisioningError = null) { tags ??= new Dictionary(); agentPoolProfiles ??= new List(); @@ -146,11 +148,14 @@ public static ContainerServiceManagedClusterData ContainerServiceManagedClusterD systemData, tags, location, + etag, sku, extendedLocation, clusterIdentity, + kind, provisioningState, powerStateCode != null ? new ContainerServicePowerState(powerStateCode, serializedAdditionalRawData: null) : null, + creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, serializedAdditionalRawData: null) : null, maxAgentPools, kubernetesVersion, currentKubernetesVersion, @@ -167,9 +172,10 @@ public static ContainerServiceManagedClusterData ContainerServiceManagedClusterD podIdentityProfile, oidcIssuerProfile, nodeResourceGroup, + nodeResourceGroupRestrictionLevel != null ? new ManagedClusterNodeResourceGroupProfile(nodeResourceGroupRestrictionLevel, serializedAdditionalRawData: null) : null, enableRbac, supportPlan, - enablePodSecurityPolicy, + enableNamespaceResources, networkProfile, aadProfile, autoUpgradeProfile, @@ -183,40 +189,52 @@ public static ContainerServiceManagedClusterData ContainerServiceManagedClusterD httpProxyConfig, securityProfile, storageProfile, + ingressWebAppRouting != null ? new ManagedClusterIngressProfile(ingressWebAppRouting, serializedAdditionalRawData: null) : null, publicNetworkAccess, workloadAutoScalerProfile, - azureMonitorMetrics != null ? new ManagedClusterAzureMonitorProfile(azureMonitorMetrics, serializedAdditionalRawData: null) : null, + azureMonitorProfile, + safeguardsProfile, serviceMeshProfile, resourceId, + costAnalysisEnabled != null ? new ManagedClusterMetricsProfile(new ManagedClusterCostAnalysis(costAnalysisEnabled, serializedAdditionalRawData: null), serializedAdditionalRawData: null) : null, + aiToolchainOperatorProfileEnabled != null ? new ManagedClusterAIToolchainOperatorProfile(aiToolchainOperatorProfileEnabled, serializedAdditionalRawData: null) : null, + nodeProvisioningProfile, + bootstrapProfile, + upstreamSchedulerConfigMode != null ? new SchedulerProfile(new SchedulerProfileSchedulerInstanceProfiles(new SchedulerInstanceProfile(upstreamSchedulerConfigMode, serializedAdditionalRawData: null), serializedAdditionalRawData: null), serializedAdditionalRawData: null) : null, + statusProvisioningError != null ? new ManagedClusterStatus(statusProvisioningError, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); } /// Initializes a new instance of . + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The IP allocation mode for pods in the agent pool. Must be used with podSubnetId. The default is 'DynamicIndividual'. /// The maximum number of pods that can run on a node. /// The operating system type. The default is Linux. - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. /// The maximum number of nodes for auto-scaling. /// The minimum number of nodes for auto-scaling. /// Whether to enable auto-scaler. /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. /// The type of Agent Pool. /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). - /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// Both patch version <major.minor.patch> and <major.minor> are supported. When <major.minor> is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same <major.minor> once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. /// The version of node image. /// Settings for upgrading the agentpool. /// The current deployment or provisioning state. /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// When set to true, AKS adds a label to the node indicating that the feature is enabled and deploys a daemonset along with host services to sync custom certificate authorities from user-provided list of base64 encoded certificates into node trust stores. Defaults to false. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. @@ -224,6 +242,7 @@ public static ContainerServiceManagedClusterData ContainerServiceManagedClusterD /// The tags to be persisted on the agent pool virtual machine scale set. /// The node labels to be persisted across all nodes in agent pool. /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// These taints will not be reconciled by AKS and can be removed with a kubectl call. This field can be modified after node pool is created, but nodes will not be recreated with new taints until another operation that requires recreation (e.g. node image upgrade) happens. These taints allow for required configuration to run before the node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with `kubectl taint nodes node1 key1=value1:NoSchedule-`. /// The ID for Proximity Placement Group. /// The Kubelet configuration on the agent pool nodes. /// The OS configuration of Linux agent nodes. @@ -234,25 +253,39 @@ public static ContainerServiceManagedClusterData ContainerServiceManagedClusterD /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// The Windows agent pool's specific profile. /// Network-related settings of an agent pool. + /// The security settings of an agent pool. + /// The GPU settings of an agent pool. + /// Configuration for using artifact streaming on AKS. + /// Specifications on VirtualMachines agent pool. + /// The status of nodes in a VirtualMachines agent pool. + /// Profile specific to a managed agent pool in Gateway mode. This field cannot be set if agent pool mode is not Gateway. + /// Contains read-only information about the Agent Pool. + /// Configures the per-node local DNS, with VnetDNS and KubeDNS overrides. LocalDNS helps improve performance and reliability of DNS resolution in an AKS cluster. For more details see aka.ms/aks/localdns. /// Windows agent pool names must be 6 characters or less. /// A new instance for mocking. - public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? agentPoolType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, AgentPoolNetworkProfile networkProfile = null, string name = null) + public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(ETag? etag = null, int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, string messageOfTheDay = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, PodIPAllocationMode? podIPAllocationMode = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? agentPoolType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, bool? enableCustomCATrust = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, IEnumerable nodeInitializationTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, bool? disableOutboundNat = null, AgentPoolNetworkProfile networkProfile = null, AgentPoolSecurityProfile securityProfile = null, GpuProfile gpuProfile = null, bool? artifactStreamingProfileEnabled = null, ScaleProfile virtualMachinesScale = null, IEnumerable virtualMachineNodesStatus = null, int? gatewayPublicIPPrefixSize = null, ResponseError statusProvisioningError = null, LocalDnsProfile localDnsProfile = null, string name = null) { availabilityZones ??= new List(); tags ??= new Dictionary(); nodeLabels ??= new Dictionary(); nodeTaints ??= new List(); + nodeInitializationTaints ??= new List(); + virtualMachineNodesStatus ??= new List(); return new ManagedClusterAgentPoolProfile( + etag, count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, + podIPAllocationMode, maxPods, osType, osSku, @@ -270,6 +303,7 @@ public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? powerStateCode != null ? new ContainerServicePowerState(powerStateCode, serializedAdditionalRawData: null) : null, availabilityZones?.ToList(), enableNodePublicIP, + enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, @@ -277,6 +311,7 @@ public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? tags, nodeLabels, nodeTaints?.ToList(), + nodeInitializationTaints?.ToList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, @@ -287,37 +322,50 @@ public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, serializedAdditionalRawData: null) : null, capacityReservationGroupId, hostGroupId, + disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat, serializedAdditionalRawData: null) : null, networkProfile, + securityProfile, + gpuProfile, + artifactStreamingProfileEnabled != null ? new AgentPoolArtifactStreamingProfile(artifactStreamingProfileEnabled, serializedAdditionalRawData: null) : null, + virtualMachinesScale != null ? new VirtualMachinesProfile(virtualMachinesScale, serializedAdditionalRawData: null) : null, + virtualMachineNodesStatus?.ToList(), + gatewayPublicIPPrefixSize != null ? new AgentPoolGatewayProfile(gatewayPublicIPPrefixSize, serializedAdditionalRawData: null) : null, + statusProvisioningError != null ? new AgentPoolStatus(statusProvisioningError, serializedAdditionalRawData: null) : null, + localDnsProfile, serializedAdditionalRawData: null, name); } /// Initializes a new instance of . + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The IP allocation mode for pods in the agent pool. Must be used with podSubnetId. The default is 'DynamicIndividual'. /// The maximum number of pods that can run on a node. /// The operating system type. The default is Linux. - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. /// The maximum number of nodes for auto-scaling. /// The minimum number of nodes for auto-scaling. /// Whether to enable auto-scaler. /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. /// The type of Agent Pool. /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). - /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// Both patch version <major.minor.patch> and <major.minor> are supported. When <major.minor> is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same <major.minor> once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. /// The version of node image. /// Settings for upgrading the agentpool. /// The current deployment or provisioning state. /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// When set to true, AKS adds a label to the node indicating that the feature is enabled and deploys a daemonset along with host services to sync custom certificate authorities from user-provided list of base64 encoded certificates into node trust stores. Defaults to false. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. @@ -325,6 +373,7 @@ public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? /// The tags to be persisted on the agent pool virtual machine scale set. /// The node labels to be persisted across all nodes in agent pool. /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// These taints will not be reconciled by AKS and can be removed with a kubectl call. This field can be modified after node pool is created, but nodes will not be recreated with new taints until another operation that requires recreation (e.g. node image upgrade) happens. These taints allow for required configuration to run before the node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with `kubectl taint nodes node1 key1=value1:NoSchedule-`. /// The ID for Proximity Placement Group. /// The Kubelet configuration on the agent pool nodes. /// The OS configuration of Linux agent nodes. @@ -335,24 +384,38 @@ public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// The Windows agent pool's specific profile. /// Network-related settings of an agent pool. + /// The security settings of an agent pool. + /// The GPU settings of an agent pool. + /// Configuration for using artifact streaming on AKS. + /// Specifications on VirtualMachines agent pool. + /// The status of nodes in a VirtualMachines agent pool. + /// Profile specific to a managed agent pool in Gateway mode. This field cannot be set if agent pool mode is not Gateway. + /// Contains read-only information about the Agent Pool. + /// Configures the per-node local DNS, with VnetDNS and KubeDNS overrides. LocalDNS helps improve performance and reliability of DNS resolution in an AKS cluster. For more details see aka.ms/aks/localdns. /// A new instance for mocking. - public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties(int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? agentPoolType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, AgentPoolNetworkProfile networkProfile = null) + public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties(ETag? etag = null, int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, string messageOfTheDay = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, PodIPAllocationMode? podIPAllocationMode = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? agentPoolType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, bool? enableCustomCATrust = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, IEnumerable nodeInitializationTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, bool? disableOutboundNat = null, AgentPoolNetworkProfile networkProfile = null, AgentPoolSecurityProfile securityProfile = null, GpuProfile gpuProfile = null, bool? artifactStreamingProfileEnabled = null, ScaleProfile virtualMachinesScale = null, IEnumerable virtualMachineNodesStatus = null, int? gatewayPublicIPPrefixSize = null, ResponseError statusProvisioningError = null, LocalDnsProfile localDnsProfile = null) { availabilityZones ??= new List(); tags ??= new Dictionary(); nodeLabels ??= new Dictionary(); nodeTaints ??= new List(); + nodeInitializationTaints ??= new List(); + virtualMachineNodesStatus ??= new List(); return new ManagedClusterAgentPoolProfileProperties( + etag, count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, + podIPAllocationMode, maxPods, osType, osSku, @@ -370,6 +433,7 @@ public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolPr powerStateCode != null ? new ContainerServicePowerState(powerStateCode, serializedAdditionalRawData: null) : null, availabilityZones?.ToList(), enableNodePublicIP, + enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, @@ -377,6 +441,7 @@ public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolPr tags, nodeLabels, nodeTaints?.ToList(), + nodeInitializationTaints?.ToList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, @@ -387,10 +452,30 @@ public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolPr creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, serializedAdditionalRawData: null) : null, capacityReservationGroupId, hostGroupId, + disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat, serializedAdditionalRawData: null) : null, networkProfile, + securityProfile, + gpuProfile, + artifactStreamingProfileEnabled != null ? new AgentPoolArtifactStreamingProfile(artifactStreamingProfileEnabled, serializedAdditionalRawData: null) : null, + virtualMachinesScale != null ? new VirtualMachinesProfile(virtualMachinesScale, serializedAdditionalRawData: null) : null, + virtualMachineNodesStatus?.ToList(), + gatewayPublicIPPrefixSize != null ? new AgentPoolGatewayProfile(gatewayPublicIPPrefixSize, serializedAdditionalRawData: null) : null, + statusProvisioningError != null ? new AgentPoolStatus(statusProvisioningError, serializedAdditionalRawData: null) : null, + localDnsProfile, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Mode of enablement for localDNS. + /// System-generated state of localDNS. + /// VnetDNS overrides apply to DNS traffic from pods with dnsPolicy:default or kubelet (referred to as VnetDNS traffic). + /// KubeDNS overrides apply to DNS traffic from pods with dnsPolicy:ClusterFirst (referred to as KubeDNS traffic). + /// A new instance for mocking. + public static LocalDnsProfile LocalDnsProfile(LocalDnsMode? mode = null, LocalDnsState? state = null, LocalDnsOverrides vnetDnsOverrides = null, LocalDnsOverrides kubeDnsOverrides = null) + { + return new LocalDnsProfile(mode, state, vnetDnsOverrides, kubeDnsOverrides, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// Whether the add-on is enabled or not. /// Key-value pairs for configuring an add-on. @@ -432,6 +517,48 @@ public static ManagedClusterOidcIssuerProfile ManagedClusterOidcIssuerProfile(st return new ManagedClusterOidcIssuerProfile(issuerUriInfo, isEnabled, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Desired managed outbound IPs for the cluster load balancer. + /// Desired outbound IP Prefix resources for the cluster load balancer. + /// Desired outbound IP resources for the cluster load balancer. + /// The effective outbound IP resources of the cluster load balancer. + /// The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports. + /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + /// Enable multiple standard load balancers per AKS cluster or not. + /// The type of the managed inbound Load Balancer BackendPool. + /// The health probing behavior for External Traffic Policy Cluster services. + /// A new instance for mocking. + public static ManagedClusterLoadBalancerProfile ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = null, IEnumerable outboundPublicIPPrefixes = null, IEnumerable outboundPublicIPs = null, IEnumerable effectiveOutboundIPs = null, int? allocatedOutboundPorts = null, int? idleTimeoutInMinutes = null, bool? enableMultipleStandardLoadBalancers = null, ManagedClusterLoadBalancerBackendPoolType? backendPoolType = null, ClusterServiceLoadBalancerHealthProbeMode? clusterServiceLoadBalancerHealthProbeMode = null) + { + outboundPublicIPPrefixes ??= new List(); + outboundPublicIPs ??= new List(); + effectiveOutboundIPs ??= new List(); + + return new ManagedClusterLoadBalancerProfile( + managedOutboundIPs, + outboundPublicIPPrefixes != null ? new ManagedClusterLoadBalancerProfileOutboundIPPrefixes(outboundPublicIPPrefixes?.ToList(), serializedAdditionalRawData: null) : null, + outboundPublicIPs != null ? new ManagedClusterLoadBalancerProfileOutboundIPs(outboundPublicIPs?.ToList(), serializedAdditionalRawData: null) : null, + effectiveOutboundIPs?.ToList(), + allocatedOutboundPorts, + idleTimeoutInMinutes, + enableMultipleStandardLoadBalancers, + backendPoolType, + clusterServiceLoadBalancerHealthProbeMode, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Profile of the managed outbound IP resources of the cluster NAT gateway. + /// The effective outbound IP resources of the cluster NAT gateway. + /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + /// A new instance for mocking. + public static ManagedClusterNatGatewayProfile ManagedClusterNatGatewayProfile(int? managedOutboundIPCount = null, IEnumerable effectiveOutboundIPs = null, int? idleTimeoutInMinutes = null) + { + effectiveOutboundIPs ??= new List(); + + return new ManagedClusterNatGatewayProfile(managedOutboundIPCount != null ? new ManagedClusterManagedOutboundIPProfile(managedOutboundIPCount, serializedAdditionalRawData: null) : null, effectiveOutboundIPs?.ToList(), idleTimeoutInMinutes, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The ID of the private link resource. /// The name of the private link resource. @@ -454,6 +581,56 @@ public static ContainerServicePrivateLinkResourceData ContainerServicePrivateLin serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The HTTP proxy server endpoint to use. + /// The HTTPS proxy server endpoint to use. + /// The endpoints that should not go through proxy. + /// A read-only list of all endpoints for which traffic should not be sent to the proxy. This list is a superset of noProxy and values injected by AKS. + /// Alternative CA cert to use for connecting to proxy servers. + /// Whether to enable HTTP proxy. When disabled, the specified proxy configuration will be not be set on pods and nodes. + /// A new instance for mocking. + public static ManagedClusterHttpProxyConfig ManagedClusterHttpProxyConfig(string httpProxy = null, string httpsProxy = null, IEnumerable noProxy = null, IEnumerable effectiveNoProxy = null, string trustedCA = null, bool? enabled = null) + { + noProxy ??= new List(); + effectiveNoProxy ??= new List(); + + return new ManagedClusterHttpProxyConfig( + httpProxy, + httpsProxy, + noProxy?.ToList(), + effectiveNoProxy?.ToList(), + trustedCA, + enabled, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Whether to enable Web App Routing. + /// Resource IDs of the DNS zones to be associated with the Web App Routing add-on. Used only when Web App Routing is enabled. Public and private DNS zones can be in different resource groups, but all public DNS zones must be in the same resource group and all private DNS zones must be in the same resource group. + /// Configuration for the default NginxIngressController. See more at https://learn.microsoft.com/en-us/azure/aks/app-routing-nginx-configuration#the-default-nginx-ingress-controller. + /// Managed identity of the Web Application Routing add-on. This is the identity that should be granted permissions, for example, to manage the associated Azure DNS resource and get certificates from Azure Key Vault. See [this overview of the add-on](https://learn.microsoft.com/en-us/azure/aks/web-app-routing?tabs=with-osm) for more instructions. + /// A new instance for mocking. + public static ManagedClusterIngressProfileWebAppRouting ManagedClusterIngressProfileWebAppRouting(bool? enabled = null, IEnumerable dnsZoneResourceIds = null, NginxIngressControllerType? nginxDefaultIngressControllerType = null, ContainerServiceUserAssignedIdentity identity = null) + { + dnsZoneResourceIds ??= new List(); + + return new ManagedClusterIngressProfileWebAppRouting(enabled, dnsZoneResourceIds?.ToList(), nginxDefaultIngressControllerType != null ? new ManagedClusterIngressProfileNginx(nginxDefaultIngressControllerType, serializedAdditionalRawData: null) : null, identity, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of namespaces specified by AKS to be excluded from Safeguards. + /// The version of constraints to use. + /// The Safeguards level to be used. By default, Safeguards is enabled for all namespaces except those that AKS excludes via systemExcludedNamespaces. + /// List of namespaces excluded from Safeguards checks. + /// A new instance for mocking. + public static SafeguardsProfile SafeguardsProfile(IEnumerable systemExcludedNamespaces = null, string version = null, Level level = default, IEnumerable excludedNamespaces = null) + { + systemExcludedNamespaces ??= new List(); + excludedNamespaces ??= new List(); + + return new SafeguardsProfile(systemExcludedNamespaces?.ToList(), version, level, excludedNamespaces?.ToList(), serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -481,21 +658,51 @@ public static ManagedClusterUpgradeProfileData ManagedClusterUpgradeProfileData( /// The Agent Pool name. /// The operating system type. The default is Linux. /// List of orchestrator types and versions available for upgrade. + /// List of components grouped by kubernetes major.minor version. /// A new instance for mocking. - public static ManagedClusterPoolUpgradeProfile ManagedClusterPoolUpgradeProfile(string kubernetesVersion = null, string name = null, ContainerServiceOSType osType = default, IEnumerable upgrades = null) + public static ManagedClusterPoolUpgradeProfile ManagedClusterPoolUpgradeProfile(string kubernetesVersion = null, string name = null, ContainerServiceOSType osType = default, IEnumerable upgrades = null, IEnumerable componentsByReleases = null) { upgrades ??= new List(); + componentsByReleases ??= new List(); - return new ManagedClusterPoolUpgradeProfile(kubernetesVersion, name, osType, upgrades?.ToList(), serializedAdditionalRawData: null); + return new ManagedClusterPoolUpgradeProfile( + kubernetesVersion, + name, + osType, + upgrades?.ToList(), + componentsByReleases?.ToList(), + serializedAdditionalRawData: null); } /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// Whether the Kubernetes version is currently in preview. + /// Whether the Kubernetes version is out of support. /// A new instance for mocking. - public static ManagedClusterPoolUpgradeProfileUpgradesItem ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion = null, bool? isPreview = null) + public static ManagedClusterPoolUpgradeProfileUpgradesItem ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion = null, bool? isPreview = null, bool? isOutOfSupport = null) + { + return new ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion, isPreview, isOutOfSupport, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The Kubernetes version (major.minor). + /// components of current or upgraded Kubernetes version in the cluster. + /// A new instance for mocking. + public static ComponentsByRelease ComponentsByRelease(string kubernetesVersion = null, IEnumerable components = null) { - return new ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion, isPreview, serializedAdditionalRawData: null); + components ??= new List(); + + return new ComponentsByRelease(kubernetesVersion, components?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Component name. + /// Component version. + /// If upgraded component version contains breaking changes from the current version. To see a detailed description of what the breaking changes are, visit https://learn.microsoft.com/azure/aks/supported-kubernetes-versions?tabs=azure-cli#aks-components-breaking-changes-by-version. + /// A new instance for mocking. + public static Component Component(string name = null, string version = null, bool? hasBreakingChanges = null) + { + return new Component(name, version, hasBreakingChanges, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -566,36 +773,91 @@ public static ContainerServiceMaintenanceConfigurationData ContainerServiceMaint serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. + /// Properties of a namespace. + /// A new instance for mocking. + public static NamespaceData NamespaceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, NamespaceProperties properties = null) + { + tags ??= new Dictionary(); + + return new NamespaceData( + id, + name, + resourceType, + systemData, + tags, + location, + etag, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The current provisioning state of the namespace. + /// The labels of managed namespace. + /// The annotations of managed namespace. + /// The default resource quota enforced upon the namespace. Customers can have other Kubernetes resource quota objects under the namespace. All the resource quotas will be enforced. + /// The default network policy enforced upon the namespace. Customers can have other Kubernetes network policy objects under the namespace. All the network policies will be enforced. + /// Action if Kubernetes namespace with same name already exists. + /// Delete options of a namespace. + /// A new instance for mocking. + public static NamespaceProperties NamespaceProperties(NamespaceProvisioningState? provisioningState = null, IDictionary labels = null, IDictionary annotations = null, ResourceQuota defaultResourceQuota = null, NetworkPolicies defaultNetworkPolicy = null, AdoptionPolicy? adoptionPolicy = null, DeletePolicy? deletePolicy = null) + { + labels ??= new Dictionary(); + annotations ??= new Dictionary(); + + return new NamespaceProperties( + provisioningState, + labels, + annotations, + defaultResourceQuota, + defaultNetworkPolicy, + adoptionPolicy, + deletePolicy, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The IP allocation mode for pods in the agent pool. Must be used with podSubnetId. The default is 'DynamicIndividual'. /// The maximum number of pods that can run on a node. /// The operating system type. The default is Linux. - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. /// The maximum number of nodes for auto-scaling. /// The minimum number of nodes for auto-scaling. /// Whether to enable auto-scaler. /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. /// The type of Agent Pool. /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). - /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// Both patch version <major.minor.patch> and <major.minor> are supported. When <major.minor> is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same <major.minor> once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. /// The version of node image. /// Settings for upgrading the agentpool. /// The current deployment or provisioning state. /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// When set to true, AKS adds a label to the node indicating that the feature is enabled and deploys a daemonset along with host services to sync custom certificate authorities from user-provided list of base64 encoded certificates into node trust stores. Defaults to false. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. @@ -603,6 +865,7 @@ public static ContainerServiceMaintenanceConfigurationData ContainerServiceMaint /// The tags to be persisted on the agent pool virtual machine scale set. /// The node labels to be persisted across all nodes in agent pool. /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// These taints will not be reconciled by AKS and can be removed with a kubectl call. This field can be modified after node pool is created, but nodes will not be recreated with new taints until another operation that requires recreation (e.g. node image upgrade) happens. These taints allow for required configuration to run before the node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with `kubectl taint nodes node1 key1=value1:NoSchedule-`. /// The ID for Proximity Placement Group. /// The Kubelet configuration on the agent pool nodes. /// The OS configuration of Linux agent nodes. @@ -613,28 +876,42 @@ public static ContainerServiceMaintenanceConfigurationData ContainerServiceMaint /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// The Windows agent pool's specific profile. /// Network-related settings of an agent pool. + /// The security settings of an agent pool. + /// The GPU settings of an agent pool. + /// Configuration for using artifact streaming on AKS. + /// Specifications on VirtualMachines agent pool. + /// The status of nodes in a VirtualMachines agent pool. + /// Profile specific to a managed agent pool in Gateway mode. This field cannot be set if agent pool mode is not Gateway. + /// Contains read-only information about the Agent Pool. + /// Configures the per-node local DNS, with VnetDNS and KubeDNS overrides. LocalDNS helps improve performance and reliability of DNS resolution in an AKS cluster. For more details see aka.ms/aks/localdns. /// A new instance for mocking. - public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? typePropertiesType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, AgentPoolNetworkProfile networkProfile = null) + public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, int? count = null, string vmSize = null, int? osDiskSizeInGB = null, ContainerServiceOSDiskType? osDiskType = null, KubeletDiskType? kubeletDiskType = null, WorkloadRuntime? workloadRuntime = null, string messageOfTheDay = null, ResourceIdentifier vnetSubnetId = null, ResourceIdentifier podSubnetId = null, PodIPAllocationMode? podIPAllocationMode = null, int? maxPods = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, int? maxCount = null, int? minCount = null, bool? enableAutoScaling = null, ScaleDownMode? scaleDownMode = null, AgentPoolType? typePropertiesType = null, AgentPoolMode? mode = null, string orchestratorVersion = null, string currentOrchestratorVersion = null, string nodeImageVersion = null, AgentPoolUpgradeSettings upgradeSettings = null, string provisioningState = null, ContainerServiceStateCode? powerStateCode = null, IEnumerable availabilityZones = null, bool? enableNodePublicIP = null, bool? enableCustomCATrust = null, ResourceIdentifier nodePublicIPPrefixId = null, ScaleSetPriority? scaleSetPriority = null, ScaleSetEvictionPolicy? scaleSetEvictionPolicy = null, float? spotMaxPrice = null, IDictionary tags = null, IDictionary nodeLabels = null, IEnumerable nodeTaints = null, IEnumerable nodeInitializationTaints = null, ResourceIdentifier proximityPlacementGroupId = null, KubeletConfig kubeletConfig = null, LinuxOSConfig linuxOSConfig = null, bool? enableEncryptionAtHost = null, bool? enableUltraSsd = null, bool? enableFips = null, GpuInstanceProfile? gpuInstanceProfile = null, ResourceIdentifier creationDataSourceResourceId = null, ResourceIdentifier capacityReservationGroupId = null, ResourceIdentifier hostGroupId = null, bool? disableOutboundNat = null, AgentPoolNetworkProfile networkProfile = null, AgentPoolSecurityProfile securityProfile = null, GpuProfile gpuProfile = null, bool? artifactStreamingProfileEnabled = null, ScaleProfile virtualMachinesScale = null, IEnumerable virtualMachineNodesStatus = null, int? gatewayPublicIPPrefixSize = null, ResponseError statusProvisioningError = null, LocalDnsProfile localDnsProfile = null) { availabilityZones ??= new List(); tags ??= new Dictionary(); nodeLabels ??= new Dictionary(); nodeTaints ??= new List(); + nodeInitializationTaints ??= new List(); + virtualMachineNodesStatus ??= new List(); return new ContainerServiceAgentPoolData( id, name, resourceType, systemData, + etag, count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, + podIPAllocationMode, maxPods, osType, osSku, @@ -652,6 +929,7 @@ public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(Resour powerStateCode != null ? new ContainerServicePowerState(powerStateCode, serializedAdditionalRawData: null) : null, availabilityZones?.ToList(), enableNodePublicIP, + enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, @@ -659,6 +937,7 @@ public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(Resour tags, nodeLabels, nodeTaints?.ToList(), + nodeInitializationTaints?.ToList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, @@ -669,7 +948,16 @@ public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(Resour creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, serializedAdditionalRawData: null) : null, capacityReservationGroupId, hostGroupId, + disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat, serializedAdditionalRawData: null) : null, networkProfile, + securityProfile, + gpuProfile, + artifactStreamingProfileEnabled != null ? new AgentPoolArtifactStreamingProfile(artifactStreamingProfileEnabled, serializedAdditionalRawData: null) : null, + virtualMachinesScale != null ? new VirtualMachinesProfile(virtualMachinesScale, serializedAdditionalRawData: null) : null, + virtualMachineNodesStatus?.ToList(), + gatewayPublicIPPrefixSize != null ? new AgentPoolGatewayProfile(gatewayPublicIPPrefixSize, serializedAdditionalRawData: null) : null, + statusProvisioningError != null ? new AgentPoolStatus(statusProvisioningError, serializedAdditionalRawData: null) : null, + localDnsProfile, serializedAdditionalRawData: null); } @@ -681,11 +969,13 @@ public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(Resour /// The Kubernetes version (major.minor.patch). /// The operating system type. The default is Linux. /// List of orchestrator types and versions available for upgrade. + /// List of components grouped by kubernetes major.minor version. /// The latest AKS supported node image version. /// A new instance for mocking. - public static AgentPoolUpgradeProfileData AgentPoolUpgradeProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kubernetesVersion = null, ContainerServiceOSType osType = default, IEnumerable upgrades = null, string latestNodeImageVersion = null) + public static AgentPoolUpgradeProfileData AgentPoolUpgradeProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kubernetesVersion = null, ContainerServiceOSType osType = default, IEnumerable upgrades = null, IEnumerable componentsByReleases = null, string latestNodeImageVersion = null) { upgrades ??= new List(); + componentsByReleases ??= new List(); return new AgentPoolUpgradeProfileData( id, @@ -695,6 +985,7 @@ public static AgentPoolUpgradeProfileData AgentPoolUpgradeProfileData(ResourceId kubernetesVersion, osType, upgrades?.ToList(), + componentsByReleases?.ToList(), latestNodeImageVersion, serializedAdditionalRawData: null); } @@ -702,10 +993,49 @@ public static AgentPoolUpgradeProfileData AgentPoolUpgradeProfileData(ResourceId /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// Whether the Kubernetes version is currently in preview. + /// Whether the Kubernetes version is out of support. /// A new instance for mocking. - public static AgentPoolUpgradeProfilePropertiesUpgradesItem AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion = null, bool? isPreview = null) + public static AgentPoolUpgradeProfilePropertiesUpgradesItem AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion = null, bool? isPreview = null, bool? isOutOfSupport = null) + { + return new AgentPoolUpgradeProfilePropertiesUpgradesItem(kubernetesVersion, isPreview, isOutOfSupport, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The properties of the machine. + /// A new instance for mocking. + public static MachineData MachineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, MachineProperties properties = null) + { + return new MachineData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// network properties of the machine. + /// Arm resource id of the machine. It can be used to GET underlying VM Instance. + /// A new instance for mocking. + public static MachineProperties MachineProperties(IEnumerable networkIPAddresses = null, ResourceIdentifier resourceId = null) { - return new AgentPoolUpgradeProfilePropertiesUpgradesItem(kubernetesVersion, isPreview, serializedAdditionalRawData: null); + networkIPAddresses ??= new List(); + + return new MachineProperties(networkIPAddresses != null ? new MachineNetworkProperties(networkIPAddresses?.ToList(), serializedAdditionalRawData: null) : null, resourceId, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// To determine if address belongs IPv4 or IPv6 family. + /// IPv4 or IPv6 address of the machine. + /// A new instance for mocking. + public static MachineIPAddress MachineIPAddress(IPFamily? family = null, string ip = null) + { + return new MachineIPAddress(family, ip, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -825,6 +1155,34 @@ public static ContainerServiceEndpointDetail ContainerServiceEndpointDetail(IPAd return new ContainerServiceEndpointDetail(ipAddress, port, protocol, description, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Fully qualified ID of the resource against which the original async operation was started. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + /// A new instance for mocking. + public static OperationStatusResult OperationStatusResult(ResourceIdentifier id = null, ResourceIdentifier resourceId = null, string name = null, string status = null, float? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, IEnumerable operations = null, ResponseError error = null) + { + operations ??= new List(); + + return new OperationStatusResult( + id, + resourceId, + name, + status, + percentComplete, + startOn, + endOn, + operations?.ToList(), + error, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -837,7 +1195,7 @@ public static ContainerServiceEndpointDetail ContainerServiceEndpointDetail(IPAd /// The version of Kubernetes. /// The version of node image. /// The operating system type. The default is Linux. - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. /// The size of the VM. /// Whether to use a FIPS-enabled OS. /// A new instance for mocking. @@ -863,6 +1221,177 @@ public static AgentPoolSnapshotData AgentPoolSnapshotData(ResourceIdentifier id serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// CreationData to be used to specify the source resource ID to create this snapshot. + /// The type of a snapshot. The default is NodePool. + /// What the properties will be showed when getting managed cluster snapshot. Those properties are read-only. + /// A new instance for mocking. + public static ManagedClusterSnapshotData ManagedClusterSnapshotData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ResourceIdentifier creationDataSourceResourceId = null, SnapshotType? snapshotType = null, ManagedClusterPropertiesForSnapshot managedClusterPropertiesReadOnly = null) + { + tags ??= new Dictionary(); + + return new ManagedClusterSnapshotData( + id, + name, + resourceType, + systemData, + tags, + location, + creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, serializedAdditionalRawData: null) : null, + snapshotType, + managedClusterPropertiesReadOnly, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The current kubernetes version. + /// The current managed cluster sku. + /// Whether the cluster has enabled Kubernetes Role-Based Access Control or not. + /// The current network profile. + /// A new instance for mocking. + public static ManagedClusterPropertiesForSnapshot ManagedClusterPropertiesForSnapshot(string kubernetesVersion = null, ManagedClusterSku sku = null, bool? enableRbac = null, NetworkProfileForSnapshot networkProfile = null) + { + return new ManagedClusterPropertiesForSnapshot(kubernetesVersion, sku, enableRbac, networkProfile, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// networkPlugin for managed cluster snapshot. + /// NetworkPluginMode for managed cluster snapshot. + /// networkPolicy for managed cluster snapshot. + /// networkMode for managed cluster snapshot. + /// loadBalancerSku for managed cluster snapshot. + /// A new instance for mocking. + public static NetworkProfileForSnapshot NetworkProfileForSnapshot(ContainerServiceNetworkPlugin? networkPlugin = null, ContainerServiceNetworkPluginMode? networkPluginMode = null, ContainerServiceNetworkPolicy? networkPolicy = null, ContainerServiceNetworkMode? networkMode = null, ContainerServiceLoadBalancerSku? loadBalancerSku = null) + { + return new NetworkProfileForSnapshot( + networkPlugin, + networkPluginMode, + networkPolicy, + networkMode, + loadBalancerSku, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource type of Azure resource. + /// Name of role, name is unique under a source resource type. + /// List of rules for the role. This maps to 'rules' property of [Kubernetes Cluster Role](https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-v1/#ClusterRole). + /// A new instance for mocking. + public static ContainerServiceTrustedAccessRole ContainerServiceTrustedAccessRole(string sourceResourceType = null, string name = null, IEnumerable rules = null) + { + rules ??= new List(); + + return new ContainerServiceTrustedAccessRole(sourceResourceType, name, rules?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of allowed verbs. + /// List of allowed apiGroups. + /// List of allowed resources. + /// List of allowed names. + /// List of allowed nonResourceURLs. + /// A new instance for mocking. + public static ContainerServiceTrustedAccessRoleRule ContainerServiceTrustedAccessRoleRule(IEnumerable verbs = null, IEnumerable apiGroups = null, IEnumerable resources = null, IEnumerable resourceNames = null, IEnumerable nonResourceUrls = null) + { + verbs ??= new List(); + apiGroups ??= new List(); + resources ??= new List(); + resourceNames ??= new List(); + nonResourceUrls ??= new List(); + + return new ContainerServiceTrustedAccessRoleRule( + verbs?.ToList(), + apiGroups?.ToList(), + resources?.ToList(), + resourceNames?.ToList(), + nonResourceUrls?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The current provisioning state of trusted access role binding. + /// The ARM resource ID of source resource that trusted access is configured for. + /// A list of roles to bind, each item is a resource type qualified role name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + /// A new instance for mocking. + public static ContainerServiceTrustedAccessRoleBindingData ContainerServiceTrustedAccessRoleBindingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ContainerServiceTrustedAccessRoleBindingProvisioningState? provisioningState = null, ResourceIdentifier sourceResourceId = null, IEnumerable roles = null) + { + roles ??= new List(); + + return new ContainerServiceTrustedAccessRoleBindingData( + id, + name, + resourceType, + systemData, + provisioningState, + sourceResourceId, + roles?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Whether the version is default or not and support info. + /// A new instance for mocking. + public static GuardrailsAvailableVersionData GuardrailsAvailableVersionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GuardrailsAvailableVersionsProperties properties = null) + { + return new GuardrailsAvailableVersionData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// Whether the version is preview or stable. + /// A new instance for mocking. + public static GuardrailsAvailableVersionsProperties GuardrailsAvailableVersionsProperties(bool? isDefaultVersion = null, GuardrailsSupport? support = null) + { + return new GuardrailsAvailableVersionsProperties(isDefaultVersion, support, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Whether the version is default or not and support info. + /// A new instance for mocking. + public static SafeguardsAvailableVersionData SafeguardsAvailableVersionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SafeguardsAvailableVersionsProperties properties = null) + { + return new SafeguardsAvailableVersionData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// Whether the version is preview or stable. + /// A new instance for mocking. + public static SafeguardsAvailableVersionsProperties SafeguardsAvailableVersionsProperties(bool? isDefaultVersion = null, SafeguardsSupport? support = null) + { + return new SafeguardsAvailableVersionsProperties(isDefaultVersion, support, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -901,64 +1430,250 @@ public static MeshUpgradeProfileData MeshUpgradeProfileData(ResourceIdentifier i serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The current provisioning state of trusted access role binding. - /// The ARM resource ID of source resource that trusted access is configured for. - /// A list of roles to bind, each item is a resource type qualified role name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. - /// A new instance for mocking. - public static ContainerServiceTrustedAccessRoleBindingData ContainerServiceTrustedAccessRoleBindingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ContainerServiceTrustedAccessRoleBindingProvisioningState? provisioningState = null, ResourceIdentifier sourceResourceId = null, IEnumerable roles = null) + /// Required field. A string value that must specify the ID of an existing agent pool. All nodes in the given pool will always be added to this load balancer. This agent pool must have at least one node and minCount>=1 for autoscaling operations. An agent pool can only be the primary pool for a single load balancer. + /// Whether to automatically place services on the load balancer. If not supplied, the default value is true. If set to false manually, both of the external and the internal load balancer will not be selected for services unless they explicitly target it. + /// Only services that must match this selector can be placed on this load balancer. + /// Services created in namespaces that match the selector can be placed on this load balancer. + /// Nodes that match this selector will be possible members of this load balancer. + /// The current provisioning state. + /// A new instance for mocking. + public static LoadBalancerData LoadBalancerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string primaryAgentPoolName = null, bool? allowServicePlacement = null, LabelSelector serviceLabelSelector = null, LabelSelector serviceNamespaceSelector = null, LabelSelector nodeSelector = null, string provisioningState = null) { - roles ??= new List(); - - return new ContainerServiceTrustedAccessRoleBindingData( + return new LoadBalancerData( id, name, resourceType, systemData, + primaryAgentPoolName, + allowServicePlacement, + serviceLabelSelector, + serviceNamespaceSelector, + nodeSelector, provisioningState, - sourceResourceId, - roles?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Resource type of Azure resource. - /// Name of role, name is unique under a source resource type. - /// List of rules for the role. This maps to 'rules' property of [Kubernetes Cluster Role](https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-v1/#ClusterRole). - /// A new instance for mocking. - public static ContainerServiceTrustedAccessRole ContainerServiceTrustedAccessRole(string sourceResourceType = null, string name = null, IEnumerable rules = null) + /// Initializes a new instance of . + /// major.minor version of Kubernetes release. + /// Capabilities on this Kubernetes version. + /// Whether this version is in preview mode. + /// Patch versions of Kubernetes release. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static KubernetesVersion KubernetesVersion(string version, IEnumerable capabilitiesSupportPlan, bool? isPreview, IReadOnlyDictionary patchVersions) { - rules ??= new List(); + return KubernetesVersion(version: version, capabilitiesSupportPlan: capabilitiesSupportPlan, isDefault: default, isPreview: isPreview, patchVersions: patchVersions); + } - return new ContainerServiceTrustedAccessRole(sourceResourceType, name, rules?.ToList(), serializedAdditionalRawData: null); + /// Initializes a new instance of . + /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). + /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. + /// Determines the type of workload a node can run. + /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The maximum number of pods that can run on a node. + /// The operating system type. The default is Linux. + /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// The maximum number of nodes for auto-scaling. + /// The minimum number of nodes for auto-scaling. + /// Whether to enable auto-scaler. + /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. + /// The type of Agent Pool. + /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. + /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// The version of node image. + /// Settings for upgrading the agentpool. + /// The current deployment or provisioning state. + /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. + /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. + /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. + /// Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing). + /// The tags to be persisted on the agent pool virtual machine scale set. + /// The node labels to be persisted across all nodes in agent pool. + /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// The ID for Proximity Placement Group. + /// The Kubelet configuration on the agent pool nodes. + /// The OS configuration of Linux agent nodes. + /// This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption. + /// Whether to enable UltraSSD. + /// See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + /// GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. + /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + /// AKS will associate the specified agent pool with the Capacity Reservation Group. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// Network-related settings of an agent pool. + /// Windows agent pool names must be 6 characters or less. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServiceStateCode? powerStateCode, IEnumerable availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IEnumerable nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ResourceIdentifier creationDataSourceResourceId, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, string name) + { + return ManagedClusterAgentPoolProfile(etag: default, count: count, vmSize: vmSize, osDiskSizeInGB: osDiskSizeInGB, osDiskType: osDiskType, kubeletDiskType: kubeletDiskType, workloadRuntime: workloadRuntime, messageOfTheDay: default, vnetSubnetId: vnetSubnetId, podSubnetId: podSubnetId, podIPAllocationMode: default, maxPods: maxPods, osType: osType, osSku: osSku, maxCount: maxCount, minCount: minCount, enableAutoScaling: enableAutoScaling, scaleDownMode: scaleDownMode, agentPoolType: agentPoolType, mode: mode, orchestratorVersion: orchestratorVersion, currentOrchestratorVersion: currentOrchestratorVersion, nodeImageVersion: nodeImageVersion, upgradeSettings: upgradeSettings, provisioningState: provisioningState, powerStateCode: powerStateCode, availabilityZones: availabilityZones, enableNodePublicIP: enableNodePublicIP, enableCustomCATrust: default, nodePublicIPPrefixId: nodePublicIPPrefixId, scaleSetPriority: scaleSetPriority, scaleSetEvictionPolicy: scaleSetEvictionPolicy, spotMaxPrice: spotMaxPrice, tags: tags, nodeLabels: nodeLabels, nodeTaints: nodeTaints, nodeInitializationTaints: default, proximityPlacementGroupId: proximityPlacementGroupId, kubeletConfig: kubeletConfig, linuxOSConfig: linuxOSConfig, enableEncryptionAtHost: enableEncryptionAtHost, enableUltraSsd: enableUltraSsd, enableFips: enableFips, gpuInstanceProfile: gpuInstanceProfile, creationDataSourceResourceId: creationDataSourceResourceId, capacityReservationGroupId: capacityReservationGroupId, hostGroupId: hostGroupId, disableOutboundNat: default, networkProfile: networkProfile, securityProfile: default, gpuProfile: default, artifactStreamingProfileEnabled: default, virtualMachinesScale: default, virtualMachineNodesStatus: default, gatewayPublicIPPrefixSize: default, statusProvisioningError: default, localDnsProfile: default, name: name); } - /// Initializes a new instance of . - /// List of allowed verbs. - /// List of allowed apiGroups. - /// List of allowed resources. - /// List of allowed names. - /// List of allowed nonResourceURLs. - /// A new instance for mocking. - public static ContainerServiceTrustedAccessRoleRule ContainerServiceTrustedAccessRoleRule(IEnumerable verbs = null, IEnumerable apiGroups = null, IEnumerable resources = null, IEnumerable resourceNames = null, IEnumerable nonResourceUrls = null) + /// Initializes a new instance of . + /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). + /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. + /// Determines the type of workload a node can run. + /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The maximum number of pods that can run on a node. + /// The operating system type. The default is Linux. + /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// The maximum number of nodes for auto-scaling. + /// The minimum number of nodes for auto-scaling. + /// Whether to enable auto-scaler. + /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. + /// The type of Agent Pool. + /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. + /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// The version of node image. + /// Settings for upgrading the agentpool. + /// The current deployment or provisioning state. + /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. + /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. + /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. + /// Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing). + /// The tags to be persisted on the agent pool virtual machine scale set. + /// The node labels to be persisted across all nodes in agent pool. + /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// The ID for Proximity Placement Group. + /// The Kubelet configuration on the agent pool nodes. + /// The OS configuration of Linux agent nodes. + /// This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption. + /// Whether to enable UltraSSD. + /// See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + /// GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. + /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + /// AKS will associate the specified agent pool with the Capacity Reservation Group. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// Network-related settings of an agent pool. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServiceStateCode? powerStateCode, IEnumerable availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IEnumerable nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ResourceIdentifier creationDataSourceResourceId, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile) { - verbs ??= new List(); - apiGroups ??= new List(); - resources ??= new List(); - resourceNames ??= new List(); - nonResourceUrls ??= new List(); + return ManagedClusterAgentPoolProfileProperties(etag: default, count: count, vmSize: vmSize, osDiskSizeInGB: osDiskSizeInGB, osDiskType: osDiskType, kubeletDiskType: kubeletDiskType, workloadRuntime: workloadRuntime, messageOfTheDay: default, vnetSubnetId: vnetSubnetId, podSubnetId: podSubnetId, podIPAllocationMode: default, maxPods: maxPods, osType: osType, osSku: osSku, maxCount: maxCount, minCount: minCount, enableAutoScaling: enableAutoScaling, scaleDownMode: scaleDownMode, agentPoolType: agentPoolType, mode: mode, orchestratorVersion: orchestratorVersion, currentOrchestratorVersion: currentOrchestratorVersion, nodeImageVersion: nodeImageVersion, upgradeSettings: upgradeSettings, provisioningState: provisioningState, powerStateCode: powerStateCode, availabilityZones: availabilityZones, enableNodePublicIP: enableNodePublicIP, enableCustomCATrust: default, nodePublicIPPrefixId: nodePublicIPPrefixId, scaleSetPriority: scaleSetPriority, scaleSetEvictionPolicy: scaleSetEvictionPolicy, spotMaxPrice: spotMaxPrice, tags: tags, nodeLabels: nodeLabels, nodeTaints: nodeTaints, nodeInitializationTaints: default, proximityPlacementGroupId: proximityPlacementGroupId, kubeletConfig: kubeletConfig, linuxOSConfig: linuxOSConfig, enableEncryptionAtHost: enableEncryptionAtHost, enableUltraSsd: enableUltraSsd, enableFips: enableFips, gpuInstanceProfile: gpuInstanceProfile, creationDataSourceResourceId: creationDataSourceResourceId, capacityReservationGroupId: capacityReservationGroupId, hostGroupId: hostGroupId, disableOutboundNat: default, networkProfile: networkProfile, securityProfile: default, gpuProfile: default, artifactStreamingProfileEnabled: default, virtualMachinesScale: default, virtualMachineNodesStatus: default, gatewayPublicIPPrefixSize: default, statusProvisioningError: default, localDnsProfile: default); + } - return new ContainerServiceTrustedAccessRoleRule( - verbs?.ToList(), - apiGroups?.ToList(), - resources?.ToList(), - resourceNames?.ToList(), - nonResourceUrls?.ToList(), - serializedAdditionalRawData: null); + /// Initializes a new instance of . + /// The Kubernetes version (major.minor.patch). + /// The Agent Pool name. + /// The operating system type. The default is Linux. + /// List of orchestrator types and versions available for upgrade. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ManagedClusterPoolUpgradeProfile ManagedClusterPoolUpgradeProfile(string kubernetesVersion, string name, ContainerServiceOSType osType, IEnumerable upgrades) + { + return ManagedClusterPoolUpgradeProfile(kubernetesVersion: kubernetesVersion, name: name, osType: osType, upgrades: upgrades, componentsByReleases: default); + } + + /// Initializes a new instance of . + /// The Kubernetes version (major.minor.patch). + /// Whether the Kubernetes version is currently in preview. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ManagedClusterPoolUpgradeProfileUpgradesItem ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion, bool? isPreview) + { + return ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion: kubernetesVersion, isPreview: isPreview, isOutOfSupport: default); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). + /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. + /// Determines the type of workload a node can run. + /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The maximum number of pods that can run on a node. + /// The operating system type. The default is Linux. + /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// The maximum number of nodes for auto-scaling. + /// The minimum number of nodes for auto-scaling. + /// Whether to enable auto-scaler. + /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. + /// The type of Agent Pool. + /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. + /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// The version of node image. + /// Settings for upgrading the agentpool. + /// The current deployment or provisioning state. + /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. + /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. + /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. + /// Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing). + /// The tags to be persisted on the agent pool virtual machine scale set. + /// The node labels to be persisted across all nodes in agent pool. + /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// The ID for Proximity Placement Group. + /// The Kubelet configuration on the agent pool nodes. + /// The OS configuration of Linux agent nodes. + /// This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption. + /// Whether to enable UltraSSD. + /// See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + /// GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. + /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + /// AKS will associate the specified agent pool with the Capacity Reservation Group. + /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// Network-related settings of an agent pool. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? typePropertiesType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServiceStateCode? powerStateCode, IEnumerable availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IEnumerable nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ResourceIdentifier creationDataSourceResourceId, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile) + { + return ContainerServiceAgentPoolData(id: id, name: name, resourceType: resourceType, systemData: systemData, etag: default, count: count, vmSize: vmSize, osDiskSizeInGB: osDiskSizeInGB, osDiskType: osDiskType, kubeletDiskType: kubeletDiskType, workloadRuntime: workloadRuntime, messageOfTheDay: default, vnetSubnetId: vnetSubnetId, podSubnetId: podSubnetId, podIPAllocationMode: default, maxPods: maxPods, osType: osType, osSku: osSku, maxCount: maxCount, minCount: minCount, enableAutoScaling: enableAutoScaling, scaleDownMode: scaleDownMode, typePropertiesType: typePropertiesType, mode: mode, orchestratorVersion: orchestratorVersion, currentOrchestratorVersion: currentOrchestratorVersion, nodeImageVersion: nodeImageVersion, upgradeSettings: upgradeSettings, provisioningState: provisioningState, powerStateCode: powerStateCode, availabilityZones: availabilityZones, enableNodePublicIP: enableNodePublicIP, enableCustomCATrust: default, nodePublicIPPrefixId: nodePublicIPPrefixId, scaleSetPriority: scaleSetPriority, scaleSetEvictionPolicy: scaleSetEvictionPolicy, spotMaxPrice: spotMaxPrice, tags: tags, nodeLabels: nodeLabels, nodeTaints: nodeTaints, nodeInitializationTaints: default, proximityPlacementGroupId: proximityPlacementGroupId, kubeletConfig: kubeletConfig, linuxOSConfig: linuxOSConfig, enableEncryptionAtHost: enableEncryptionAtHost, enableUltraSsd: enableUltraSsd, enableFips: enableFips, gpuInstanceProfile: gpuInstanceProfile, creationDataSourceResourceId: creationDataSourceResourceId, capacityReservationGroupId: capacityReservationGroupId, hostGroupId: hostGroupId, disableOutboundNat: default, networkProfile: networkProfile, securityProfile: default, gpuProfile: default, artifactStreamingProfileEnabled: default, virtualMachinesScale: default, virtualMachineNodesStatus: default, gatewayPublicIPPrefixSize: default, statusProvisioningError: default, localDnsProfile: default); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The Kubernetes version (major.minor.patch). + /// The operating system type. The default is Linux. + /// List of orchestrator types and versions available for upgrade. + /// The latest AKS supported node image version. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static AgentPoolUpgradeProfileData AgentPoolUpgradeProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kubernetesVersion, ContainerServiceOSType osType, IEnumerable upgrades, string latestNodeImageVersion) + { + return AgentPoolUpgradeProfileData(id: id, name: name, resourceType: resourceType, systemData: systemData, kubernetesVersion: kubernetesVersion, osType: osType, upgrades: upgrades, componentsByReleases: default, latestNodeImageVersion: latestNodeImageVersion); + } + + /// Initializes a new instance of . + /// The Kubernetes version (major.minor.patch). + /// Whether the Kubernetes version is currently in preview. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static AgentPoolUpgradeProfilePropertiesUpgradesItem AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion, bool? isPreview) + { + return AgentPoolUpgradeProfilePropertiesUpgradesItem(kubernetesVersion: kubernetesVersion, isPreview: isPreview, isOutOfSupport: default); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs index 88b66a8d18dd..6d5aa31733db 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -75,10 +75,12 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the agent pool. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string agentPoolName, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); Argument.AssertNotNull(data, nameof(data)); @@ -87,8 +89,8 @@ public virtual async Task> Creat scope.Start(); try { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -113,7 +115,7 @@ public virtual async Task> Creat /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -124,10 +126,12 @@ public virtual async Task> Creat /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the agent pool. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string agentPoolName, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); Argument.AssertNotNull(data, nameof(data)); @@ -136,8 +140,8 @@ public virtual ArmOperation CreateOrUpdate(Wa scope.Start(); try { - var response = _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, cancellationToken); - var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -162,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(Wa /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -207,7 +211,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -252,7 +256,7 @@ public virtual Response Get(string agentPoolN /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -282,7 +286,7 @@ public virtual AsyncPageable GetAllAsync(Canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -312,7 +316,7 @@ public virtual Pageable GetAll(CancellationTo /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -355,7 +359,7 @@ public virtual async Task> ExistsAsync(string agentPoolName, Canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -398,7 +402,7 @@ public virtual Response Exists(string agentPoolName, CancellationToken can /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -443,7 +447,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs index 4d2239c713bc..84e56eee3642 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs @@ -41,6 +41,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } if (Optional.IsDefined(Count)) { writer.WritePropertyName("count"u8); @@ -71,6 +76,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("workloadRuntime"u8); writer.WriteStringValue(WorkloadRuntime.Value.ToString()); } + if (Optional.IsDefined(MessageOfTheDay)) + { + writer.WritePropertyName("messageOfTheDay"u8); + writer.WriteStringValue(MessageOfTheDay); + } if (Optional.IsDefined(VnetSubnetId)) { writer.WritePropertyName("vnetSubnetID"u8); @@ -81,6 +91,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("podSubnetID"u8); writer.WriteStringValue(PodSubnetId); } + if (Optional.IsDefined(PodIPAllocationMode)) + { + writer.WritePropertyName("podIPAllocationMode"u8); + writer.WriteStringValue(PodIPAllocationMode.Value.ToString()); + } if (Optional.IsDefined(MaxPods)) { writer.WritePropertyName("maxPods"u8); @@ -171,6 +186,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("enableNodePublicIP"u8); writer.WriteBooleanValue(EnableNodePublicIP.Value); } + if (Optional.IsDefined(EnableCustomCATrust)) + { + writer.WritePropertyName("enableCustomCATrust"u8); + writer.WriteBooleanValue(EnableCustomCATrust.Value); + } if (Optional.IsDefined(NodePublicIPPrefixId)) { writer.WritePropertyName("nodePublicIPPrefixID"u8); @@ -223,6 +243,16 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } writer.WriteEndArray(); } + if (Optional.IsCollectionDefined(NodeInitializationTaints)) + { + writer.WritePropertyName("nodeInitializationTaints"u8); + writer.WriteStartArray(); + foreach (var item in NodeInitializationTaints) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } if (Optional.IsDefined(ProximityPlacementGroupId)) { writer.WritePropertyName("proximityPlacementGroupID"u8); @@ -273,11 +303,61 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("hostGroupID"u8); writer.WriteStringValue(HostGroupId); } + if (Optional.IsDefined(WindowsProfile)) + { + writer.WritePropertyName("windowsProfile"u8); + writer.WriteObjectValue(WindowsProfile, options); + } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); writer.WriteObjectValue(NetworkProfile, options); } + if (Optional.IsDefined(SecurityProfile)) + { + writer.WritePropertyName("securityProfile"u8); + writer.WriteObjectValue(SecurityProfile, options); + } + if (Optional.IsDefined(GpuProfile)) + { + writer.WritePropertyName("gpuProfile"u8); + writer.WriteObjectValue(GpuProfile, options); + } + if (Optional.IsDefined(ArtifactStreamingProfile)) + { + writer.WritePropertyName("artifactStreamingProfile"u8); + writer.WriteObjectValue(ArtifactStreamingProfile, options); + } + if (Optional.IsDefined(VirtualMachinesProfile)) + { + writer.WritePropertyName("virtualMachinesProfile"u8); + writer.WriteObjectValue(VirtualMachinesProfile, options); + } + if (Optional.IsCollectionDefined(VirtualMachineNodesStatus)) + { + writer.WritePropertyName("virtualMachineNodesStatus"u8); + writer.WriteStartArray(); + foreach (var item in VirtualMachineNodesStatus) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(GatewayProfile)) + { + writer.WritePropertyName("gatewayProfile"u8); + writer.WriteObjectValue(GatewayProfile, options); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); + } + if (Optional.IsDefined(LocalDnsProfile)) + { + writer.WritePropertyName("localDNSProfile"u8); + writer.WriteObjectValue(LocalDnsProfile, options); + } writer.WriteEndObject(); } @@ -305,14 +385,17 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo string name = default; ResourceType type = default; SystemData systemData = default; + ETag? etag = default; int? count = default; string vmSize = default; int? osDiskSizeGB = default; ContainerServiceOSDiskType? osDiskType = default; KubeletDiskType? kubeletDiskType = default; WorkloadRuntime? workloadRuntime = default; + string messageOfTheDay = default; ResourceIdentifier vnetSubnetId = default; ResourceIdentifier podSubnetId = default; + PodIPAllocationMode? podIPAllocationMode = default; int? maxPods = default; ContainerServiceOSType? osType = default; ContainerServiceOSSku? osSku = default; @@ -330,6 +413,7 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo ContainerServicePowerState powerState = default; IList availabilityZones = default; bool? enableNodePublicIP = default; + bool? enableCustomCATrust = default; ResourceIdentifier nodePublicIPPrefixId = default; ScaleSetPriority? scaleSetPriority = default; ScaleSetEvictionPolicy? scaleSetEvictionPolicy = default; @@ -337,6 +421,7 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo IDictionary tags = default; IDictionary nodeLabels = default; IList nodeTaints = default; + IList nodeInitializationTaints = default; ResourceIdentifier proximityPlacementGroupId = default; KubeletConfig kubeletConfig = default; LinuxOSConfig linuxOSConfig = default; @@ -347,7 +432,16 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo ContainerServiceCreationData creationData = default; ResourceIdentifier capacityReservationGroupId = default; ResourceIdentifier hostGroupId = default; + AgentPoolWindowsProfile windowsProfile = default; AgentPoolNetworkProfile networkProfile = default; + AgentPoolSecurityProfile securityProfile = default; + GpuProfile gpuProfile = default; + AgentPoolArtifactStreamingProfile artifactStreamingProfile = default; + VirtualMachinesProfile virtualMachinesProfile = default; + IList virtualMachineNodesStatus = default; + AgentPoolGatewayProfile gatewayProfile = default; + AgentPoolStatus status = default; + LocalDnsProfile localDnsProfile = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -385,6 +479,15 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo } foreach (var property0 in property.Value.EnumerateObject()) { + if (property0.NameEquals("eTag"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property0.Value.GetString()); + continue; + } if (property0.NameEquals("count"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -435,6 +538,11 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo workloadRuntime = new WorkloadRuntime(property0.Value.GetString()); continue; } + if (property0.NameEquals("messageOfTheDay"u8)) + { + messageOfTheDay = property0.Value.GetString(); + continue; + } if (property0.NameEquals("vnetSubnetID"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -453,6 +561,15 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo podSubnetId = new ResourceIdentifier(property0.Value.GetString()); continue; } + if (property0.NameEquals("podIPAllocationMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + podIPAllocationMode = new PodIPAllocationMode(property0.Value.GetString()); + continue; + } if (property0.NameEquals("maxPods"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -595,6 +712,15 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo enableNodePublicIP = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("enableCustomCATrust"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableCustomCATrust = property0.Value.GetBoolean(); + continue; + } if (property0.NameEquals("nodePublicIPPrefixID"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -673,6 +799,20 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo nodeTaints = array; continue; } + if (property0.NameEquals("nodeInitializationTaints"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + nodeInitializationTaints = array; + continue; + } if (property0.NameEquals("proximityPlacementGroupID"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -763,6 +903,15 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo hostGroupId = new ResourceIdentifier(property0.Value.GetString()); continue; } + if (property0.NameEquals("windowsProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + windowsProfile = AgentPoolWindowsProfile.DeserializeAgentPoolWindowsProfile(property0.Value, options); + continue; + } if (property0.NameEquals("networkProfile"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -772,6 +921,83 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property0.Value, options); continue; } + if (property0.NameEquals("securityProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityProfile = AgentPoolSecurityProfile.DeserializeAgentPoolSecurityProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("gpuProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gpuProfile = GpuProfile.DeserializeGpuProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("artifactStreamingProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStreamingProfile = AgentPoolArtifactStreamingProfile.DeserializeAgentPoolArtifactStreamingProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("virtualMachinesProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualMachinesProfile = VirtualMachinesProfile.DeserializeVirtualMachinesProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("virtualMachineNodesStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(VirtualMachineNodes.DeserializeVirtualMachineNodes(item, options)); + } + virtualMachineNodesStatus = array; + continue; + } + if (property0.NameEquals("gatewayProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gatewayProfile = AgentPoolGatewayProfile.DeserializeAgentPoolGatewayProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = AgentPoolStatus.DeserializeAgentPoolStatus(property0.Value, options); + continue; + } + if (property0.NameEquals("localDNSProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + localDnsProfile = LocalDnsProfile.DeserializeLocalDnsProfile(property0.Value, options); + continue; + } } continue; } @@ -786,14 +1012,17 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo name, type, systemData, + etag, count, vmSize, osDiskSizeGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, + podIPAllocationMode, maxPods, osType, osSku, @@ -811,6 +1040,7 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo powerState, availabilityZones ?? new ChangeTrackingList(), enableNodePublicIP, + enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, @@ -818,6 +1048,7 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo tags ?? new ChangeTrackingDictionary(), nodeLabels ?? new ChangeTrackingDictionary(), nodeTaints ?? new ChangeTrackingList(), + nodeInitializationTaints ?? new ChangeTrackingList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, @@ -828,7 +1059,16 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo creationData, capacityReservationGroupId, hostGroupId, + windowsProfile, networkProfile, + securityProfile, + gpuProfile, + artifactStreamingProfile, + virtualMachinesProfile, + virtualMachineNodesStatus ?? new ChangeTrackingList(), + gatewayProfile, + status, + localDnsProfile, serializedAdditionalRawData); } @@ -898,6 +1138,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.Append(" properties:"); builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" eTag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" eTag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Count), out propertyOverride); if (hasPropertyOverride) { @@ -996,6 +1251,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MessageOfTheDay), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" messageOfTheDay: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MessageOfTheDay)) + { + builder.Append(" messageOfTheDay: "); + if (MessageOfTheDay.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MessageOfTheDay}'''"); + } + else + { + builder.AppendLine($"'{MessageOfTheDay}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VnetSubnetId), out propertyOverride); if (hasPropertyOverride) { @@ -1026,6 +1304,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodIPAllocationMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" podIPAllocationMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PodIPAllocationMode)) + { + builder.Append(" podIPAllocationMode: "); + builder.AppendLine($"'{PodIPAllocationMode.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxPods), out propertyOverride); if (hasPropertyOverride) { @@ -1341,6 +1634,22 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableCustomCATrust), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enableCustomCATrust: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnableCustomCATrust)) + { + builder.Append(" enableCustomCATrust: "); + var boolValue = EnableCustomCATrust.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodePublicIPPrefixId), out propertyOverride); if (hasPropertyOverride) { @@ -1511,6 +1820,42 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeInitializationTaints), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeInitializationTaints: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(NodeInitializationTaints)) + { + if (NodeInitializationTaints.Any()) + { + builder.Append(" nodeInitializationTaints: "); + builder.AppendLine("["); + foreach (var item in NodeInitializationTaints) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProximityPlacementGroupId), out propertyOverride); if (hasPropertyOverride) { @@ -1669,6 +2014,26 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("DisableOutboundNat", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" windowsProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" windowsProfile: {"); + builder.Append(" disableOutboundNat: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(WindowsProfile)) + { + builder.Append(" windowsProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, WindowsProfile, options, 4, false, " windowsProfile: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkProfile), out propertyOverride); if (hasPropertyOverride) { @@ -1684,6 +2049,154 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" securityProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecurityProfile)) + { + builder.Append(" securityProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, SecurityProfile, options, 4, false, " securityProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GpuProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" gpuProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(GpuProfile)) + { + builder.Append(" gpuProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, GpuProfile, options, 4, false, " gpuProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("ArtifactStreamingProfileEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" artifactStreamingProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" artifactStreamingProfile: {"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(ArtifactStreamingProfile)) + { + builder.Append(" artifactStreamingProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, ArtifactStreamingProfile, options, 4, false, " artifactStreamingProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("VirtualMachinesScale", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" virtualMachinesProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" virtualMachinesProfile: {"); + builder.Append(" scale: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(VirtualMachinesProfile)) + { + builder.Append(" virtualMachinesProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, VirtualMachinesProfile, options, 4, false, " virtualMachinesProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VirtualMachineNodesStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" virtualMachineNodesStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(VirtualMachineNodesStatus)) + { + if (VirtualMachineNodesStatus.Any()) + { + builder.Append(" virtualMachineNodesStatus: "); + builder.AppendLine("["); + foreach (var item in VirtualMachineNodesStatus) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " virtualMachineNodesStatus: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("GatewayPublicIPPrefixSize", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" gatewayProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" gatewayProfile: {"); + builder.Append(" publicIPPrefixSize: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(GatewayProfile)) + { + builder.Append(" gatewayProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, GatewayProfile, options, 4, false, " gatewayProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("StatusProvisioningError", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine("{"); + builder.AppendLine(" status: {"); + builder.Append(" provisioningError: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 4, false, " status: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LocalDnsProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" localDNSProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LocalDnsProfile)) + { + builder.Append(" localDNSProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, LocalDnsProfile, options, 4, false, " localDNSProfile: "); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs index d21fe3381f1a..b430819acde1 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs @@ -58,6 +58,8 @@ public ContainerServiceAgentPoolData() Tags = new ChangeTrackingDictionary(); NodeLabels = new ChangeTrackingDictionary(); NodeTaints = new ChangeTrackingList(); + NodeInitializationTaints = new ChangeTrackingList(); + VirtualMachineNodesStatus = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -65,31 +67,35 @@ public ContainerServiceAgentPoolData() /// The name. /// The resourceType. /// The systemData. + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The IP allocation mode for pods in the agent pool. Must be used with podSubnetId. The default is 'DynamicIndividual'. /// The maximum number of pods that can run on a node. /// The operating system type. The default is Linux. - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. /// The maximum number of nodes for auto-scaling. /// The minimum number of nodes for auto-scaling. /// Whether to enable auto-scaler. /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. /// The type of Agent Pool. /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). - /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// Both patch version <major.minor.patch> and <major.minor> are supported. When <major.minor> is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same <major.minor> once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. /// The version of node image. /// Settings for upgrading the agentpool. /// The current deployment or provisioning state. /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// When set to true, AKS adds a label to the node indicating that the feature is enabled and deploys a daemonset along with host services to sync custom certificate authorities from user-provided list of base64 encoded certificates into node trust stores. Defaults to false. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. @@ -97,6 +103,7 @@ public ContainerServiceAgentPoolData() /// The tags to be persisted on the agent pool virtual machine scale set. /// The node labels to be persisted across all nodes in agent pool. /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// These taints will not be reconciled by AKS and can be removed with a kubectl call. This field can be modified after node pool is created, but nodes will not be recreated with new taints until another operation that requires recreation (e.g. node image upgrade) happens. These taints allow for required configuration to run before the node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with `kubectl taint nodes node1 key1=value1:NoSchedule-`. /// The ID for Proximity Placement Group. /// The Kubelet configuration on the agent pool nodes. /// The OS configuration of Linux agent nodes. @@ -107,18 +114,30 @@ public ContainerServiceAgentPoolData() /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// The Windows agent pool's specific profile. /// Network-related settings of an agent pool. + /// The security settings of an agent pool. + /// The GPU settings of an agent pool. + /// Configuration for using artifact streaming on AKS. + /// Specifications on VirtualMachines agent pool. + /// The status of nodes in a VirtualMachines agent pool. + /// Profile specific to a managed agent pool in Gateway mode. This field cannot be set if agent pool mode is not Gateway. + /// Contains read-only information about the Agent Pool. + /// Configures the per-node local DNS, with VnetDNS and KubeDNS overrides. LocalDNS helps improve performance and reliability of DNS resolution in an AKS cluster. For more details see aka.ms/aks/localdns. /// Keeps track of any properties unknown to the library. - internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? typePropertiesType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, PodIPAllocationMode? podIPAllocationMode, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? typePropertiesType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, bool? enableCustomCATrust, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, IList nodeInitializationTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolWindowsProfile windowsProfile, AgentPoolNetworkProfile networkProfile, AgentPoolSecurityProfile securityProfile, GpuProfile gpuProfile, AgentPoolArtifactStreamingProfile artifactStreamingProfile, VirtualMachinesProfile virtualMachinesProfile, IList virtualMachineNodesStatus, AgentPoolGatewayProfile gatewayProfile, AgentPoolStatus status, LocalDnsProfile localDnsProfile, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + ETag = etag; Count = count; VmSize = vmSize; OSDiskSizeInGB = osDiskSizeInGB; OSDiskType = osDiskType; KubeletDiskType = kubeletDiskType; WorkloadRuntime = workloadRuntime; + MessageOfTheDay = messageOfTheDay; VnetSubnetId = vnetSubnetId; PodSubnetId = podSubnetId; + PodIPAllocationMode = podIPAllocationMode; MaxPods = maxPods; OSType = osType; OSSku = osSku; @@ -136,6 +155,7 @@ internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, Resou PowerState = powerState; AvailabilityZones = availabilityZones; EnableNodePublicIP = enableNodePublicIP; + EnableCustomCATrust = enableCustomCATrust; NodePublicIPPrefixId = nodePublicIPPrefixId; ScaleSetPriority = scaleSetPriority; ScaleSetEvictionPolicy = scaleSetEvictionPolicy; @@ -143,6 +163,7 @@ internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, Resou Tags = tags; NodeLabels = nodeLabels; NodeTaints = nodeTaints; + NodeInitializationTaints = nodeInitializationTaints; ProximityPlacementGroupId = proximityPlacementGroupId; KubeletConfig = kubeletConfig; LinuxOSConfig = linuxOSConfig; @@ -153,10 +174,22 @@ internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, Resou CreationData = creationData; CapacityReservationGroupId = capacityReservationGroupId; HostGroupId = hostGroupId; + WindowsProfile = windowsProfile; NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + GpuProfile = gpuProfile; + ArtifactStreamingProfile = artifactStreamingProfile; + VirtualMachinesProfile = virtualMachinesProfile; + VirtualMachineNodesStatus = virtualMachineNodesStatus; + GatewayProfile = gatewayProfile; + Status = status; + LocalDnsProfile = localDnsProfile; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. + [WirePath("properties.eTag")] + public ETag? ETag { get; } /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. [WirePath("properties.count")] public int? Count { get; set; } @@ -175,19 +208,25 @@ internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, Resou /// Determines the type of workload a node can run. [WirePath("properties.workloadRuntime")] public WorkloadRuntime? WorkloadRuntime { get; set; } + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). + [WirePath("properties.messageOfTheDay")] + public string MessageOfTheDay { get; set; } /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. [WirePath("properties.vnetSubnetID")] public ResourceIdentifier VnetSubnetId { get; set; } /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. [WirePath("properties.podSubnetID")] public ResourceIdentifier PodSubnetId { get; set; } + /// The IP allocation mode for pods in the agent pool. Must be used with podSubnetId. The default is 'DynamicIndividual'. + [WirePath("properties.podIPAllocationMode")] + public PodIPAllocationMode? PodIPAllocationMode { get; set; } /// The maximum number of pods that can run on a node. [WirePath("properties.maxPods")] public int? MaxPods { get; set; } /// The operating system type. The default is Linux. [WirePath("properties.osType")] public ContainerServiceOSType? OSType { get; set; } - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. [WirePath("properties.osSKU")] public ContainerServiceOSSku? OSSku { get; set; } /// The maximum number of nodes for auto-scaling. @@ -208,10 +247,10 @@ internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, Resou /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. [WirePath("properties.mode")] public AgentPoolMode? Mode { get; set; } - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// Both patch version <major.minor.patch> and <major.minor> are supported. When <major.minor> is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same <major.minor> once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). [WirePath("properties.orchestratorVersion")] public string OrchestratorVersion { get; set; } - /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// If orchestratorVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. [WirePath("properties.currentOrchestratorVersion")] public string CurrentOrchestratorVersion { get; } /// The version of node image. @@ -244,6 +283,9 @@ public ContainerServiceStateCode? PowerStateCode /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. [WirePath("properties.enableNodePublicIP")] public bool? EnableNodePublicIP { get; set; } + /// When set to true, AKS adds a label to the node indicating that the feature is enabled and deploys a daemonset along with host services to sync custom certificate authorities from user-provided list of base64 encoded certificates into node trust stores. Defaults to false. + [WirePath("properties.enableCustomCATrust")] + public bool? EnableCustomCATrust { get; set; } /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. [WirePath("properties.nodePublicIPPrefixID")] public ResourceIdentifier NodePublicIPPrefixId { get; set; } @@ -265,6 +307,9 @@ public ContainerServiceStateCode? PowerStateCode /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. [WirePath("properties.nodeTaints")] public IList NodeTaints { get; } + /// These taints will not be reconciled by AKS and can be removed with a kubectl call. This field can be modified after node pool is created, but nodes will not be recreated with new taints until another operation that requires recreation (e.g. node image upgrade) happens. These taints allow for required configuration to run before the node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with `kubectl taint nodes node1 key1=value1:NoSchedule-`. + [WirePath("properties.nodeInitializationTaints")] + public IList NodeInitializationTaints { get; } /// The ID for Proximity Placement Group. [WirePath("properties.proximityPlacementGroupID")] public ResourceIdentifier ProximityPlacementGroupId { get; set; } @@ -307,8 +352,89 @@ public ResourceIdentifier CreationDataSourceResourceId /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). [WirePath("properties.hostGroupID")] public ResourceIdentifier HostGroupId { get; set; } + /// The Windows agent pool's specific profile. + internal AgentPoolWindowsProfile WindowsProfile { get; set; } + /// The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP enabled. + [WirePath("properties.windowsProfile.disableOutboundNat")] + public bool? DisableOutboundNat + { + get => WindowsProfile is null ? default : WindowsProfile.DisableOutboundNat; + set + { + if (WindowsProfile is null) + WindowsProfile = new AgentPoolWindowsProfile(); + WindowsProfile.DisableOutboundNat = value; + } + } + /// Network-related settings of an agent pool. [WirePath("properties.networkProfile")] public AgentPoolNetworkProfile NetworkProfile { get; set; } + /// The security settings of an agent pool. + [WirePath("properties.securityProfile")] + public AgentPoolSecurityProfile SecurityProfile { get; set; } + /// The GPU settings of an agent pool. + [WirePath("properties.gpuProfile")] + public GpuProfile GpuProfile { get; set; } + /// Configuration for using artifact streaming on AKS. + internal AgentPoolArtifactStreamingProfile ArtifactStreamingProfile { get; set; } + /// Artifact streaming speeds up the cold-start of containers on a node through on-demand image loading. To use this feature, container images must also enable artifact streaming on ACR. If not specified, the default is false. + [WirePath("properties.artifactStreamingProfile.enabled")] + public bool? ArtifactStreamingProfileEnabled + { + get => ArtifactStreamingProfile is null ? default : ArtifactStreamingProfile.Enabled; + set + { + if (ArtifactStreamingProfile is null) + ArtifactStreamingProfile = new AgentPoolArtifactStreamingProfile(); + ArtifactStreamingProfile.Enabled = value; + } + } + + /// Specifications on VirtualMachines agent pool. + internal VirtualMachinesProfile VirtualMachinesProfile { get; set; } + /// Specifications on how to scale a VirtualMachines agent pool. + [WirePath("properties.virtualMachinesProfile.scale")] + public ScaleProfile VirtualMachinesScale + { + get => VirtualMachinesProfile is null ? default : VirtualMachinesProfile.Scale; + set + { + if (VirtualMachinesProfile is null) + VirtualMachinesProfile = new VirtualMachinesProfile(); + VirtualMachinesProfile.Scale = value; + } + } + + /// The status of nodes in a VirtualMachines agent pool. + [WirePath("properties.virtualMachineNodesStatus")] + public IList VirtualMachineNodesStatus { get; } + /// Profile specific to a managed agent pool in Gateway mode. This field cannot be set if agent pool mode is not Gateway. + internal AgentPoolGatewayProfile GatewayProfile { get; set; } + /// The Gateway agent pool associates one public IPPrefix for each static egress gateway to provide public egress. The size of Public IPPrefix should be selected by the user. Each node in the agent pool is assigned with one IP from the IPPrefix. The IPPrefix size thus serves as a cap on the size of the Gateway agent pool. Due to Azure public IPPrefix size limitation, the valid value range is [28, 31] (/31 = 2 nodes/IPs, /30 = 4 nodes/IPs, /29 = 8 nodes/IPs, /28 = 16 nodes/IPs). The default value is 31. + [WirePath("properties.gatewayProfile.publicIPPrefixSize")] + public int? GatewayPublicIPPrefixSize + { + get => GatewayProfile is null ? default : GatewayProfile.PublicIPPrefixSize; + set + { + if (GatewayProfile is null) + GatewayProfile = new AgentPoolGatewayProfile(); + GatewayProfile.PublicIPPrefixSize = value; + } + } + + /// Contains read-only information about the Agent Pool. + internal AgentPoolStatus Status { get; set; } + /// Preserves the detailed info of failure. If there was no error, this field is omitted. + [WirePath("properties.status.provisioningError")] + public ResponseError StatusProvisioningError + { + get => Status is null ? default : Status.ProvisioningError; + } + + /// Configures the per-node local DNS, with VnetDNS and KubeDNS overrides. LocalDNS helps improve performance and reliability of DNS resolution in an AKS cluster. For more details see aka.ms/aks/localdns. + [WirePath("properties.localDNSProfile")] + public LocalDnsProfile LocalDnsProfile { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs index e3ed5337ca43..3fcdfbfd29b4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; namespace Azure.ResourceManager.ContainerService { @@ -36,6 +37,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ClientDiagnostics _containerServiceAgentPoolAgentPoolsClientDiagnostics; private readonly AgentPoolsRestOperations _containerServiceAgentPoolAgentPoolsRestClient; + private readonly ClientDiagnostics _operationStatusResultClientDiagnostics; + private readonly OperationStatusResultRestOperations _operationStatusResultRestClient; private readonly ContainerServiceAgentPoolData _data; /// Gets the resource type for the operations. @@ -63,6 +66,8 @@ internal ContainerServiceAgentPoolResource(ArmClient client, ResourceIdentifier _containerServiceAgentPoolAgentPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string containerServiceAgentPoolAgentPoolsApiVersion); _containerServiceAgentPoolAgentPoolsRestClient = new AgentPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServiceAgentPoolAgentPoolsApiVersion); + _operationStatusResultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _operationStatusResultRestClient = new OperationStatusResultRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -96,6 +101,75 @@ public virtual AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfile() return new AgentPoolUpgradeProfileResource(Client, Id.AppendChildResource("upgradeProfiles", "default")); } + /// Gets a collection of MachineResources in the ContainerServiceAgentPool. + /// An object representing collection of MachineResources and their operations over a MachineResource. + public virtual MachineCollection GetMachines() + { + return GetCachedClient(client => new MachineCollection(client, Id)); + } + + /// + /// Get a specific machine in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMachineAsync(string machineName, CancellationToken cancellationToken = default) + { + return await GetMachines().GetAsync(machineName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a specific machine in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMachine(string machineName, CancellationToken cancellationToken = default) + { + return GetMachines().Get(machineName, cancellationToken); + } + /// /// Gets the specified managed cluster agent pool. /// @@ -109,7 +183,7 @@ public virtual AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfile() /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -149,7 +223,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -189,7 +263,7 @@ public virtual Response Get(CancellationToken /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -198,15 +272,17 @@ public virtual Response Get(CancellationToken /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? ignorePodDisruptionBudget = null, string ifMatch = null, CancellationToken cancellationToken = default) { using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.Delete"); scope.Start(); try { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceAgentPoolAgentPoolsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ignorePodDisruptionBudget, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ignorePodDisruptionBudget, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -231,7 +307,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -240,15 +316,17 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, bool? ignorePodDisruptionBudget = null, string ifMatch = null, CancellationToken cancellationToken = default) { using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.Delete"); scope.Start(); try { - var response = _containerServiceAgentPoolAgentPoolsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceAgentPoolAgentPoolsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ignorePodDisruptionBudget, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ignorePodDisruptionBudget, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -273,7 +351,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -283,9 +361,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); @@ -293,8 +373,8 @@ public virtual async Task> Updat scope.Start(); try { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -319,7 +399,7 @@ public virtual async Task> Updat /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -329,9 +409,11 @@ public virtual async Task> Updat /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); @@ -339,8 +421,8 @@ public virtual ArmOperation Update(WaitUntil scope.Start(); try { - var response = _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceAgentPoolAgentPoolsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new ContainerServiceAgentPoolOperationSource(Client), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -353,7 +435,7 @@ public virtual ArmOperation Update(WaitUntil } /// - /// Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, a 409 error code is returned. + /// Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, an error is returned. /// /// /// Request Path @@ -365,7 +447,7 @@ public virtual ArmOperation Update(WaitUntil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -395,7 +477,7 @@ public virtual async Task AbortLatestOperationAsync(WaitUntil wait } /// - /// Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, a 409 error code is returned. + /// Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, an error is returned. /// /// /// Request Path @@ -407,7 +489,7 @@ public virtual async Task AbortLatestOperationAsync(WaitUntil wait /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -436,6 +518,98 @@ public virtual ArmOperation AbortLatestOperation(WaitUntil waitUntil, Cancellati } } + /// + /// Deletes specific machines in an agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/deleteMachines + /// + /// + /// Operation Id + /// AgentPools_DeleteMachines + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A list of machines from the agent pool to be deleted. + /// The cancellation token to use. + /// is null. + public virtual async Task DeleteMachinesAsync(WaitUntil waitUntil, AgentPoolDeleteMachinesParameter machines, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(machines, nameof(machines)); + + using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.DeleteMachines"); + scope.Start(); + try + { + var response = await _containerServiceAgentPoolAgentPoolsRestClient.DeleteMachinesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machines, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteMachinesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machines).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific machines in an agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/deleteMachines + /// + /// + /// Operation Id + /// AgentPools_DeleteMachines + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A list of machines from the agent pool to be deleted. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation DeleteMachines(WaitUntil waitUntil, AgentPoolDeleteMachinesParameter machines, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(machines, nameof(machines)); + + using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.DeleteMachines"); + scope.Start(); + try + { + var response = _containerServiceAgentPoolAgentPoolsRestClient.DeleteMachines(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machines, cancellationToken); + var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateDeleteMachinesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machines).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade /// @@ -449,7 +623,7 @@ public virtual ArmOperation AbortLatestOperation(WaitUntil waitUntil, Cancellati /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -491,7 +665,7 @@ public virtual async Task UpgradeNodeImageVersionAsync(WaitUntil w /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -520,6 +694,84 @@ public virtual ArmOperation UpgradeNodeImageVersion(WaitUntil waitUntil, Cancell } } + /// + /// Get the status of a specific operation in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/operations/{operationId} + /// + /// + /// Operation Id + /// OperationStatusResult_GetByAgentPool + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetByAgentPoolOperationStatusResultAsync(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _operationStatusResultClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.GetByAgentPoolOperationStatusResult"); + scope.Start(); + try + { + var response = await _operationStatusResultRestClient.GetByAgentPoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the status of a specific operation in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/operations/{operationId} + /// + /// + /// Operation Id + /// OperationStatusResult_GetByAgentPool + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetByAgentPoolOperationStatusResult(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _operationStatusResultClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.GetByAgentPoolOperationStatusResult"); + scope.Start(); + try + { + var response = _operationStatusResultRestClient.GetByAgentPool(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Add a tag to the current resource. /// @@ -533,7 +785,7 @@ public virtual ArmOperation UpgradeNodeImageVersion(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -590,7 +842,7 @@ public virtual async Task> AddTagAsy /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -647,7 +899,7 @@ public virtual Response AddTag(string key, st /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -703,7 +955,7 @@ public virtual async Task> SetTagsAs /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -759,7 +1011,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -814,7 +1066,7 @@ public virtual async Task> RemoveTag /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs index f608a529017b..e7e1a542b428 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation Cr /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(st /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -286,7 +286,7 @@ public virtual AsyncPageable G /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -316,7 +316,7 @@ public virtual Pageable GetAll /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -359,7 +359,7 @@ public virtual async Task> ExistsAsync(string configName, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -402,7 +402,7 @@ public virtual Response Exists(string configName, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -447,7 +447,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs index f1463e991c78..d3e316895dc1 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(Ca /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -225,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -269,7 +269,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -317,7 +317,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs index a05f8d6c2d6d..44cd8762a7e4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -76,10 +76,12 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the managed cluster resource. /// The managed cluster to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string resourceName, ContainerServiceManagedClusterData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string resourceName, ContainerServiceManagedClusterData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); @@ -88,8 +90,8 @@ public virtual async Task> scope.Start(); try { - var response = await _containerServiceManagedClusterManagedClustersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceManagedClusterManagedClustersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -114,7 +116,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -125,10 +127,12 @@ public virtual async Task> /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the managed cluster resource. /// The managed cluster to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string resourceName, ContainerServiceManagedClusterData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string resourceName, ContainerServiceManagedClusterData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); @@ -137,8 +141,8 @@ public virtual ArmOperation CreateOrUpda scope.Start(); try { - var response = _containerServiceManagedClusterManagedClustersRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken); - var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceManagedClusterManagedClustersRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -163,7 +167,7 @@ public virtual ArmOperation CreateOrUpda /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -208,7 +212,7 @@ public virtual async Task> GetA /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -253,7 +257,7 @@ public virtual Response Get(string resou /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -283,7 +287,7 @@ public virtual AsyncPageable GetAllAsync /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -313,7 +317,7 @@ public virtual Pageable GetAll(Cancellat /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -356,7 +360,7 @@ public virtual async Task> ExistsAsync(string resourceName, Cance /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -399,7 +403,7 @@ public virtual Response Exists(string resourceName, CancellationToken canc /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -444,7 +448,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs index 30555f8e2859..094f43ac9936 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs @@ -40,6 +40,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); @@ -55,6 +60,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("identity"u8); writer.WriteObjectValue(ClusterIdentity, options); } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) @@ -67,6 +77,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("powerState"u8); writer.WriteObjectValue(PowerState, options); } + if (Optional.IsDefined(CreationData)) + { + writer.WritePropertyName("creationData"u8); + writer.WriteObjectValue(CreationData, options); + } if (options.Format != "W" && Optional.IsDefined(MaxAgentPools)) { writer.WritePropertyName("maxAgentPools"u8); @@ -158,6 +173,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("nodeResourceGroup"u8); writer.WriteStringValue(NodeResourceGroup); } + if (Optional.IsDefined(NodeResourceGroupProfile)) + { + writer.WritePropertyName("nodeResourceGroupProfile"u8); + writer.WriteObjectValue(NodeResourceGroupProfile, options); + } if (Optional.IsDefined(EnableRbac)) { writer.WritePropertyName("enableRBAC"u8); @@ -168,10 +188,10 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("supportPlan"u8); writer.WriteStringValue(SupportPlan.Value.ToString()); } - if (Optional.IsDefined(EnablePodSecurityPolicy)) + if (Optional.IsDefined(EnableNamespaceResources)) { - writer.WritePropertyName("enablePodSecurityPolicy"u8); - writer.WriteBooleanValue(EnablePodSecurityPolicy.Value); + writer.WritePropertyName("enableNamespaceResources"u8); + writer.WriteBooleanValue(EnableNamespaceResources.Value); } if (Optional.IsDefined(NetworkProfile)) { @@ -249,6 +269,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("storageProfile"u8); writer.WriteObjectValue(StorageProfile, options); } + if (Optional.IsDefined(IngressProfile)) + { + writer.WritePropertyName("ingressProfile"u8); + writer.WriteObjectValue(IngressProfile, options); + } if (Optional.IsDefined(PublicNetworkAccess)) { writer.WritePropertyName("publicNetworkAccess"u8); @@ -264,6 +289,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("azureMonitorProfile"u8); writer.WriteObjectValue(AzureMonitorProfile, options); } + if (Optional.IsDefined(SafeguardsProfile)) + { + writer.WritePropertyName("safeguardsProfile"u8); + writer.WriteObjectValue(SafeguardsProfile, options); + } if (Optional.IsDefined(ServiceMeshProfile)) { writer.WritePropertyName("serviceMeshProfile"u8); @@ -274,6 +304,36 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("resourceUID"u8); writer.WriteStringValue(ResourceId); } + if (Optional.IsDefined(MetricsProfile)) + { + writer.WritePropertyName("metricsProfile"u8); + writer.WriteObjectValue(MetricsProfile, options); + } + if (Optional.IsDefined(AiToolchainOperatorProfile)) + { + writer.WritePropertyName("aiToolchainOperatorProfile"u8); + writer.WriteObjectValue(AiToolchainOperatorProfile, options); + } + if (Optional.IsDefined(NodeProvisioningProfile)) + { + writer.WritePropertyName("nodeProvisioningProfile"u8); + writer.WriteObjectValue(NodeProvisioningProfile, options); + } + if (Optional.IsDefined(BootstrapProfile)) + { + writer.WritePropertyName("bootstrapProfile"u8); + writer.WriteObjectValue(BootstrapProfile, options); + } + if (Optional.IsDefined(SchedulerProfile)) + { + writer.WritePropertyName("schedulerProfile"u8); + writer.WriteObjectValue(SchedulerProfile, options); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); + } writer.WriteEndObject(); } @@ -297,9 +357,11 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa { return null; } + ETag? etag = default; ManagedClusterSku sku = default; ExtendedLocation extendedLocation = default; ManagedClusterIdentity identity = default; + string kind = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -308,6 +370,7 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa SystemData systemData = default; string provisioningState = default; ContainerServicePowerState powerState = default; + ContainerServiceCreationData creationData = default; int? maxAgentPools = default; string kubernetesVersion = default; string currentKubernetesVersion = default; @@ -324,9 +387,10 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa ManagedClusterPodIdentityProfile podIdentityProfile = default; ManagedClusterOidcIssuerProfile oidcIssuerProfile = default; string nodeResourceGroup = default; + ManagedClusterNodeResourceGroupProfile nodeResourceGroupProfile = default; bool? enableRBAC = default; KubernetesSupportPlan? supportPlan = default; - bool? enablePodSecurityPolicy = default; + bool? enableNamespaceResources = default; ContainerServiceNetworkProfile networkProfile = default; ManagedClusterAadProfile aadProfile = default; ManagedClusterAutoUpgradeProfile autoUpgradeProfile = default; @@ -340,15 +404,32 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa ManagedClusterHttpProxyConfig httpProxyConfig = default; ManagedClusterSecurityProfile securityProfile = default; ManagedClusterStorageProfile storageProfile = default; + ManagedClusterIngressProfile ingressProfile = default; ContainerServicePublicNetworkAccess? publicNetworkAccess = default; ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile = default; ManagedClusterAzureMonitorProfile azureMonitorProfile = default; + SafeguardsProfile safeguardsProfile = default; ServiceMeshProfile serviceMeshProfile = default; ResourceIdentifier resourceUID = default; + ManagedClusterMetricsProfile metricsProfile = default; + ManagedClusterAIToolchainOperatorProfile aiToolchainOperatorProfile = default; + ManagedClusterNodeProvisioningProfile nodeProvisioningProfile = default; + ManagedClusterBootstrapProfile bootstrapProfile = default; + SchedulerProfile schedulerProfile = default; + ManagedClusterStatus status = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -376,6 +457,11 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa identity = ManagedClusterIdentity.DeserializeManagedClusterIdentity(property.Value, options); continue; } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } if (property.NameEquals("tags"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -442,6 +528,15 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa powerState = ContainerServicePowerState.DeserializeContainerServicePowerState(property0.Value, options); continue; } + if (property0.NameEquals("creationData"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationData = ContainerServiceCreationData.DeserializeContainerServiceCreationData(property0.Value, options); + continue; + } if (property0.NameEquals("maxAgentPools"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -564,6 +659,15 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa nodeResourceGroup = property0.Value.GetString(); continue; } + if (property0.NameEquals("nodeResourceGroupProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeResourceGroupProfile = ManagedClusterNodeResourceGroupProfile.DeserializeManagedClusterNodeResourceGroupProfile(property0.Value, options); + continue; + } if (property0.NameEquals("enableRBAC"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -582,13 +686,13 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa supportPlan = new KubernetesSupportPlan(property0.Value.GetString()); continue; } - if (property0.NameEquals("enablePodSecurityPolicy"u8)) + if (property0.NameEquals("enableNamespaceResources"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - enablePodSecurityPolicy = property0.Value.GetBoolean(); + enableNamespaceResources = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("networkProfile"u8)) @@ -718,6 +822,15 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa storageProfile = ManagedClusterStorageProfile.DeserializeManagedClusterStorageProfile(property0.Value, options); continue; } + if (property0.NameEquals("ingressProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ingressProfile = ManagedClusterIngressProfile.DeserializeManagedClusterIngressProfile(property0.Value, options); + continue; + } if (property0.NameEquals("publicNetworkAccess"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -745,6 +858,15 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa azureMonitorProfile = ManagedClusterAzureMonitorProfile.DeserializeManagedClusterAzureMonitorProfile(property0.Value, options); continue; } + if (property0.NameEquals("safeguardsProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + safeguardsProfile = SafeguardsProfile.DeserializeSafeguardsProfile(property0.Value, options); + continue; + } if (property0.NameEquals("serviceMeshProfile"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -763,6 +885,60 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa resourceUID = new ResourceIdentifier(property0.Value.GetString()); continue; } + if (property0.NameEquals("metricsProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metricsProfile = ManagedClusterMetricsProfile.DeserializeManagedClusterMetricsProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("aiToolchainOperatorProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + aiToolchainOperatorProfile = ManagedClusterAIToolchainOperatorProfile.DeserializeManagedClusterAIToolchainOperatorProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("nodeProvisioningProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeProvisioningProfile = ManagedClusterNodeProvisioningProfile.DeserializeManagedClusterNodeProvisioningProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("bootstrapProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bootstrapProfile = ManagedClusterBootstrapProfile.DeserializeManagedClusterBootstrapProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("schedulerProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + schedulerProfile = SchedulerProfile.DeserializeSchedulerProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = ManagedClusterStatus.DeserializeManagedClusterStatus(property0.Value, options); + continue; + } } continue; } @@ -779,11 +955,14 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa systemData, tags ?? new ChangeTrackingDictionary(), location, + etag, sku, extendedLocation, identity, + kind, provisioningState, powerState, + creationData, maxAgentPools, kubernetesVersion, currentKubernetesVersion, @@ -800,9 +979,10 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa podIdentityProfile, oidcIssuerProfile, nodeResourceGroup, + nodeResourceGroupProfile, enableRBAC, supportPlan, - enablePodSecurityPolicy, + enableNamespaceResources, networkProfile, aadProfile, autoUpgradeProfile, @@ -816,11 +996,19 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa httpProxyConfig, securityProfile, storageProfile, + ingressProfile, publicNetworkAccess, workloadAutoScalerProfile, azureMonitorProfile, + safeguardsProfile, serviceMeshProfile, resourceUID, + metricsProfile, + aiToolchainOperatorProfile, + nodeProvisioningProfile, + bootstrapProfile, + schedulerProfile, + status, serializedAdditionalRawData); } @@ -907,6 +1095,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" eTag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" eTag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); if (hasPropertyOverride) { @@ -952,6 +1155,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kind: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Kind)) + { + builder.Append(" kind: "); + if (Kind.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Kind}'''"); + } + else + { + builder.AppendLine($"'{Kind}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { @@ -1027,6 +1253,26 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("CreationDataSourceResourceId", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" creationData: "); + builder.AppendLine("{"); + builder.AppendLine(" creationData: {"); + builder.Append(" sourceResourceId: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(CreationData)) + { + builder.Append(" creationData: "); + BicepSerializationHelpers.AppendChildObject(builder, CreationData, options, 4, false, " creationData: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxAgentPools), out propertyOverride); if (hasPropertyOverride) { @@ -1348,6 +1594,26 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("NodeResourceGroupRestrictionLevel", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeResourceGroupProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" nodeResourceGroupProfile: {"); + builder.Append(" restrictionLevel: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(NodeResourceGroupProfile)) + { + builder.Append(" nodeResourceGroupProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, NodeResourceGroupProfile, options, 4, false, " nodeResourceGroupProfile: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableRbac), out propertyOverride); if (hasPropertyOverride) { @@ -1379,18 +1645,18 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnablePodSecurityPolicy), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableNamespaceResources), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" enablePodSecurityPolicy: "); + builder.Append(" enableNamespaceResources: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(EnablePodSecurityPolicy)) + if (Optional.IsDefined(EnableNamespaceResources)) { - builder.Append(" enablePodSecurityPolicy: "); - var boolValue = EnablePodSecurityPolicy.Value == true ? "true" : "false"; + builder.Append(" enableNamespaceResources: "); + var boolValue = EnableNamespaceResources.Value == true ? "true" : "false"; builder.AppendLine($"{boolValue}"); } } @@ -1613,6 +1879,26 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("IngressWebAppRouting", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ingressProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" ingressProfile: {"); + builder.Append(" webAppRouting: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(IngressProfile)) + { + builder.Append(" ingressProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, IngressProfile, options, 4, false, " ingressProfile: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicNetworkAccess), out propertyOverride); if (hasPropertyOverride) { @@ -1643,16 +1929,11 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("AzureMonitorMetrics", out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AzureMonitorProfile), out propertyOverride); if (hasPropertyOverride) { builder.Append(" azureMonitorProfile: "); - builder.AppendLine("{"); - builder.AppendLine(" azureMonitorProfile: {"); - builder.Append(" metrics: "); builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); } else { @@ -1663,6 +1944,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SafeguardsProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" safeguardsProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SafeguardsProfile)) + { + builder.Append(" safeguardsProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, SafeguardsProfile, options, 4, false, " safeguardsProfile: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServiceMeshProfile), out propertyOverride); if (hasPropertyOverride) { @@ -1693,6 +1989,122 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("CostAnalysisEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" metricsProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" metricsProfile: {"); + builder.AppendLine(" costAnalysis: {"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(MetricsProfile)) + { + builder.Append(" metricsProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, MetricsProfile, options, 4, false, " metricsProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("AiToolchainOperatorProfileEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" aiToolchainOperatorProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" aiToolchainOperatorProfile: {"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(AiToolchainOperatorProfile)) + { + builder.Append(" aiToolchainOperatorProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, AiToolchainOperatorProfile, options, 4, false, " aiToolchainOperatorProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeProvisioningProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeProvisioningProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NodeProvisioningProfile)) + { + builder.Append(" nodeProvisioningProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, NodeProvisioningProfile, options, 4, false, " nodeProvisioningProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BootstrapProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" bootstrapProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(BootstrapProfile)) + { + builder.Append(" bootstrapProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, BootstrapProfile, options, 4, false, " bootstrapProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("UpstreamSchedulerConfigMode", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" schedulerProfile: "); + builder.AppendLine("{"); + builder.AppendLine(" schedulerProfile: {"); + builder.AppendLine(" schedulerInstanceProfiles: {"); + builder.AppendLine(" upstream: {"); + builder.Append(" schedulerConfigMode: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(SchedulerProfile)) + { + builder.Append(" schedulerProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, SchedulerProfile, options, 4, false, " schedulerProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("StatusProvisioningError", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine("{"); + builder.AppendLine(" status: {"); + builder.Append(" provisioningError: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 4, false, " status: "); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs index 9d7696707b56..5fdff978de0c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs @@ -69,14 +69,17 @@ public ContainerServiceManagedClusterData(AzureLocation location) : base(locatio /// The systemData. /// The tags. /// The location. + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// The managed cluster SKU. /// The extended location of the Virtual Machine. /// The identity of the managed cluster, if configured. + /// This is primarily used to expose different UI experiences in the portal for different kinds. /// The current provisioning state. /// The Power State of the cluster. + /// CreationData to be used to specify the source Snapshot ID if the cluster will be created/upgraded using a snapshot. /// The max number of agent pools for the managed cluster. - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. - /// If kubernetesVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If kubernetesVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. + /// The version of Kubernetes the Managed Cluster is running. /// This cannot be updated once the Managed Cluster has been created. /// This cannot be updated once the Managed Cluster has been created. /// The FQDN of the master pool. @@ -90,9 +93,10 @@ public ContainerServiceManagedClusterData(AzureLocation location) : base(locatio /// See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. /// The OIDC issuer profile of the Managed Cluster. /// The name of the resource group containing agent pool nodes. + /// The node resource group configuration profile. /// Whether to enable Kubernetes Role-Based Access Control. /// The support plan for the Managed Cluster. If unspecified, the default is 'KubernetesOfficial'. - /// (DEPRECATED) Whether to enable Kubernetes pod security policy (preview). PodSecurityPolicy was deprecated in Kubernetes v1.21, and removed from Kubernetes in v1.25. Learn more at https://aka.ms/k8s/psp and https://aka.ms/aks/psp. + /// The default value is false. It can be enabled/disabled on creation and updating of the managed cluster. See [https://aka.ms/NamespaceARMResource](https://aka.ms/NamespaceARMResource) for more details on Namespace as a ARM Resource. /// The network configuration profile. /// The Azure Active Directory configuration. /// The auto upgrade configuration. @@ -100,25 +104,36 @@ public ContainerServiceManagedClusterData(AzureLocation location) : base(locatio /// Parameters to be applied to the cluster-autoscaler when enabled. /// The access profile for managed cluster API server. /// This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. - /// Identities associated with the cluster. + /// The user identity associated with the managed cluster. This identity will be used by the kubelet. Only one user assigned identity is allowed. The only accepted key is "kubeletidentity", with value of "resourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}". /// Private link resources associated with the cluster. /// If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview). /// Configurations for provisioning the cluster with HTTP proxy servers. /// Security profile for the managed cluster. /// Storage profile for the managed cluster. + /// Ingress profile for the managed cluster. /// Allow or deny public network access for AKS. /// Workload Auto-scaler profile for the managed cluster. - /// Azure Monitor addon profiles for monitoring the managed cluster. + /// Prometheus addon profile for the container service cluster. + /// The Safeguards profile holds all the safeguards information for a given cluster. /// Service mesh profile for a managed cluster. /// The resourceUID uniquely identifies ManagedClusters that reuse ARM ResourceIds (i.e: create, delete, create sequence). + /// Optional cluster metrics configuration. + /// AI toolchain operator settings that apply to the whole cluster. + /// Node provisioning settings that apply to the whole cluster. + /// Profile of the cluster bootstrap configuration. + /// Profile of the pod scheduler configuration. + /// Contains read-only information about the Managed Cluster. /// Keeps track of any properties unknown to the library. - internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedClusterSku sku, ExtendedLocation extendedLocation, ManagedClusterIdentity clusterIdentity, string provisioningState, ContainerServicePowerState powerState, int? maxAgentPools, string kubernetesVersion, string currentKubernetesVersion, string dnsPrefix, string fqdnSubdomain, string fqdn, string privateFqdn, string azurePortalFqdn, IList agentPoolProfiles, ContainerServiceLinuxProfile linuxProfile, ManagedClusterWindowsProfile windowsProfile, ManagedClusterServicePrincipalProfile servicePrincipalProfile, IDictionary addonProfiles, ManagedClusterPodIdentityProfile podIdentityProfile, ManagedClusterOidcIssuerProfile oidcIssuerProfile, string nodeResourceGroup, bool? enableRbac, KubernetesSupportPlan? supportPlan, bool? enablePodSecurityPolicy, ContainerServiceNetworkProfile networkProfile, ManagedClusterAadProfile aadProfile, ManagedClusterAutoUpgradeProfile autoUpgradeProfile, ClusterUpgradeSettings upgradeSettings, ManagedClusterAutoScalerProfile autoScalerProfile, ManagedClusterApiServerAccessProfile apiServerAccessProfile, ResourceIdentifier diskEncryptionSetId, IDictionary identityProfile, IList privateLinkResources, bool? disableLocalAccounts, ManagedClusterHttpProxyConfig httpProxyConfig, ManagedClusterSecurityProfile securityProfile, ManagedClusterStorageProfile storageProfile, ContainerServicePublicNetworkAccess? publicNetworkAccess, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile, ManagedClusterAzureMonitorProfile azureMonitorProfile, ServiceMeshProfile serviceMeshProfile, ResourceIdentifier resourceId, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ManagedClusterSku sku, ExtendedLocation extendedLocation, ManagedClusterIdentity clusterIdentity, string kind, string provisioningState, ContainerServicePowerState powerState, ContainerServiceCreationData creationData, int? maxAgentPools, string kubernetesVersion, string currentKubernetesVersion, string dnsPrefix, string fqdnSubdomain, string fqdn, string privateFqdn, string azurePortalFqdn, IList agentPoolProfiles, ContainerServiceLinuxProfile linuxProfile, ManagedClusterWindowsProfile windowsProfile, ManagedClusterServicePrincipalProfile servicePrincipalProfile, IDictionary addonProfiles, ManagedClusterPodIdentityProfile podIdentityProfile, ManagedClusterOidcIssuerProfile oidcIssuerProfile, string nodeResourceGroup, ManagedClusterNodeResourceGroupProfile nodeResourceGroupProfile, bool? enableRbac, KubernetesSupportPlan? supportPlan, bool? enableNamespaceResources, ContainerServiceNetworkProfile networkProfile, ManagedClusterAadProfile aadProfile, ManagedClusterAutoUpgradeProfile autoUpgradeProfile, ClusterUpgradeSettings upgradeSettings, ManagedClusterAutoScalerProfile autoScalerProfile, ManagedClusterApiServerAccessProfile apiServerAccessProfile, ResourceIdentifier diskEncryptionSetId, IDictionary identityProfile, IList privateLinkResources, bool? disableLocalAccounts, ManagedClusterHttpProxyConfig httpProxyConfig, ManagedClusterSecurityProfile securityProfile, ManagedClusterStorageProfile storageProfile, ManagedClusterIngressProfile ingressProfile, ContainerServicePublicNetworkAccess? publicNetworkAccess, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile, ManagedClusterAzureMonitorProfile azureMonitorProfile, SafeguardsProfile safeguardsProfile, ServiceMeshProfile serviceMeshProfile, ResourceIdentifier resourceId, ManagedClusterMetricsProfile metricsProfile, ManagedClusterAIToolchainOperatorProfile aiToolchainOperatorProfile, ManagedClusterNodeProvisioningProfile nodeProvisioningProfile, ManagedClusterBootstrapProfile bootstrapProfile, SchedulerProfile schedulerProfile, ManagedClusterStatus status, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { + ETag = etag; Sku = sku; ExtendedLocation = extendedLocation; ClusterIdentity = clusterIdentity; + Kind = kind; ProvisioningState = provisioningState; PowerState = powerState; + CreationData = creationData; MaxAgentPools = maxAgentPools; KubernetesVersion = kubernetesVersion; CurrentKubernetesVersion = currentKubernetesVersion; @@ -135,9 +150,10 @@ internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, PodIdentityProfile = podIdentityProfile; OidcIssuerProfile = oidcIssuerProfile; NodeResourceGroup = nodeResourceGroup; + NodeResourceGroupProfile = nodeResourceGroupProfile; EnableRbac = enableRbac; SupportPlan = supportPlan; - EnablePodSecurityPolicy = enablePodSecurityPolicy; + EnableNamespaceResources = enableNamespaceResources; NetworkProfile = networkProfile; AadProfile = aadProfile; AutoUpgradeProfile = autoUpgradeProfile; @@ -151,11 +167,19 @@ internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, HttpProxyConfig = httpProxyConfig; SecurityProfile = securityProfile; StorageProfile = storageProfile; + IngressProfile = ingressProfile; PublicNetworkAccess = publicNetworkAccess; WorkloadAutoScalerProfile = workloadAutoScalerProfile; AzureMonitorProfile = azureMonitorProfile; + SafeguardsProfile = safeguardsProfile; ServiceMeshProfile = serviceMeshProfile; ResourceId = resourceId; + MetricsProfile = metricsProfile; + AiToolchainOperatorProfile = aiToolchainOperatorProfile; + NodeProvisioningProfile = nodeProvisioningProfile; + BootstrapProfile = bootstrapProfile; + SchedulerProfile = schedulerProfile; + Status = status; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -164,6 +188,9 @@ internal ContainerServiceManagedClusterData() { } + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. + [WirePath("eTag")] + public ETag? ETag { get; } /// The managed cluster SKU. [WirePath("sku")] public ManagedClusterSku Sku { get; set; } @@ -173,6 +200,9 @@ internal ContainerServiceManagedClusterData() /// The identity of the managed cluster, if configured. [WirePath("identity")] public ManagedClusterIdentity ClusterIdentity { get; set; } + /// This is primarily used to expose different UI experiences in the portal for different kinds. + [WirePath("kind")] + public string Kind { get; set; } /// The current provisioning state. [WirePath("properties.provisioningState")] public string ProvisioningState { get; } @@ -185,13 +215,28 @@ public ContainerServiceStateCode? PowerStateCode get => PowerState?.Code; } + /// CreationData to be used to specify the source Snapshot ID if the cluster will be created/upgraded using a snapshot. + internal ContainerServiceCreationData CreationData { get; set; } + /// This is the ARM ID of the source object to be used to create the target object. + [WirePath("properties.creationData.sourceResourceId")] + public ResourceIdentifier CreationDataSourceResourceId + { + get => CreationData is null ? default : CreationData.SourceResourceId; + set + { + if (CreationData is null) + CreationData = new ContainerServiceCreationData(); + CreationData.SourceResourceId = value; + } + } + /// The max number of agent pools for the managed cluster. [WirePath("properties.maxAgentPools")] public int? MaxAgentPools { get; } - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. + /// When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. [WirePath("properties.kubernetesVersion")] public string KubernetesVersion { get; set; } - /// If kubernetesVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If kubernetesVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// The version of Kubernetes the Managed Cluster is running. [WirePath("properties.currentKubernetesVersion")] public string CurrentKubernetesVersion { get; } /// This cannot be updated once the Managed Cluster has been created. @@ -233,15 +278,30 @@ public ContainerServiceStateCode? PowerStateCode /// The name of the resource group containing agent pool nodes. [WirePath("properties.nodeResourceGroup")] public string NodeResourceGroup { get; set; } + /// The node resource group configuration profile. + internal ManagedClusterNodeResourceGroupProfile NodeResourceGroupProfile { get; set; } + /// The restriction level applied to the cluster's node resource group. + [WirePath("properties.nodeResourceGroupProfile.restrictionLevel")] + public RestrictionLevel? NodeResourceGroupRestrictionLevel + { + get => NodeResourceGroupProfile is null ? default : NodeResourceGroupProfile.RestrictionLevel; + set + { + if (NodeResourceGroupProfile is null) + NodeResourceGroupProfile = new ManagedClusterNodeResourceGroupProfile(); + NodeResourceGroupProfile.RestrictionLevel = value; + } + } + /// Whether to enable Kubernetes Role-Based Access Control. [WirePath("properties.enableRBAC")] public bool? EnableRbac { get; set; } /// The support plan for the Managed Cluster. If unspecified, the default is 'KubernetesOfficial'. [WirePath("properties.supportPlan")] public KubernetesSupportPlan? SupportPlan { get; set; } - /// (DEPRECATED) Whether to enable Kubernetes pod security policy (preview). PodSecurityPolicy was deprecated in Kubernetes v1.21, and removed from Kubernetes in v1.25. Learn more at https://aka.ms/k8s/psp and https://aka.ms/aks/psp. - [WirePath("properties.enablePodSecurityPolicy")] - public bool? EnablePodSecurityPolicy { get; set; } + /// The default value is false. It can be enabled/disabled on creation and updating of the managed cluster. See [https://aka.ms/NamespaceARMResource](https://aka.ms/NamespaceARMResource) for more details on Namespace as a ARM Resource. + [WirePath("properties.enableNamespaceResources")] + public bool? EnableNamespaceResources { get; set; } /// The network configuration profile. [WirePath("properties.networkProfile")] public ContainerServiceNetworkProfile NetworkProfile { get; set; } @@ -275,7 +335,7 @@ public UpgradeOverrideSettings UpgradeOverrideSettings /// This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. [WirePath("properties.diskEncryptionSetID")] public ResourceIdentifier DiskEncryptionSetId { get; set; } - /// Identities associated with the cluster. + /// The user identity associated with the managed cluster. This identity will be used by the kubelet. Only one user assigned identity is allowed. The only accepted key is "kubeletidentity", with value of "resourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}". [WirePath("properties.identityProfile")] public IDictionary IdentityProfile { get; } /// Private link resources associated with the cluster. @@ -293,32 +353,97 @@ public UpgradeOverrideSettings UpgradeOverrideSettings /// Storage profile for the managed cluster. [WirePath("properties.storageProfile")] public ManagedClusterStorageProfile StorageProfile { get; set; } - /// Allow or deny public network access for AKS. - [WirePath("properties.publicNetworkAccess")] - public ContainerServicePublicNetworkAccess? PublicNetworkAccess { get; set; } - /// Workload Auto-scaler profile for the managed cluster. - [WirePath("properties.workloadAutoScalerProfile")] - public ManagedClusterWorkloadAutoScalerProfile WorkloadAutoScalerProfile { get; set; } - /// Azure Monitor addon profiles for monitoring the managed cluster. - internal ManagedClusterAzureMonitorProfile AzureMonitorProfile { get; set; } - /// Metrics profile for the Azure Monitor managed service for Prometheus addon. Collect out-of-the-box Kubernetes infrastructure metrics to send to an Azure Monitor Workspace and configure additional scraping for custom targets. See aka.ms/AzureManagedPrometheus for an overview. - [WirePath("properties.azureMonitorProfile.metrics")] - public ManagedClusterMonitorProfileMetrics AzureMonitorMetrics + /// Ingress profile for the managed cluster. + internal ManagedClusterIngressProfile IngressProfile { get; set; } + /// Web App Routing settings for the ingress profile. + [WirePath("properties.ingressProfile.webAppRouting")] + public ManagedClusterIngressProfileWebAppRouting IngressWebAppRouting { - get => AzureMonitorProfile is null ? default : AzureMonitorProfile.Metrics; + get => IngressProfile is null ? default : IngressProfile.WebAppRouting; set { - if (AzureMonitorProfile is null) - AzureMonitorProfile = new ManagedClusterAzureMonitorProfile(); - AzureMonitorProfile.Metrics = value; + if (IngressProfile is null) + IngressProfile = new ManagedClusterIngressProfile(); + IngressProfile.WebAppRouting = value; } } + /// Allow or deny public network access for AKS. + [WirePath("properties.publicNetworkAccess")] + public ContainerServicePublicNetworkAccess? PublicNetworkAccess { get; set; } + /// Workload Auto-scaler profile for the managed cluster. + [WirePath("properties.workloadAutoScalerProfile")] + public ManagedClusterWorkloadAutoScalerProfile WorkloadAutoScalerProfile { get; set; } + /// Prometheus addon profile for the container service cluster. + [WirePath("properties.azureMonitorProfile")] + public ManagedClusterAzureMonitorProfile AzureMonitorProfile { get; set; } + /// The Safeguards profile holds all the safeguards information for a given cluster. + [WirePath("properties.safeguardsProfile")] + public SafeguardsProfile SafeguardsProfile { get; set; } /// Service mesh profile for a managed cluster. [WirePath("properties.serviceMeshProfile")] public ServiceMeshProfile ServiceMeshProfile { get; set; } /// The resourceUID uniquely identifies ManagedClusters that reuse ARM ResourceIds (i.e: create, delete, create sequence). [WirePath("properties.resourceUID")] public ResourceIdentifier ResourceId { get; } + /// Optional cluster metrics configuration. + internal ManagedClusterMetricsProfile MetricsProfile { get; set; } + /// The Managed Cluster sku.tier must be set to 'Standard' or 'Premium' to enable this feature. Enabling this will add Kubernetes Namespace and Deployment details to the Cost Analysis views in the Azure portal. If not specified, the default is false. For more information see aka.ms/aks/docs/cost-analysis. + [WirePath("properties.metricsProfile.costAnalysis.enabled")] + public bool? CostAnalysisEnabled + { + get => MetricsProfile is null ? default : MetricsProfile.CostAnalysisEnabled; + set + { + if (MetricsProfile is null) + MetricsProfile = new ManagedClusterMetricsProfile(); + MetricsProfile.CostAnalysisEnabled = value; + } + } + + /// AI toolchain operator settings that apply to the whole cluster. + internal ManagedClusterAIToolchainOperatorProfile AiToolchainOperatorProfile { get; set; } + /// Indicates if AI toolchain operator enabled or not. + [WirePath("properties.aiToolchainOperatorProfile.enabled")] + public bool? AiToolchainOperatorProfileEnabled + { + get => AiToolchainOperatorProfile is null ? default : AiToolchainOperatorProfile.Enabled; + set + { + if (AiToolchainOperatorProfile is null) + AiToolchainOperatorProfile = new ManagedClusterAIToolchainOperatorProfile(); + AiToolchainOperatorProfile.Enabled = value; + } + } + + /// Node provisioning settings that apply to the whole cluster. + [WirePath("properties.nodeProvisioningProfile")] + public ManagedClusterNodeProvisioningProfile NodeProvisioningProfile { get; set; } + /// Profile of the cluster bootstrap configuration. + [WirePath("properties.bootstrapProfile")] + public ManagedClusterBootstrapProfile BootstrapProfile { get; set; } + /// Profile of the pod scheduler configuration. + internal SchedulerProfile SchedulerProfile { get; set; } + /// The config customization mode for this scheduler instance. + [WirePath("properties.schedulerProfile.schedulerInstanceProfiles.upstream.schedulerConfigMode")] + public SchedulerConfigMode? UpstreamSchedulerConfigMode + { + get => SchedulerProfile is null ? default : SchedulerProfile.UpstreamSchedulerConfigMode; + set + { + if (SchedulerProfile is null) + SchedulerProfile = new SchedulerProfile(); + SchedulerProfile.UpstreamSchedulerConfigMode = value; + } + } + + /// Contains read-only information about the Managed Cluster. + internal ManagedClusterStatus Status { get; set; } + /// Preserves the detailed info of failure. If there was no error, this field is omitted. + [WirePath("properties.status.provisioningError")] + public ResponseError StatusProvisioningError + { + get => Status is null ? default : Status.ProvisioningError; + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs index e9761b7a74dd..334dbdd75415 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs @@ -44,6 +44,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly PrivateLinkResourcesRestOperations _privateLinkResourcesRestClient; private readonly ClientDiagnostics _resolvePrivateLinkServiceIdClientDiagnostics; private readonly ResolvePrivateLinkServiceIdRestOperations _resolvePrivateLinkServiceIdRestClient; + private readonly ClientDiagnostics _operationStatusResultClientDiagnostics; + private readonly OperationStatusResultRestOperations _operationStatusResultRestClient; private readonly ContainerServiceManagedClusterData _data; /// Gets the resource type for the operations. @@ -77,6 +79,8 @@ internal ContainerServiceManagedClusterResource(ArmClient client, ResourceIdenti _privateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _resolvePrivateLinkServiceIdClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); _resolvePrivateLinkServiceIdRestClient = new ResolvePrivateLinkServiceIdRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _operationStatusResultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _operationStatusResultRestClient = new OperationStatusResultRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -130,7 +134,7 @@ public virtual MeshUpgradeProfileCollection GetMeshUpgradeProfiles() /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -161,7 +165,7 @@ public virtual async Task> GetMeshUpgradePr /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -199,7 +203,7 @@ public virtual ContainerServiceMaintenanceConfigurationCollection GetContainerSe /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -230,7 +234,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -248,6 +252,75 @@ public virtual Response GetCon return GetContainerServiceMaintenanceConfigurations().Get(configName, cancellationToken); } + /// Gets a collection of NamespaceResources in the ContainerServiceManagedCluster. + /// An object representing collection of NamespaceResources and their operations over a NamespaceResource. + public virtual NamespaceCollection GetNamespaces() + { + return GetCachedClient(client => new NamespaceCollection(client, Id)); + } + + /// + /// Gets the specified namespace of a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the namespace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNamespaceAsync(string namespaceName, CancellationToken cancellationToken = default) + { + return await GetNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified namespace of a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the namespace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNamespace(string namespaceName, CancellationToken cancellationToken = default) + { + return GetNamespaces().Get(namespaceName, cancellationToken); + } + /// Gets a collection of ContainerServiceAgentPoolResources in the ContainerServiceManagedCluster. /// An object representing collection of ContainerServiceAgentPoolResources and their operations over a ContainerServiceAgentPoolResource. public virtual ContainerServiceAgentPoolCollection GetContainerServiceAgentPools() @@ -268,7 +341,7 @@ public virtual ContainerServiceAgentPoolCollection GetContainerServiceAgentPools /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -299,7 +372,7 @@ public virtual async Task> GetContai /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -337,7 +410,7 @@ public virtual ContainerServicePrivateEndpointConnectionCollection GetContainerS /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -368,7 +441,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -406,7 +479,7 @@ public virtual ContainerServiceTrustedAccessRoleBindingCollection GetContainerSe /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -437,7 +510,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -455,6 +528,75 @@ public virtual Response GetCon return GetContainerServiceTrustedAccessRoleBindings().Get(trustedAccessRoleBindingName, cancellationToken); } + /// Gets a collection of LoadBalancerResources in the ContainerServiceManagedCluster. + /// An object representing collection of LoadBalancerResources and their operations over a LoadBalancerResource. + public virtual LoadBalancerCollection GetLoadBalancers() + { + return GetCachedClient(client => new LoadBalancerCollection(client, Id)); + } + + /// + /// Gets the specified load balancer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the load balancer. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLoadBalancerAsync(string loadBalancerName, CancellationToken cancellationToken = default) + { + return await GetLoadBalancers().GetAsync(loadBalancerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified load balancer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the load balancer. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLoadBalancer(string loadBalancerName, CancellationToken cancellationToken = default) + { + return GetLoadBalancers().Get(loadBalancerName, cancellationToken); + } + /// /// Gets a managed cluster. /// @@ -468,7 +610,7 @@ public virtual Response GetCon /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -508,7 +650,7 @@ public virtual async Task> GetA /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -535,6 +677,94 @@ public virtual Response Get(Cancellation } } + /// + /// Deletes a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusters_Delete + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The request should only proceed if an entity matches this string. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, bool? ignorePodDisruptionBudget = null, CancellationToken cancellationToken = default) + { + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Delete"); + scope.Start(); + try + { + var response = await _containerServiceManagedClusterManagedClustersRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, ignorePodDisruptionBudget, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, ignorePodDisruptionBudget).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusters_Delete + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The request should only proceed if an entity matches this string. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, bool? ignorePodDisruptionBudget = null, CancellationToken cancellationToken = default) + { + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Delete"); + scope.Start(); + try + { + var response = _containerServiceManagedClusterManagedClustersRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, ignorePodDisruptionBudget, cancellationToken); + var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, ignorePodDisruptionBudget).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Updates tags on a managed cluster. /// @@ -548,7 +778,7 @@ public virtual Response Get(Cancellation /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -558,9 +788,10 @@ public virtual Response Get(Cancellation /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Parameters supplied to the Update Managed Cluster Tags operation. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); @@ -568,8 +799,8 @@ public virtual async Task> scope.Start(); try { - var response = await _containerServiceManagedClusterManagedClustersRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateUpdateTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceManagedClusterManagedClustersRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateUpdateTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -594,7 +825,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -604,9 +835,10 @@ public virtual async Task> /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Parameters supplied to the Update Managed Cluster Tags operation. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); @@ -614,8 +846,8 @@ public virtual ArmOperation Update(WaitU scope.Start(); try { - var response = _containerServiceManagedClusterManagedClustersRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, cancellationToken); - var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateUpdateTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceManagedClusterManagedClustersRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new ContainerServiceManagedClusterOperationSource(Client), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateUpdateTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -640,7 +872,7 @@ public virtual ArmOperation Update(WaitU /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -679,7 +911,7 @@ public virtual async Task> GetAccessProfil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -718,7 +950,7 @@ public virtual Response GetAccessProfile(string rol /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -757,7 +989,7 @@ public virtual async Task> GetClusterAdminCr /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -796,7 +1028,7 @@ public virtual Response GetClusterAdminCredentials(st /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -836,7 +1068,7 @@ public virtual async Task> GetClusterUserCre /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -876,7 +1108,7 @@ public virtual Response GetClusterUserCredentials(str /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -915,7 +1147,7 @@ public virtual async Task> GetClusterMonitor /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -954,7 +1186,7 @@ public virtual Response GetClusterMonitoringUserCrede /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1000,7 +1232,7 @@ public virtual async Task ResetServicePrincipalProfileAsync(WaitUn /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1046,7 +1278,7 @@ public virtual ArmOperation ResetServicePrincipalProfile(WaitUntil waitUntil, Ma /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1092,7 +1324,7 @@ public virtual async Task ResetAadProfileAsync(WaitUntil waitUntil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1126,19 +1358,19 @@ public virtual ArmOperation ResetAadProfile(WaitUntil waitUntil, ManagedClusterA } /// - /// See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. + /// Aborts the currently running operation on the managed cluster. The Managed Cluster will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, an error is returned. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort /// /// /// Operation Id - /// ManagedClusters_RotateClusterCertificates + /// ManagedClusters_AbortLatestOperation /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1148,14 +1380,14 @@ public virtual ArmOperation ResetAadProfile(WaitUntil waitUntil, ManagedClusterA /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual async Task RotateClusterCertificatesAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task AbortLatestOperationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RotateClusterCertificates"); + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.AbortLatestOperation"); scope.Start(); try { - var response = await _containerServiceManagedClusterManagedClustersRestClient.RotateClusterCertificatesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateRotateClusterCertificatesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceManagedClusterManagedClustersRestClient.AbortLatestOperationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateAbortLatestOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1168,19 +1400,19 @@ public virtual async Task RotateClusterCertificatesAsync(WaitUntil } /// - /// See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. + /// Aborts the currently running operation on the managed cluster. The Managed Cluster will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, an error is returned. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort /// /// /// Operation Id - /// ManagedClusters_RotateClusterCertificates + /// ManagedClusters_AbortLatestOperation /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1190,14 +1422,14 @@ public virtual async Task RotateClusterCertificatesAsync(WaitUntil /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual ArmOperation RotateClusterCertificates(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation AbortLatestOperation(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RotateClusterCertificates"); + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.AbortLatestOperation"); scope.Start(); try { - var response = _containerServiceManagedClusterManagedClustersRestClient.RotateClusterCertificates(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateRotateClusterCertificatesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceManagedClusterManagedClustersRestClient.AbortLatestOperation(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateAbortLatestOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -1210,19 +1442,19 @@ public virtual ArmOperation RotateClusterCertificates(WaitUntil waitUntil, Cance } /// - /// Aborts the currently running operation on the managed cluster. The Managed Cluster will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, a 409 error code is returned. + /// See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates /// /// /// Operation Id - /// ManagedClusters_AbortLatestOperation + /// ManagedClusters_RotateClusterCertificates /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1232,14 +1464,14 @@ public virtual ArmOperation RotateClusterCertificates(WaitUntil waitUntil, Cance /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual async Task AbortLatestOperationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task RotateClusterCertificatesAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.AbortLatestOperation"); + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RotateClusterCertificates"); scope.Start(); try { - var response = await _containerServiceManagedClusterManagedClustersRestClient.AbortLatestOperationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateAbortLatestOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _containerServiceManagedClusterManagedClustersRestClient.RotateClusterCertificatesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateRotateClusterCertificatesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1252,19 +1484,19 @@ public virtual async Task AbortLatestOperationAsync(WaitUntil wait } /// - /// Aborts the currently running operation on the managed cluster. The Managed Cluster will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, a 409 error code is returned. + /// See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates /// /// /// Operation Id - /// ManagedClusters_AbortLatestOperation + /// ManagedClusters_RotateClusterCertificates /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1274,14 +1506,14 @@ public virtual async Task AbortLatestOperationAsync(WaitUntil wait /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual ArmOperation AbortLatestOperation(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation RotateClusterCertificates(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.AbortLatestOperation"); + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RotateClusterCertificates"); scope.Start(); try { - var response = _containerServiceManagedClusterManagedClustersRestClient.AbortLatestOperation(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateAbortLatestOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _containerServiceManagedClusterManagedClustersRestClient.RotateClusterCertificates(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateRotateClusterCertificatesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -1306,7 +1538,7 @@ public virtual ArmOperation AbortLatestOperation(WaitUntil waitUntil, Cancellati /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1348,7 +1580,7 @@ public virtual async Task RotateServiceAccountSigningKeysAsync(Wai /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1390,7 +1622,7 @@ public virtual ArmOperation RotateServiceAccountSigningKeys(WaitUntil waitUntil, /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1432,7 +1664,7 @@ public virtual async Task StopAsync(WaitUntil waitUntil, Cancellat /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1474,7 +1706,7 @@ public virtual ArmOperation Stop(WaitUntil waitUntil, CancellationToken cancella /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1516,7 +1748,7 @@ public virtual async Task StartAsync(WaitUntil waitUntil, Cancella /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1558,7 +1790,7 @@ public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1604,7 +1836,7 @@ public virtual async Task> RunComma /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1650,7 +1882,7 @@ public virtual ArmOperation RunCommand(WaitUntil /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -1689,7 +1921,7 @@ public virtual async Task> GetCommandRe /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -1728,7 +1960,7 @@ public virtual Response GetCommandResult(string /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1758,7 +1990,7 @@ public virtual AsyncPageable GetOut /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -1775,6 +2007,98 @@ public virtual Pageable GetOutbound return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ContainerServiceOutboundEnvironmentEndpoint.DeserializeContainerServiceOutboundEnvironmentEndpoint(e), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "ContainerServiceManagedClusterResource.GetOutboundNetworkDependenciesEndpoints", "value", "nextLink", cancellationToken); } + /// + /// Rebalance nodes across specific load balancers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rebalanceLoadBalancers + /// + /// + /// Operation Id + /// ManagedClusters_RebalanceLoadBalancers + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The names of the load balancers to be rebalanced. If set to empty, all load balancers will be rebalanced. + /// The cancellation token to use. + /// is null. + public virtual async Task RebalanceLoadBalancersAsync(WaitUntil waitUntil, RebalanceLoadBalancersRequestBody rebalanceLoadBalancersRequestBody, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(rebalanceLoadBalancersRequestBody, nameof(rebalanceLoadBalancersRequestBody)); + + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RebalanceLoadBalancers"); + scope.Start(); + try + { + var response = await _containerServiceManagedClusterManagedClustersRestClient.RebalanceLoadBalancersAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rebalanceLoadBalancersRequestBody, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateRebalanceLoadBalancersRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rebalanceLoadBalancersRequestBody).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Rebalance nodes across specific load balancers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rebalanceLoadBalancers + /// + /// + /// Operation Id + /// ManagedClusters_RebalanceLoadBalancers + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The names of the load balancers to be rebalanced. If set to empty, all load balancers will be rebalanced. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation RebalanceLoadBalancers(WaitUntil waitUntil, RebalanceLoadBalancersRequestBody rebalanceLoadBalancersRequestBody, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(rebalanceLoadBalancersRequestBody, nameof(rebalanceLoadBalancersRequestBody)); + + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RebalanceLoadBalancers"); + scope.Start(); + try + { + var response = _containerServiceManagedClusterManagedClustersRestClient.RebalanceLoadBalancers(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rebalanceLoadBalancersRequestBody, cancellationToken); + var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateRebalanceLoadBalancersRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rebalanceLoadBalancersRequestBody).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. /// @@ -1788,7 +2112,7 @@ public virtual Pageable GetOutbound /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -1822,7 +2146,7 @@ public virtual async Task> GetAvailableAgen /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -1856,7 +2180,7 @@ public virtual Response GetAvailableAgentPoolVersion /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -1881,7 +2205,7 @@ public virtual AsyncPageable GetPrivate /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -1906,7 +2230,7 @@ public virtual Pageable GetPrivateLinkR /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -1944,7 +2268,7 @@ public virtual async Task> Res /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -1969,6 +2293,136 @@ public virtual Response ResolvePrivateL } } + /// + /// Gets a list of operations in the specified managedCluster + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/operations + /// + /// + /// Operation Id + /// OperationStatusResult_List + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationStatusResultsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _operationStatusResultRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _operationStatusResultRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => OperationStatusResult.DeserializeOperationStatusResult(e), _operationStatusResultClientDiagnostics, Pipeline, "ContainerServiceManagedClusterResource.GetOperationStatusResults", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of operations in the specified managedCluster + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/operations + /// + /// + /// Operation Id + /// OperationStatusResult_List + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperationStatusResults(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _operationStatusResultRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _operationStatusResultRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => OperationStatusResult.DeserializeOperationStatusResult(e), _operationStatusResultClientDiagnostics, Pipeline, "ContainerServiceManagedClusterResource.GetOperationStatusResults", "value", "nextLink", cancellationToken); + } + + /// + /// Get the status of a specific operation in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/operations/{operationId} + /// + /// + /// Operation Id + /// OperationStatusResult_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetOperationStatusResultAsync(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _operationStatusResultClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetOperationStatusResult"); + scope.Start(); + try + { + var response = await _operationStatusResultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, operationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the status of a specific operation in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/operations/{operationId} + /// + /// + /// Operation Id + /// OperationStatusResult_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetOperationStatusResult(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _operationStatusResultClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetOperationStatusResult"); + scope.Start(); + try + { + var response = _operationStatusResultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, operationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Add a tag to the current resource. /// @@ -1982,7 +2436,7 @@ public virtual Response ResolvePrivateL /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -2044,7 +2498,7 @@ public virtual async Task> AddT /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -2106,7 +2560,7 @@ public virtual Response AddTag(string ke /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -2163,7 +2617,7 @@ public virtual async Task> SetT /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -2220,7 +2674,7 @@ public virtual Response SetTags(IDiction /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -2280,7 +2734,7 @@ public virtual async Task> Remo /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs index e42d1a48311f..11772f4b519a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation C /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(s /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -285,7 +285,7 @@ public virtual AsyncPageable /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -314,7 +314,7 @@ public virtual Pageable GetAl /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -357,7 +357,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -400,7 +400,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -445,7 +445,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs index 56db01f3bb7c..66c7455f7611 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(C /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -265,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -313,7 +313,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs index 53b1a5b4fea4..3a545adf83d4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation Cr /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(st /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable G /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string trustedAccessRoleBi /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string trustedAccessRoleBindingName, Cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs index c31d699ddd30..2a3490b0ba2f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(Ca /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -265,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -311,7 +311,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs index 9d4c114d8c6b..ab8fa15b04d1 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs @@ -34,60 +34,79 @@ private static MockableContainerServiceSubscriptionResource GetMockableContainer } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static OSOptionProfileResource GetOSOptionProfileResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ManagedClusterUpgradeProfileResource GetManagedClusterUpgradeProfileResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableContainerServiceArmClient(client).GetOSOptionProfileResource(id); + return GetMockableContainerServiceArmClient(client).GetManagedClusterUpgradeProfileResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ManagedClusterUpgradeProfileResource GetManagedClusterUpgradeProfileResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ContainerServiceManagedClusterResource GetContainerServiceManagedClusterResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableContainerServiceArmClient(client).GetManagedClusterUpgradeProfileResource(id); + return GetMockableContainerServiceArmClient(client).GetContainerServiceManagedClusterResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ContainerServiceManagedClusterResource GetContainerServiceManagedClusterResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static GuardrailsAvailableVersionResource GetGuardrailsAvailableVersionResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableContainerServiceArmClient(client).GetContainerServiceManagedClusterResource(id); + return GetMockableContainerServiceArmClient(client).GetGuardrailsAvailableVersionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SafeguardsAvailableVersionResource GetSafeguardsAvailableVersionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableContainerServiceArmClient(client).GetSafeguardsAvailableVersionResource(id); } /// @@ -147,6 +166,25 @@ public static ContainerServiceMaintenanceConfigurationResource GetContainerServi return GetMockableContainerServiceArmClient(client).GetContainerServiceMaintenanceConfigurationResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static NamespaceResource GetNamespaceResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableContainerServiceArmClient(client).GetNamespaceResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -185,6 +223,25 @@ public static AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfileResource return GetMockableContainerServiceArmClient(client).GetAgentPoolUpgradeProfileResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static MachineResource GetMachineResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableContainerServiceArmClient(client).GetMachineResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -223,6 +280,25 @@ public static AgentPoolSnapshotResource GetAgentPoolSnapshotResource(this ArmCli return GetMockableContainerServiceArmClient(client).GetAgentPoolSnapshotResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ManagedClusterSnapshotResource GetManagedClusterSnapshotResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableContainerServiceArmClient(client).GetManagedClusterSnapshotResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -242,6 +318,25 @@ public static ContainerServiceTrustedAccessRoleBindingResource GetContainerServi return GetMockableContainerServiceArmClient(client).GetContainerServiceTrustedAccessRoleBindingResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static LoadBalancerResource GetLoadBalancerResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableContainerServiceArmClient(client).GetLoadBalancerResource(id); + } + /// /// Gets a collection of ContainerServiceManagedClusterResources in the ResourceGroupResource. /// @@ -272,7 +367,7 @@ public static ContainerServiceManagedClusterCollection GetContainerServiceManage /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -310,7 +405,7 @@ public static async Task> GetCo /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -365,7 +460,7 @@ public static AgentPoolSnapshotCollection GetAgentPoolSnapshots(this ResourceGro /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -403,7 +498,7 @@ public static async Task> GetAgentPoolSnapsh /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -428,6 +523,291 @@ public static Response GetAgentPoolSnapshot(this Reso return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetAgentPoolSnapshot(resourceName, cancellationToken); } + /// + /// Gets a collection of ManagedClusterSnapshotResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of ManagedClusterSnapshotResources and their operations over a ManagedClusterSnapshotResource. + public static ManagedClusterSnapshotCollection GetManagedClusterSnapshots(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetManagedClusterSnapshots(); + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetManagedClusterSnapshotAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetManagedClusterSnapshotAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetManagedClusterSnapshot(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetManagedClusterSnapshot(resourceName, cancellationToken); + } + + /// + /// Gets a collection of GuardrailsAvailableVersionResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// is null. + /// An object representing collection of GuardrailsAvailableVersionResources and their operations over a GuardrailsAvailableVersionResource. + public static GuardrailsAvailableVersionCollection GetGuardrailsAvailableVersions(this SubscriptionResource subscriptionResource, AzureLocation location) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetGuardrailsAvailableVersions(location); + } + + /// + /// Contains Guardrails version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// Safeguards version. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetGuardrailsAvailableVersionAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetGuardrailsAvailableVersionAsync(location, version, cancellationToken).ConfigureAwait(false); + } + + /// + /// Contains Guardrails version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// Safeguards version. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetGuardrailsAvailableVersion(this SubscriptionResource subscriptionResource, AzureLocation location, string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetGuardrailsAvailableVersion(location, version, cancellationToken); + } + + /// + /// Gets a collection of SafeguardsAvailableVersionResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// is null. + /// An object representing collection of SafeguardsAvailableVersionResources and their operations over a SafeguardsAvailableVersionResource. + public static SafeguardsAvailableVersionCollection GetSafeguardsAvailableVersions(this SubscriptionResource subscriptionResource, AzureLocation location) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetSafeguardsAvailableVersions(location); + } + + /// + /// Contains Safeguards version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// Safeguards version. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSafeguardsAvailableVersionAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetSafeguardsAvailableVersionAsync(location, version, cancellationToken).ConfigureAwait(false); + } + + /// + /// Contains Safeguards version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// Safeguards version. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSafeguardsAvailableVersion(this SubscriptionResource subscriptionResource, AzureLocation location, string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetSafeguardsAvailableVersion(location, version, cancellationToken); + } + /// /// Gets a collection of MeshRevisionProfileResources in the SubscriptionResource. /// @@ -459,7 +839,7 @@ public static MeshRevisionProfileCollection GetMeshRevisionProfiles(this Subscri /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -498,7 +878,7 @@ public static async Task> GetMeshRevisionP /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -537,7 +917,7 @@ public static Response GetMeshRevisionProfile(this /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -569,7 +949,7 @@ public static async Task> GetKubernetesVer /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -601,7 +981,7 @@ public static Response GetKubernetesVersionsManaged /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -637,7 +1017,7 @@ public static AsyncPageable GetContainer /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -660,6 +1040,72 @@ public static Pageable GetContainerServi return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetContainerServiceManagedClusters(cancellationToken); } + /// + /// Only returns the latest version of each node image. For example there may be an AKSUbuntu-1804gen2containerd-2024.01.26, but only AKSUbuntu-1804gen2containerd-2024.02.02 is visible in this list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/nodeImageVersions + /// + /// + /// Operation Id + /// ContainerService_ListNodeImageVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetNodeImageVersionsContainerServicesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetNodeImageVersionsContainerServicesAsync(location, cancellationToken); + } + + /// + /// Only returns the latest version of each node image. For example there may be an AKSUbuntu-1804gen2containerd-2024.01.26, but only AKSUbuntu-1804gen2containerd-2024.02.02 is visible in this list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/nodeImageVersions + /// + /// + /// Operation Id + /// ContainerService_ListNodeImageVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetNodeImageVersionsContainerServices(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetNodeImageVersionsContainerServices(location, cancellationToken); + } + /// /// Gets a list of snapshots in the specified subscription. /// @@ -673,7 +1119,7 @@ public static Pageable GetContainerServi /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -709,7 +1155,7 @@ public static AsyncPageable GetAgentPoolSnapshotsAsyn /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -732,6 +1178,78 @@ public static Pageable GetAgentPoolSnapshots(this Sub return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetAgentPoolSnapshots(cancellationToken); } + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_List + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetManagedClusterSnapshotsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetManagedClusterSnapshotsAsync(cancellationToken); + } + + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_List + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetManagedClusterSnapshots(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetManagedClusterSnapshots(cancellationToken); + } + /// /// List supported trusted access roles. /// @@ -745,7 +1263,7 @@ public static Pageable GetAgentPoolSnapshots(this Sub /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -778,7 +1296,7 @@ public static AsyncPageable GetTrustedAccessR /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs index 480506346597..cd07495a81de 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs @@ -34,18 +34,6 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual OSOptionProfileResource GetOSOptionProfileResource(ResourceIdentifier id) - { - OSOptionProfileResource.ValidateResourceId(id); - return new OSOptionProfileResource(Client, id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -70,6 +58,30 @@ public virtual ContainerServiceManagedClusterResource GetContainerServiceManaged return new ContainerServiceManagedClusterResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GuardrailsAvailableVersionResource GetGuardrailsAvailableVersionResource(ResourceIdentifier id) + { + GuardrailsAvailableVersionResource.ValidateResourceId(id); + return new GuardrailsAvailableVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SafeguardsAvailableVersionResource GetSafeguardsAvailableVersionResource(ResourceIdentifier id) + { + SafeguardsAvailableVersionResource.ValidateResourceId(id); + return new SafeguardsAvailableVersionResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -106,6 +118,18 @@ public virtual ContainerServiceMaintenanceConfigurationResource GetContainerServ return new ContainerServiceMaintenanceConfigurationResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NamespaceResource GetNamespaceResource(ResourceIdentifier id) + { + NamespaceResource.ValidateResourceId(id); + return new NamespaceResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -130,6 +154,18 @@ public virtual AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfileResourc return new AgentPoolUpgradeProfileResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineResource GetMachineResource(ResourceIdentifier id) + { + MachineResource.ValidateResourceId(id); + return new MachineResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -154,6 +190,18 @@ public virtual AgentPoolSnapshotResource GetAgentPoolSnapshotResource(ResourceId return new AgentPoolSnapshotResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedClusterSnapshotResource GetManagedClusterSnapshotResource(ResourceIdentifier id) + { + ManagedClusterSnapshotResource.ValidateResourceId(id); + return new ManagedClusterSnapshotResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -165,5 +213,17 @@ public virtual ContainerServiceTrustedAccessRoleBindingResource GetContainerServ ContainerServiceTrustedAccessRoleBindingResource.ValidateResourceId(id); return new ContainerServiceTrustedAccessRoleBindingResource(Client, id); } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LoadBalancerResource GetLoadBalancerResource(ResourceIdentifier id) + { + LoadBalancerResource.ValidateResourceId(id); + return new LoadBalancerResource(Client, id); + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs index c0fa202bd1ae..613b0ebd7aa6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs @@ -53,7 +53,7 @@ public virtual ContainerServiceManagedClusterCollection GetContainerServiceManag /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -84,7 +84,7 @@ public virtual async Task> GetC /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -122,7 +122,7 @@ public virtual AgentPoolSnapshotCollection GetAgentPoolSnapshots() /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -153,7 +153,7 @@ public virtual async Task> GetAgentPoolSnaps /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -170,5 +170,74 @@ public virtual Response GetAgentPoolSnapshot(string r { return GetAgentPoolSnapshots().Get(resourceName, cancellationToken); } + + /// Gets a collection of ManagedClusterSnapshotResources in the ResourceGroupResource. + /// An object representing collection of ManagedClusterSnapshotResources and their operations over a ManagedClusterSnapshotResource. + public virtual ManagedClusterSnapshotCollection GetManagedClusterSnapshots() + { + return GetCachedClient(client => new ManagedClusterSnapshotCollection(client, Id)); + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedClusterSnapshotAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetManagedClusterSnapshots().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedClusterSnapshot(string resourceName, CancellationToken cancellationToken = default) + { + return GetManagedClusterSnapshots().Get(resourceName, cancellationToken); + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs index fadc63f13095..0f609c40e745 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs @@ -22,8 +22,12 @@ public partial class MockableContainerServiceSubscriptionResource : ArmResource private ManagedClustersRestOperations _managedClustersRestClient; private ClientDiagnostics _containerServiceManagedClusterManagedClustersClientDiagnostics; private ManagedClustersRestOperations _containerServiceManagedClusterManagedClustersRestClient; + private ClientDiagnostics _containerServiceClientDiagnostics; + private ContainerServiceRestOperations _containerServiceRestClient; private ClientDiagnostics _agentPoolSnapshotSnapshotsClientDiagnostics; private SnapshotsRestOperations _agentPoolSnapshotSnapshotsRestClient; + private ClientDiagnostics _managedClusterSnapshotClientDiagnostics; + private ManagedClusterSnapshotsRestOperations _managedClusterSnapshotRestClient; private ClientDiagnostics _trustedAccessRolesClientDiagnostics; private TrustedAccessRolesRestOperations _trustedAccessRolesRestClient; @@ -43,8 +47,12 @@ internal MockableContainerServiceSubscriptionResource(ArmClient client, Resource private ManagedClustersRestOperations ManagedClustersRestClient => _managedClustersRestClient ??= new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics ContainerServiceManagedClusterManagedClustersClientDiagnostics => _containerServiceManagedClusterManagedClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ContainerServiceManagedClusterResource.ResourceType.Namespace, Diagnostics); private ManagedClustersRestOperations ContainerServiceManagedClusterManagedClustersRestClient => _containerServiceManagedClusterManagedClustersRestClient ??= new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerServiceManagedClusterResource.ResourceType)); + private ClientDiagnostics ContainerServiceClientDiagnostics => _containerServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ContainerServiceRestOperations ContainerServiceRestClient => _containerServiceRestClient ??= new ContainerServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics AgentPoolSnapshotSnapshotsClientDiagnostics => _agentPoolSnapshotSnapshotsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", AgentPoolSnapshotResource.ResourceType.Namespace, Diagnostics); private SnapshotsRestOperations AgentPoolSnapshotSnapshotsRestClient => _agentPoolSnapshotSnapshotsRestClient ??= new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AgentPoolSnapshotResource.ResourceType)); + private ClientDiagnostics ManagedClusterSnapshotClientDiagnostics => _managedClusterSnapshotClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ManagedClusterSnapshotResource.ResourceType.Namespace, Diagnostics); + private ManagedClusterSnapshotsRestOperations ManagedClusterSnapshotRestClient => _managedClusterSnapshotRestClient ??= new ManagedClusterSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedClusterSnapshotResource.ResourceType)); private ClientDiagnostics TrustedAccessRolesClientDiagnostics => _trustedAccessRolesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); private TrustedAccessRolesRestOperations TrustedAccessRolesRestClient => _trustedAccessRolesRestClient ??= new TrustedAccessRolesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); @@ -54,6 +62,150 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } + /// Gets a collection of GuardrailsAvailableVersionResources in the SubscriptionResource. + /// The name of the Azure region. + /// An object representing collection of GuardrailsAvailableVersionResources and their operations over a GuardrailsAvailableVersionResource. + public virtual GuardrailsAvailableVersionCollection GetGuardrailsAvailableVersions(AzureLocation location) + { + return new GuardrailsAvailableVersionCollection(Client, Id, location); + } + + /// + /// Contains Guardrails version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// Safeguards version. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGuardrailsAvailableVersionAsync(AzureLocation location, string version, CancellationToken cancellationToken = default) + { + return await GetGuardrailsAvailableVersions(location).GetAsync(version, cancellationToken).ConfigureAwait(false); + } + + /// + /// Contains Guardrails version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// Safeguards version. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGuardrailsAvailableVersion(AzureLocation location, string version, CancellationToken cancellationToken = default) + { + return GetGuardrailsAvailableVersions(location).Get(version, cancellationToken); + } + + /// Gets a collection of SafeguardsAvailableVersionResources in the SubscriptionResource. + /// The name of the Azure region. + /// An object representing collection of SafeguardsAvailableVersionResources and their operations over a SafeguardsAvailableVersionResource. + public virtual SafeguardsAvailableVersionCollection GetSafeguardsAvailableVersions(AzureLocation location) + { + return new SafeguardsAvailableVersionCollection(Client, Id, location); + } + + /// + /// Contains Safeguards version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// Safeguards version. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSafeguardsAvailableVersionAsync(AzureLocation location, string version, CancellationToken cancellationToken = default) + { + return await GetSafeguardsAvailableVersions(location).GetAsync(version, cancellationToken).ConfigureAwait(false); + } + + /// + /// Contains Safeguards version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// Safeguards version. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSafeguardsAvailableVersion(AzureLocation location, string version, CancellationToken cancellationToken = default) + { + return GetSafeguardsAvailableVersions(location).Get(version, cancellationToken); + } + /// Gets a collection of MeshRevisionProfileResources in the SubscriptionResource. /// The name of the Azure region. /// An object representing collection of MeshRevisionProfileResources and their operations over a MeshRevisionProfileResource. @@ -75,7 +227,7 @@ public virtual MeshRevisionProfileCollection GetMeshRevisionProfiles(AzureLocati /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -107,7 +259,7 @@ public virtual async Task> GetMeshRevision /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -139,7 +291,7 @@ public virtual Response GetMeshRevisionProfile(Azur /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -174,7 +326,7 @@ public virtual async Task> GetKubernetesVe /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -209,7 +361,7 @@ public virtual Response GetKubernetesVersionsManage /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -239,7 +391,7 @@ public virtual AsyncPageable GetContaine /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -256,6 +408,60 @@ public virtual Pageable GetContainerServ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); } + /// + /// Only returns the latest version of each node image. For example there may be an AKSUbuntu-1804gen2containerd-2024.01.26, but only AKSUbuntu-1804gen2containerd-2024.02.02 is visible in this list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/nodeImageVersions + /// + /// + /// Operation Id + /// ContainerService_ListNodeImageVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNodeImageVersionsContainerServicesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceRestClient.CreateListNodeImageVersionsRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceRestClient.CreateListNodeImageVersionsNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => NodeImageVersion.DeserializeNodeImageVersion(e), ContainerServiceClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetNodeImageVersionsContainerServices", "value", "nextLink", cancellationToken); + } + + /// + /// Only returns the latest version of each node image. For example there may be an AKSUbuntu-1804gen2containerd-2024.01.26, but only AKSUbuntu-1804gen2containerd-2024.02.02 is visible in this list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/nodeImageVersions + /// + /// + /// Operation Id + /// ContainerService_ListNodeImageVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNodeImageVersionsContainerServices(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceRestClient.CreateListNodeImageVersionsRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceRestClient.CreateListNodeImageVersionsNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => NodeImageVersion.DeserializeNodeImageVersion(e), ContainerServiceClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetNodeImageVersionsContainerServices", "value", "nextLink", cancellationToken); + } + /// /// Gets a list of snapshots in the specified subscription. /// @@ -269,7 +475,7 @@ public virtual Pageable GetContainerServ /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -299,7 +505,7 @@ public virtual AsyncPageable GetAgentPoolSnapshotsAsy /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -316,6 +522,66 @@ public virtual Pageable GetAgentPoolSnapshots(Cancell return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); } + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_List + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedClusterSnapshotsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterSnapshotRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedClusterSnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), ManagedClusterSnapshotClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetManagedClusterSnapshots", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_List + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedClusterSnapshots(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterSnapshotRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedClusterSnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), ManagedClusterSnapshotClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetManagedClusterSnapshots", "value", "nextLink", cancellationToken); + } + /// /// List supported trusted access roles. /// @@ -329,7 +595,7 @@ public virtual Pageable GetAgentPoolSnapshots(Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// @@ -356,7 +622,7 @@ public virtual AsyncPageable GetTrustedAccess /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionCollection.cs new file mode 100644 index 000000000000..e7a9792b6afd --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionCollection.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetGuardrailsAvailableVersions method from an instance of . + /// + public partial class GuardrailsAvailableVersionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _guardrailsAvailableVersionManagedClustersClientDiagnostics; + private readonly ManagedClustersRestOperations _guardrailsAvailableVersionManagedClustersRestClient; + private readonly AzureLocation _location; + + /// Initializes a new instance of the class for mocking. + protected GuardrailsAvailableVersionCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + /// The name of the Azure region. + internal GuardrailsAvailableVersionCollection(ArmClient client, ResourceIdentifier id, AzureLocation location) : base(client, id) + { + _location = location; + _guardrailsAvailableVersionManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", GuardrailsAvailableVersionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(GuardrailsAvailableVersionResource.ResourceType, out string guardrailsAvailableVersionManagedClustersApiVersion); + _guardrailsAvailableVersionManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, guardrailsAvailableVersionManagedClustersApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Contains Guardrails version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _guardrailsAvailableVersionManagedClustersClientDiagnostics.CreateScope("GuardrailsAvailableVersionCollection.Get"); + scope.Start(); + try + { + var response = await _guardrailsAvailableVersionManagedClustersRestClient.GetGuardrailsVersionsAsync(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GuardrailsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Contains Guardrails version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _guardrailsAvailableVersionManagedClustersClientDiagnostics.CreateScope("GuardrailsAvailableVersionCollection.Get"); + scope.Start(); + try + { + var response = _guardrailsAvailableVersionManagedClustersRestClient.GetGuardrailsVersions(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GuardrailsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Contains list of Guardrails version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions + /// + /// + /// Operation Id + /// ManagedClusters_ListGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _guardrailsAvailableVersionManagedClustersRestClient.CreateListGuardrailsVersionsRequest(Id.SubscriptionId, new AzureLocation(_location)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _guardrailsAvailableVersionManagedClustersRestClient.CreateListGuardrailsVersionsNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GuardrailsAvailableVersionResource(Client, GuardrailsAvailableVersionData.DeserializeGuardrailsAvailableVersionData(e)), _guardrailsAvailableVersionManagedClustersClientDiagnostics, Pipeline, "GuardrailsAvailableVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Contains list of Guardrails version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions + /// + /// + /// Operation Id + /// ManagedClusters_ListGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _guardrailsAvailableVersionManagedClustersRestClient.CreateListGuardrailsVersionsRequest(Id.SubscriptionId, new AzureLocation(_location)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _guardrailsAvailableVersionManagedClustersRestClient.CreateListGuardrailsVersionsNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GuardrailsAvailableVersionResource(Client, GuardrailsAvailableVersionData.DeserializeGuardrailsAvailableVersionData(e)), _guardrailsAvailableVersionManagedClustersClientDiagnostics, Pipeline, "GuardrailsAvailableVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _guardrailsAvailableVersionManagedClustersClientDiagnostics.CreateScope("GuardrailsAvailableVersionCollection.Exists"); + scope.Start(); + try + { + var response = await _guardrailsAvailableVersionManagedClustersRestClient.GetGuardrailsVersionsAsync(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _guardrailsAvailableVersionManagedClustersClientDiagnostics.CreateScope("GuardrailsAvailableVersionCollection.Exists"); + scope.Start(); + try + { + var response = _guardrailsAvailableVersionManagedClustersRestClient.GetGuardrailsVersions(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _guardrailsAvailableVersionManagedClustersClientDiagnostics.CreateScope("GuardrailsAvailableVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _guardrailsAvailableVersionManagedClustersRestClient.GetGuardrailsVersionsAsync(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuardrailsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetGuardrailsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _guardrailsAvailableVersionManagedClustersClientDiagnostics.CreateScope("GuardrailsAvailableVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _guardrailsAvailableVersionManagedClustersRestClient.GetGuardrailsVersions(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuardrailsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionData.Serialization.cs new file mode 100644 index 000000000000..464d5f95a1ae --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionData.Serialization.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class GuardrailsAvailableVersionData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + + GuardrailsAvailableVersionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGuardrailsAvailableVersionData(document.RootElement, options); + } + + internal static GuardrailsAvailableVersionData DeserializeGuardrailsAvailableVersionData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GuardrailsAvailableVersionsProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = GuardrailsAvailableVersionsProperties.DeserializeGuardrailsAvailableVersionsProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GuardrailsAvailableVersionData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionData)} does not support writing '{options.Format}' format."); + } + } + + GuardrailsAvailableVersionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGuardrailsAvailableVersionData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionData.cs similarity index 59% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionData.cs index 5fd0ccff4ad6..0d0e942e7e0c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionData.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Azure.Core; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; @@ -15,10 +14,10 @@ namespace Azure.ResourceManager.ContainerService { /// - /// A class representing the OSOptionProfile data model. - /// The OS option profile. + /// A class representing the GuardrailsAvailableVersion data model. + /// Available Guardrails Version /// - public partial class OSOptionProfileData : ResourceData + public partial class GuardrailsAvailableVersionData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -52,36 +51,36 @@ public partial class OSOptionProfileData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// The list of OS options. - /// is null. - internal OSOptionProfileData(IEnumerable osOptionPropertyList) + /// Initializes a new instance of . + /// Whether the version is default or not and support info. + /// is null. + public GuardrailsAvailableVersionData(GuardrailsAvailableVersionsProperties properties) { - Argument.AssertNotNull(osOptionPropertyList, nameof(osOptionPropertyList)); + Argument.AssertNotNull(properties, nameof(properties)); - OSOptionPropertyList = osOptionPropertyList.ToList(); + Properties = properties; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The list of OS options. + /// Whether the version is default or not and support info. /// Keeps track of any properties unknown to the library. - internal OSOptionProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList osOptionPropertyList, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal GuardrailsAvailableVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GuardrailsAvailableVersionsProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - OSOptionPropertyList = osOptionPropertyList; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal OSOptionProfileData() + /// Initializes a new instance of for deserialization. + internal GuardrailsAvailableVersionData() { } - /// The list of OS options. - [WirePath("properties.osOptionPropertyList")] - public IReadOnlyList OSOptionPropertyList { get; } + /// Whether the version is default or not and support info. + [WirePath("properties")] + public GuardrailsAvailableVersionsProperties Properties { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionResource.Serialization.cs new file mode 100644 index 000000000000..7b29459dd565 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class GuardrailsAvailableVersionResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + GuardrailsAvailableVersionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + GuardrailsAvailableVersionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionResource.cs similarity index 53% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionResource.cs index bd4c8e6a8bb9..5d64effd54f1 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/GuardrailsAvailableVersionResource.cs @@ -16,51 +16,52 @@ namespace Azure.ResourceManager.ContainerService { /// - /// A Class representing an OSOptionProfile along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetOSOptionProfileResource method. - /// Otherwise you can get one from its parent resource using the GetOSOptionProfile method. + /// A Class representing a GuardrailsAvailableVersion along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetGuardrailsAvailableVersionResource method. + /// Otherwise you can get one from its parent resource using the GetGuardrailsAvailableVersion method. /// - public partial class OSOptionProfileResource : ArmResource + public partial class GuardrailsAvailableVersionResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The location. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location) + /// The version. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string version) { - var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"; + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _osOptionProfileManagedClustersClientDiagnostics; - private readonly ManagedClustersRestOperations _osOptionProfileManagedClustersRestClient; - private readonly OSOptionProfileData _data; + private readonly ClientDiagnostics _guardrailsAvailableVersionManagedClustersClientDiagnostics; + private readonly ManagedClustersRestOperations _guardrailsAvailableVersionManagedClustersRestClient; + private readonly GuardrailsAvailableVersionData _data; /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/locations/osOptions"; + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/locations/guardrailsVersions"; - /// Initializes a new instance of the class for mocking. - protected OSOptionProfileResource() + /// Initializes a new instance of the class for mocking. + protected GuardrailsAvailableVersionResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal OSOptionProfileResource(ArmClient client, OSOptionProfileData data) : this(client, data.Id) + internal GuardrailsAvailableVersionResource(ArmClient client, GuardrailsAvailableVersionData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal OSOptionProfileResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal GuardrailsAvailableVersionResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _osOptionProfileManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string osOptionProfileManagedClustersApiVersion); - _osOptionProfileManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, osOptionProfileManagedClustersApiVersion); + _guardrailsAvailableVersionManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string guardrailsAvailableVersionManagedClustersApiVersion); + _guardrailsAvailableVersionManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, guardrailsAvailableVersionManagedClustersApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -71,7 +72,7 @@ internal OSOptionProfileResource(ArmClient client, ResourceIdentifier id) : base /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual OSOptionProfileData Data + public virtual GuardrailsAvailableVersionData Data { get { @@ -88,38 +89,37 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Gets supported OS options in the specified subscription. + /// Contains Guardrails version along with its support info and whether it is a default version. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} /// /// /// Operation Id - /// ManagedClusters_GetOSOptions + /// ManagedClusters_GetGuardrailsVersions /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource - /// + /// /// /// /// - /// The resource type for which the OS options needs to be returned. /// The cancellation token to use. - public virtual async Task> GetAsync(ResourceType? resourceType = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _osOptionProfileManagedClustersClientDiagnostics.CreateScope("OSOptionProfileResource.Get"); + using var scope = _guardrailsAvailableVersionManagedClustersClientDiagnostics.CreateScope("GuardrailsAvailableVersionResource.Get"); scope.Start(); try { - var response = await _osOptionProfileManagedClustersRestClient.GetOSOptionsAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), resourceType, cancellationToken).ConfigureAwait(false); + var response = await _guardrailsAvailableVersionManagedClustersRestClient.GetGuardrailsVersionsAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new OSOptionProfileResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new GuardrailsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -129,38 +129,37 @@ public virtual async Task> GetAsync(ResourceTy } /// - /// Gets supported OS options in the specified subscription. + /// Contains Guardrails version along with its support info and whether it is a default version. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version} /// /// /// Operation Id - /// ManagedClusters_GetOSOptions + /// ManagedClusters_GetGuardrailsVersions /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource - /// + /// /// /// /// - /// The resource type for which the OS options needs to be returned. /// The cancellation token to use. - public virtual Response Get(ResourceType? resourceType = null, CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _osOptionProfileManagedClustersClientDiagnostics.CreateScope("OSOptionProfileResource.Get"); + using var scope = _guardrailsAvailableVersionManagedClustersClientDiagnostics.CreateScope("GuardrailsAvailableVersionResource.Get"); scope.Start(); try { - var response = _osOptionProfileManagedClustersRestClient.GetOSOptions(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), resourceType, cancellationToken); + var response = _guardrailsAvailableVersionManagedClustersRestClient.GetGuardrailsVersions(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new OSOptionProfileResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new GuardrailsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerCollection.cs new file mode 100644 index 000000000000..08cd3480a4ea --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerCollection.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetLoadBalancers method from an instance of . + /// + public partial class LoadBalancerCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _loadBalancerClientDiagnostics; + private readonly LoadBalancersRestOperations _loadBalancerRestClient; + + /// Initializes a new instance of the class for mocking. + protected LoadBalancerCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal LoadBalancerCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _loadBalancerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", LoadBalancerResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(LoadBalancerResource.ResourceType, out string loadBalancerApiVersion); + _loadBalancerRestClient = new LoadBalancersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, loadBalancerApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ContainerServiceManagedClusterResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ContainerServiceManagedClusterResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a load balancer in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the load balancer. + /// The load balancer to create or update. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string loadBalancerName, LoadBalancerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _loadBalancerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancerName, data, cancellationToken).ConfigureAwait(false); + var uri = _loadBalancerRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancerName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ContainerServiceArmOperation(Response.FromValue(new LoadBalancerResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a load balancer in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the load balancer. + /// The load balancer to create or update. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string loadBalancerName, LoadBalancerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _loadBalancerRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancerName, data, cancellationToken); + var uri = _loadBalancerRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancerName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ContainerServiceArmOperation(Response.FromValue(new LoadBalancerResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified load balancer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the load balancer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string loadBalancerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerCollection.Get"); + scope.Start(); + try + { + var response = await _loadBalancerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancerName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LoadBalancerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified load balancer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the load balancer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string loadBalancerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerCollection.Get"); + scope.Start(); + try + { + var response = _loadBalancerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancerName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LoadBalancerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of load balancers in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers + /// + /// + /// Operation Id + /// LoadBalancers_ListByManagedCluster + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _loadBalancerRestClient.CreateListByManagedClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _loadBalancerRestClient.CreateListByManagedClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LoadBalancerResource(Client, LoadBalancerData.DeserializeLoadBalancerData(e)), _loadBalancerClientDiagnostics, Pipeline, "LoadBalancerCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of load balancers in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers + /// + /// + /// Operation Id + /// LoadBalancers_ListByManagedCluster + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _loadBalancerRestClient.CreateListByManagedClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _loadBalancerRestClient.CreateListByManagedClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LoadBalancerResource(Client, LoadBalancerData.DeserializeLoadBalancerData(e)), _loadBalancerClientDiagnostics, Pipeline, "LoadBalancerCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the load balancer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string loadBalancerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerCollection.Exists"); + scope.Start(); + try + { + var response = await _loadBalancerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancerName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the load balancer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string loadBalancerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerCollection.Exists"); + scope.Start(); + try + { + var response = _loadBalancerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancerName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the load balancer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string loadBalancerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _loadBalancerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LoadBalancerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the load balancer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string loadBalancerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _loadBalancerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LoadBalancerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerData.Serialization.cs new file mode 100644 index 000000000000..239edebf572e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerData.Serialization.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class LoadBalancerData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadBalancerData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PrimaryAgentPoolName)) + { + writer.WritePropertyName("primaryAgentPoolName"u8); + writer.WriteStringValue(PrimaryAgentPoolName); + } + if (Optional.IsDefined(AllowServicePlacement)) + { + writer.WritePropertyName("allowServicePlacement"u8); + writer.WriteBooleanValue(AllowServicePlacement.Value); + } + if (Optional.IsDefined(ServiceLabelSelector)) + { + writer.WritePropertyName("serviceLabelSelector"u8); + writer.WriteObjectValue(ServiceLabelSelector, options); + } + if (Optional.IsDefined(ServiceNamespaceSelector)) + { + writer.WritePropertyName("serviceNamespaceSelector"u8); + writer.WriteObjectValue(ServiceNamespaceSelector, options); + } + if (Optional.IsDefined(NodeSelector)) + { + writer.WritePropertyName("nodeSelector"u8); + writer.WriteObjectValue(NodeSelector, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + writer.WriteEndObject(); + } + + LoadBalancerData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadBalancerData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLoadBalancerData(document.RootElement, options); + } + + internal static LoadBalancerData DeserializeLoadBalancerData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + string primaryAgentPoolName = default; + bool? allowServicePlacement = default; + LabelSelector serviceLabelSelector = default; + LabelSelector serviceNamespaceSelector = default; + LabelSelector nodeSelector = default; + string provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("primaryAgentPoolName"u8)) + { + primaryAgentPoolName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("allowServicePlacement"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowServicePlacement = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("serviceLabelSelector"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceLabelSelector = LabelSelector.DeserializeLabelSelector(property0.Value, options); + continue; + } + if (property0.NameEquals("serviceNamespaceSelector"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceNamespaceSelector = LabelSelector.DeserializeLabelSelector(property0.Value, options); + continue; + } + if (property0.NameEquals("nodeSelector"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeSelector = LabelSelector.DeserializeLabelSelector(property0.Value, options); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LoadBalancerData( + id, + name, + type, + systemData, + primaryAgentPoolName, + allowServicePlacement, + serviceLabelSelector, + serviceNamespaceSelector, + nodeSelector, + provisioningState, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrimaryAgentPoolName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" primaryAgentPoolName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PrimaryAgentPoolName)) + { + builder.Append(" primaryAgentPoolName: "); + if (PrimaryAgentPoolName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PrimaryAgentPoolName}'''"); + } + else + { + builder.AppendLine($"'{PrimaryAgentPoolName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowServicePlacement), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" allowServicePlacement: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AllowServicePlacement)) + { + builder.Append(" allowServicePlacement: "); + var boolValue = AllowServicePlacement.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServiceLabelSelector), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" serviceLabelSelector: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ServiceLabelSelector)) + { + builder.Append(" serviceLabelSelector: "); + BicepSerializationHelpers.AppendChildObject(builder, ServiceLabelSelector, options, 4, false, " serviceLabelSelector: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServiceNamespaceSelector), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" serviceNamespaceSelector: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ServiceNamespaceSelector)) + { + builder.Append(" serviceNamespaceSelector: "); + BicepSerializationHelpers.AppendChildObject(builder, ServiceNamespaceSelector, options, 4, false, " serviceNamespaceSelector: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeSelector), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeSelector: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NodeSelector)) + { + builder.Append(" nodeSelector: "); + BicepSerializationHelpers.AppendChildObject(builder, NodeSelector, options, 4, false, " nodeSelector: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + if (ProvisioningState.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ProvisioningState}'''"); + } + else + { + builder.AppendLine($"'{ProvisioningState}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(LoadBalancerData)} does not support writing '{options.Format}' format."); + } + } + + LoadBalancerData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLoadBalancerData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LoadBalancerData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerData.cs new file mode 100644 index 000000000000..808ac934d2c9 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerData.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing the LoadBalancer data model. + /// The configurations regarding multiple standard load balancers. If not supplied, single load balancer mode will be used. Multiple standard load balancers mode will be used if at lease one configuration is supplied. There has to be a configuration named `kubernetes`. The name field will be the name of the corresponding public load balancer. There will be an internal load balancer created if needed, and the name will be `<name>-internal`. The internal lb shares the same configurations as the external one. The internal lbs are not needed to be included in LoadBalancer list. + /// + public partial class LoadBalancerData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LoadBalancerData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Required field. A string value that must specify the ID of an existing agent pool. All nodes in the given pool will always be added to this load balancer. This agent pool must have at least one node and minCount>=1 for autoscaling operations. An agent pool can only be the primary pool for a single load balancer. + /// Whether to automatically place services on the load balancer. If not supplied, the default value is true. If set to false manually, both of the external and the internal load balancer will not be selected for services unless they explicitly target it. + /// Only services that must match this selector can be placed on this load balancer. + /// Services created in namespaces that match the selector can be placed on this load balancer. + /// Nodes that match this selector will be possible members of this load balancer. + /// The current provisioning state. + /// Keeps track of any properties unknown to the library. + internal LoadBalancerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string primaryAgentPoolName, bool? allowServicePlacement, LabelSelector serviceLabelSelector, LabelSelector serviceNamespaceSelector, LabelSelector nodeSelector, string provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + PrimaryAgentPoolName = primaryAgentPoolName; + AllowServicePlacement = allowServicePlacement; + ServiceLabelSelector = serviceLabelSelector; + ServiceNamespaceSelector = serviceNamespaceSelector; + NodeSelector = nodeSelector; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Required field. A string value that must specify the ID of an existing agent pool. All nodes in the given pool will always be added to this load balancer. This agent pool must have at least one node and minCount>=1 for autoscaling operations. An agent pool can only be the primary pool for a single load balancer. + [WirePath("properties.primaryAgentPoolName")] + public string PrimaryAgentPoolName { get; set; } + /// Whether to automatically place services on the load balancer. If not supplied, the default value is true. If set to false manually, both of the external and the internal load balancer will not be selected for services unless they explicitly target it. + [WirePath("properties.allowServicePlacement")] + public bool? AllowServicePlacement { get; set; } + /// Only services that must match this selector can be placed on this load balancer. + [WirePath("properties.serviceLabelSelector")] + public LabelSelector ServiceLabelSelector { get; set; } + /// Services created in namespaces that match the selector can be placed on this load balancer. + [WirePath("properties.serviceNamespaceSelector")] + public LabelSelector ServiceNamespaceSelector { get; set; } + /// Nodes that match this selector will be possible members of this load balancer. + [WirePath("properties.nodeSelector")] + public LabelSelector NodeSelector { get; set; } + /// The current provisioning state. + [WirePath("properties.provisioningState")] + public string ProvisioningState { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerResource.Serialization.cs new file mode 100644 index 000000000000..6692212d0394 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class LoadBalancerResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + LoadBalancerData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + LoadBalancerData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerResource.cs new file mode 100644 index 000000000000..18469349b513 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LoadBalancerResource.cs @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A Class representing a LoadBalancer along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetLoadBalancerResource method. + /// Otherwise you can get one from its parent resource using the GetLoadBalancer method. + /// + public partial class LoadBalancerResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The loadBalancerName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _loadBalancerClientDiagnostics; + private readonly LoadBalancersRestOperations _loadBalancerRestClient; + private readonly LoadBalancerData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/loadBalancers"; + + /// Initializes a new instance of the class for mocking. + protected LoadBalancerResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal LoadBalancerResource(ArmClient client, LoadBalancerData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal LoadBalancerResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _loadBalancerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string loadBalancerApiVersion); + _loadBalancerRestClient = new LoadBalancersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, loadBalancerApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual LoadBalancerData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the specified load balancer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerResource.Get"); + scope.Start(); + try + { + var response = await _loadBalancerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LoadBalancerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified load balancer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerResource.Get"); + scope.Start(); + try + { + var response = _loadBalancerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LoadBalancerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a load balancer in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Delete + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerResource.Delete"); + scope.Start(); + try + { + var response = await _loadBalancerRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_loadBalancerClientDiagnostics, Pipeline, _loadBalancerRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a load balancer in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Delete + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerResource.Delete"); + scope.Start(); + try + { + var response = _loadBalancerRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ContainerServiceArmOperation(_loadBalancerClientDiagnostics, Pipeline, _loadBalancerRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a load balancer in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The load balancer to create or update. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, LoadBalancerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerResource.Update"); + scope.Start(); + try + { + var response = await _loadBalancerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _loadBalancerRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ContainerServiceArmOperation(Response.FromValue(new LoadBalancerResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a load balancer in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The load balancer to create or update. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, LoadBalancerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerResource.Update"); + scope.Start(); + try + { + var response = _loadBalancerRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _loadBalancerRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ContainerServiceArmOperation(Response.FromValue(new LoadBalancerResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/NamespaceOperationSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/NamespaceOperationSource.cs new file mode 100644 index 000000000000..af6a8cb4904e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/NamespaceOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService +{ + internal class NamespaceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NamespaceOperationSource(ArmClient client) + { + _client = client; + } + + NamespaceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new NamespaceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new NamespaceResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineCollection.cs new file mode 100644 index 000000000000..98197aa81ac7 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineCollection.cs @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetMachines method from an instance of . + /// + public partial class MachineCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _machineClientDiagnostics; + private readonly MachinesRestOperations _machineRestClient; + + /// Initializes a new instance of the class for mocking. + protected MachineCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal MachineCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _machineClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", MachineResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MachineResource.ResourceType, out string machineApiVersion); + _machineRestClient = new MachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, machineApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ContainerServiceAgentPoolResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ContainerServiceAgentPoolResource.ResourceType), nameof(id)); + } + + /// + /// Get a specific machine in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.Get"); + scope.Start(); + try + { + var response = await _machineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a specific machine in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.Get"); + scope.Start(); + try + { + var response = _machineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of machines in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines + /// + /// + /// Operation Id + /// Machines_List + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _machineRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _machineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MachineResource(Client, MachineData.DeserializeMachineData(e)), _machineClientDiagnostics, Pipeline, "MachineCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of machines in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines + /// + /// + /// Operation Id + /// Machines_List + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _machineRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _machineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MachineResource(Client, MachineData.DeserializeMachineData(e)), _machineClientDiagnostics, Pipeline, "MachineCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.Exists"); + scope.Start(); + try + { + var response = await _machineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.Exists"); + scope.Start(); + try + { + var response = _machineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// host name of the machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _machineClientDiagnostics.CreateScope("MachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, machineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.Serialization.cs similarity index 64% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.Serialization.cs index 216a133986e5..502cadc2171a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -17,11 +16,11 @@ namespace Azure.ResourceManager.ContainerService { - public partial class OSOptionProfileData : IUtf8JsonSerializable, IJsonModel + public partial class MachineData : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -32,38 +31,33 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(OSOptionProfileData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MachineData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - writer.WritePropertyName("osOptionPropertyList"u8); - writer.WriteStartArray(); - foreach (var item in OSOptionPropertyList) + if (options.Format != "W" && Optional.IsDefined(Properties)) { - writer.WriteObjectValue(item, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndArray(); - writer.WriteEndObject(); } - OSOptionProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(OSOptionProfileData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MachineData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOSOptionProfileData(document.RootElement, options); + return DeserializeMachineData(document.RootElement, options); } - internal static OSOptionProfileData DeserializeOSOptionProfileData(JsonElement element, ModelReaderWriterOptions options = null) + internal static MachineData DeserializeMachineData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -71,15 +65,24 @@ internal static OSOptionProfileData DeserializeOSOptionProfileData(JsonElement e { return null; } + MachineProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - IReadOnlyList osOptionPropertyList = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = MachineProperties.DeserializeMachineProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -104,40 +107,18 @@ internal static OSOptionProfileData DeserializeOSOptionProfileData(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("osOptionPropertyList"u8)) - { - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ContainerServiceOSOptionProperty.DeserializeContainerServiceOSOptionProperty(item, options)); - } - osOptionPropertyList = array; - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new OSOptionProfileData( + return new MachineData( id, name, type, systemData, - osOptionPropertyList, + properties, serializedAdditionalRawData); } @@ -175,69 +156,58 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" id: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Id)) + if (Optional.IsDefined(Properties)) { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" systemData: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SystemData)) + if (Optional.IsDefined(Id)) { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSOptionPropertyList), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" osOptionPropertyList: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(OSOptionPropertyList)) + if (Optional.IsDefined(SystemData)) { - if (OSOptionPropertyList.Any()) - { - builder.Append(" osOptionPropertyList: "); - builder.AppendLine("["); - foreach (var item in OSOptionPropertyList) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " osOptionPropertyList: "); - } - builder.AppendLine(" ]"); - } + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { @@ -246,26 +216,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(OSOptionProfileData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MachineData)} does not support writing '{options.Format}' format."); } } - OSOptionProfileData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MachineData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOSOptionProfileData(document.RootElement, options); + return DeserializeMachineData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(OSOptionProfileData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MachineData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.cs new file mode 100644 index 000000000000..e9e90ff8d6d6 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineData.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing the Machine data model. + /// A machine. Contains details about the underlying virtual machine. A machine may be visible here but not in kubectl get nodes; if so it may be because the machine has not been registered with the Kubernetes API Server yet. + /// + public partial class MachineData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public MachineData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The properties of the machine. + /// Keeps track of any properties unknown to the library. + internal MachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MachineProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The properties of the machine. + [WirePath("properties")] + public MachineProperties Properties { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.Serialization.cs new file mode 100644 index 000000000000..53a1eacdb245 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class MachineResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + MachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + MachineData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.cs new file mode 100644 index 000000000000..352c94bdb36a --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MachineResource.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A Class representing a Machine along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetMachineResource method. + /// Otherwise you can get one from its parent resource using the GetMachine method. + /// + public partial class MachineResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The agentPoolName. + /// The machineName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string machineName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _machineClientDiagnostics; + private readonly MachinesRestOperations _machineRestClient; + private readonly MachineData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/agentPools/machines"; + + /// Initializes a new instance of the class for mocking. + protected MachineResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal MachineResource(ArmClient client, MachineData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MachineResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _machineClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string machineApiVersion); + _machineRestClient = new MachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, machineApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual MachineData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a specific machine in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _machineClientDiagnostics.CreateScope("MachineResource.Get"); + scope.Start(); + try + { + var response = await _machineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a specific machine in the specified agent pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _machineClientDiagnostics.CreateScope("MachineResource.Get"); + scope.Start(); + try + { + var response = _machineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs new file mode 100644 index 000000000000..fea584ad1a85 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs @@ -0,0 +1,498 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetManagedClusterSnapshots method from an instance of . + /// + public partial class ManagedClusterSnapshotCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _managedClusterSnapshotClientDiagnostics; + private readonly ManagedClusterSnapshotsRestOperations _managedClusterSnapshotRestClient; + + /// Initializes a new instance of the class for mocking. + protected ManagedClusterSnapshotCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ManagedClusterSnapshotCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedClusterSnapshotClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ManagedClusterSnapshotResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ManagedClusterSnapshotResource.ResourceType, out string managedClusterSnapshotApiVersion); + _managedClusterSnapshotRestClient = new ManagedClusterSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedClusterSnapshotApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the managed cluster resource. + /// The managed cluster snapshot to create or update. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string resourceName, ManagedClusterSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _managedClusterSnapshotRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken).ConfigureAwait(false); + var uri = _managedClusterSnapshotRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ContainerServiceArmOperation(Response.FromValue(new ManagedClusterSnapshotResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the managed cluster resource. + /// The managed cluster snapshot to create or update. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string resourceName, ManagedClusterSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _managedClusterSnapshotRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken); + var uri = _managedClusterSnapshotRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ContainerServiceArmOperation(Response.FromValue(new ManagedClusterSnapshotResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotCollection.Get"); + scope.Start(); + try + { + var response = await _managedClusterSnapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotCollection.Get"); + scope.Start(); + try + { + var response = _managedClusterSnapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists managed cluster snapshots in the specified subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedClusterSnapshotRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedClusterSnapshotRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), _managedClusterSnapshotClientDiagnostics, Pipeline, "ManagedClusterSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists managed cluster snapshots in the specified subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedClusterSnapshotRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedClusterSnapshotRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), _managedClusterSnapshotClientDiagnostics, Pipeline, "ManagedClusterSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotCollection.Exists"); + scope.Start(); + try + { + var response = await _managedClusterSnapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotCollection.Exists"); + scope.Start(); + try + { + var response = _managedClusterSnapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedClusterSnapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedClusterSnapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotData.Serialization.cs new file mode 100644 index 000000000000..ea6a7e5f6937 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotData.Serialization.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class ManagedClusterSnapshotData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSnapshotData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(CreationData)) + { + writer.WritePropertyName("creationData"u8); + writer.WriteObjectValue(CreationData, options); + } + if (Optional.IsDefined(SnapshotType)) + { + writer.WritePropertyName("snapshotType"u8); + writer.WriteStringValue(SnapshotType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ManagedClusterPropertiesReadOnly)) + { + writer.WritePropertyName("managedClusterPropertiesReadOnly"u8); + writer.WriteObjectValue(ManagedClusterPropertiesReadOnly, options); + } + writer.WriteEndObject(); + } + + ManagedClusterSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSnapshotData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSnapshotData(document.RootElement, options); + } + + internal static ManagedClusterSnapshotData DeserializeManagedClusterSnapshotData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + ContainerServiceCreationData creationData = default; + SnapshotType? snapshotType = default; + ManagedClusterPropertiesForSnapshot managedClusterPropertiesReadOnly = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("creationData"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationData = ContainerServiceCreationData.DeserializeContainerServiceCreationData(property0.Value, options); + continue; + } + if (property0.NameEquals("snapshotType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotType = new SnapshotType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("managedClusterPropertiesReadOnly"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedClusterPropertiesReadOnly = ManagedClusterPropertiesForSnapshot.DeserializeManagedClusterPropertiesForSnapshot(property0.Value, options); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterSnapshotData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + creationData, + snapshotType, + managedClusterPropertiesReadOnly, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("CreationDataSourceResourceId", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" creationData: "); + builder.AppendLine("{"); + builder.AppendLine(" creationData: {"); + builder.Append(" sourceResourceId: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(CreationData)) + { + builder.Append(" creationData: "); + BicepSerializationHelpers.AppendChildObject(builder, CreationData, options, 4, false, " creationData: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SnapshotType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" snapshotType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SnapshotType)) + { + builder.Append(" snapshotType: "); + builder.AppendLine($"'{SnapshotType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedClusterPropertiesReadOnly), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" managedClusterPropertiesReadOnly: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ManagedClusterPropertiesReadOnly)) + { + builder.Append(" managedClusterPropertiesReadOnly: "); + BicepSerializationHelpers.AppendChildObject(builder, ManagedClusterPropertiesReadOnly, options, 4, false, " managedClusterPropertiesReadOnly: "); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterSnapshotData)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterSnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterSnapshotData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterSnapshotData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotData.cs new file mode 100644 index 000000000000..5686739cbe6f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotData.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing the ManagedClusterSnapshot data model. + /// A managed cluster snapshot resource. + /// + public partial class ManagedClusterSnapshotData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public ManagedClusterSnapshotData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// CreationData to be used to specify the source resource ID to create this snapshot. + /// The type of a snapshot. The default is NodePool. + /// What the properties will be showed when getting managed cluster snapshot. Those properties are read-only. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerServiceCreationData creationData, SnapshotType? snapshotType, ManagedClusterPropertiesForSnapshot managedClusterPropertiesReadOnly, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + CreationData = creationData; + SnapshotType = snapshotType; + ManagedClusterPropertiesReadOnly = managedClusterPropertiesReadOnly; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterSnapshotData() + { + } + + /// CreationData to be used to specify the source resource ID to create this snapshot. + internal ContainerServiceCreationData CreationData { get; set; } + /// This is the ARM ID of the source object to be used to create the target object. + [WirePath("properties.creationData.sourceResourceId")] + public ResourceIdentifier CreationDataSourceResourceId + { + get => CreationData is null ? default : CreationData.SourceResourceId; + set + { + if (CreationData is null) + CreationData = new ContainerServiceCreationData(); + CreationData.SourceResourceId = value; + } + } + + /// The type of a snapshot. The default is NodePool. + [WirePath("properties.snapshotType")] + public SnapshotType? SnapshotType { get; set; } + /// What the properties will be showed when getting managed cluster snapshot. Those properties are read-only. + [WirePath("properties.managedClusterPropertiesReadOnly")] + public ManagedClusterPropertiesForSnapshot ManagedClusterPropertiesReadOnly { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotResource.Serialization.cs new file mode 100644 index 000000000000..6dd6c1238cc0 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class ManagedClusterSnapshotResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ManagedClusterSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + ManagedClusterSnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotResource.cs new file mode 100644 index 000000000000..2a6c7e1a9409 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotResource.cs @@ -0,0 +1,703 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A Class representing a ManagedClusterSnapshot along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetManagedClusterSnapshotResource method. + /// Otherwise you can get one from its parent resource using the GetManagedClusterSnapshot method. + /// + public partial class ManagedClusterSnapshotResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _managedClusterSnapshotClientDiagnostics; + private readonly ManagedClusterSnapshotsRestOperations _managedClusterSnapshotRestClient; + private readonly ManagedClusterSnapshotData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedclustersnapshots"; + + /// Initializes a new instance of the class for mocking. + protected ManagedClusterSnapshotResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ManagedClusterSnapshotResource(ArmClient client, ManagedClusterSnapshotData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ManagedClusterSnapshotResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedClusterSnapshotClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string managedClusterSnapshotApiVersion); + _managedClusterSnapshotRestClient = new ManagedClusterSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedClusterSnapshotApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ManagedClusterSnapshotData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.Get"); + scope.Start(); + try + { + var response = await _managedClusterSnapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.Get"); + scope.Start(); + try + { + var response = _managedClusterSnapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Delete + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.Delete"); + scope.Start(); + try + { + var response = await _managedClusterSnapshotRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _managedClusterSnapshotRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ContainerServiceArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Delete + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.Delete"); + scope.Start(); + try + { + var response = _managedClusterSnapshotRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var uri = _managedClusterSnapshotRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ContainerServiceArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates tags on a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_UpdateTags + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Parameters supplied to the Update managed cluster snapshot Tags operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.Update"); + scope.Start(); + try + { + var response = await _managedClusterSnapshotRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates tags on a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_UpdateTags + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Parameters supplied to the Update managed cluster snapshot Tags operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.Update"); + scope.Start(); + try + { + var response = _managedClusterSnapshotRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, cancellationToken); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _managedClusterSnapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ContainerServiceTagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _managedClusterSnapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ContainerServiceTagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _managedClusterSnapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ContainerServiceTagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _managedClusterSnapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ContainerServiceTagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _managedClusterSnapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ContainerServiceTagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _managedClusterSnapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ContainerServiceTagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs index ae15f4b29f21..5234edfe7100 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs @@ -100,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -140,7 +140,7 @@ public virtual async Task> GetAsy /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs index 73f52e619891..95ec41ae963d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs @@ -68,7 +68,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> GetAsync(string /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -158,7 +158,7 @@ public virtual Response Get(string mode, Cancellati /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -188,7 +188,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -218,7 +218,7 @@ public virtual Pageable GetAll(CancellationToken ca /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -261,7 +261,7 @@ public virtual async Task> ExistsAsync(string mode, CancellationT /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -304,7 +304,7 @@ public virtual Response Exists(string mode, CancellationToken cancellation /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -349,7 +349,7 @@ public virtual async Task> GetIfEx /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs index 349a3898fb10..5c1f523c3bf6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync(Cancel /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs index c9c2c819a366..03ab905f04db 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -109,7 +109,7 @@ public virtual async Task> GetAsync(string /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get(string mode, Cancellatio /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -184,7 +184,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -214,7 +214,7 @@ public virtual Pageable GetAll(CancellationToken can /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual async Task> ExistsAsync(string mode, CancellationT /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -300,7 +300,7 @@ public virtual Response Exists(string mode, CancellationToken cancellation /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -345,7 +345,7 @@ public virtual async Task> GetIfExi /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs index 84cce4083213..3cbd2c837f9a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync(Cancell /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-02-preview /// /// /// Resource diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AddonAutoscaling.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AddonAutoscaling.cs new file mode 100644 index 000000000000..c9920328ed90 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AddonAutoscaling.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Whether VPA add-on is enabled and configured to scale AKS-managed add-ons. + public readonly partial struct AddonAutoscaling : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AddonAutoscaling(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Feature to autoscale AKS-managed add-ons is enabled. The default VPA update mode is Initial mode. + public static AddonAutoscaling Enabled { get; } = new AddonAutoscaling(EnabledValue); + /// Feature to autoscale AKS-managed add-ons is disabled. + public static AddonAutoscaling Disabled { get; } = new AddonAutoscaling(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(AddonAutoscaling left, AddonAutoscaling right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AddonAutoscaling left, AddonAutoscaling right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AddonAutoscaling(string value) => new AddonAutoscaling(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AddonAutoscaling other && Equals(other); + /// + public bool Equals(AddonAutoscaling other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdoptionPolicy.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdoptionPolicy.cs new file mode 100644 index 000000000000..2f11e00e84fd --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdoptionPolicy.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Action if Kubernetes namespace with same name already exists. + public readonly partial struct AdoptionPolicy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AdoptionPolicy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NeverValue = "Never"; + private const string IfIdenticalValue = "IfIdentical"; + private const string AlwaysValue = "Always"; + + /// If the namespace already exists in Kubernetes, attempts to create that same namespace in ARM will fail. + public static AdoptionPolicy Never { get; } = new AdoptionPolicy(NeverValue); + /// Take over the existing namespace to be managed by ARM, if there is no difference. + public static AdoptionPolicy IfIdentical { get; } = new AdoptionPolicy(IfIdenticalValue); + /// Always take over the existing namespace to be managed by ARM, some fields might be overwritten. + public static AdoptionPolicy Always { get; } = new AdoptionPolicy(AlwaysValue); + /// Determines if two values are the same. + public static bool operator ==(AdoptionPolicy left, AdoptionPolicy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AdoptionPolicy left, AdoptionPolicy right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AdoptionPolicy(string value) => new AdoptionPolicy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AdoptionPolicy other && Equals(other); + /// + public bool Equals(AdoptionPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkPolicy.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkPolicy.cs new file mode 100644 index 000000000000..6a3441ff683d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkPolicy.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// This allows users to configure Layer 7 network policies (FQDN, HTTP, Kafka). Policies themselves must be configured via the Cilium Network Policy resources, see https://docs.cilium.io/en/latest/security/policy/index.html. This can be enabled only on cilium-based clusters. If not specified, the default value is FQDN if security.enabled is set to true. + public readonly partial struct AdvancedNetworkPolicy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AdvancedNetworkPolicy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string L7Value = "L7"; + private const string FqdnValue = "FQDN"; + private const string NoneValue = "None"; + + /// Enable Layer7 network policies (FQDN, HTTP/S, Kafka). This option is a superset of the FQDN option. + public static AdvancedNetworkPolicy L7 { get; } = new AdvancedNetworkPolicy(L7Value); + /// Enable FQDN based network policies. + public static AdvancedNetworkPolicy Fqdn { get; } = new AdvancedNetworkPolicy(FqdnValue); + /// Disable Layer 7 network policies (FQDN, HTTP/S, Kafka). + public static AdvancedNetworkPolicy None { get; } = new AdvancedNetworkPolicy(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(AdvancedNetworkPolicy left, AdvancedNetworkPolicy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AdvancedNetworkPolicy left, AdvancedNetworkPolicy right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AdvancedNetworkPolicy(string value) => new AdvancedNetworkPolicy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AdvancedNetworkPolicy other && Equals(other); + /// + public bool Equals(AdvancedNetworkPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.Serialization.cs new file mode 100644 index 000000000000..2617ab0ce189 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.Serialization.cs @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class AdvancedNetworking : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworking)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(Observability)) + { + writer.WritePropertyName("observability"u8); + writer.WriteObjectValue(Observability, options); + } + if (Optional.IsDefined(Security)) + { + writer.WritePropertyName("security"u8); + writer.WriteObjectValue(Security, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AdvancedNetworking IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworking)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAdvancedNetworking(document.RootElement, options); + } + + internal static AdvancedNetworking DeserializeAdvancedNetworking(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + AdvancedNetworkingObservability observability = default; + AdvancedNetworkingSecurity security = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("observability"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + observability = AdvancedNetworkingObservability.DeserializeAdvancedNetworkingObservability(property.Value, options); + continue; + } + if (property.NameEquals("security"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + security = AdvancedNetworkingSecurity.DeserializeAdvancedNetworkingSecurity(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AdvancedNetworking(enabled, observability, security, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("ObservabilityEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" observability: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Observability)) + { + builder.Append(" observability: "); + BicepSerializationHelpers.AppendChildObject(builder, Observability, options, 2, false, " observability: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Security), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" security: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Security)) + { + builder.Append(" security: "); + BicepSerializationHelpers.AppendChildObject(builder, Security, options, 2, false, " security: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AdvancedNetworking)} does not support writing '{options.Format}' format."); + } + } + + AdvancedNetworking IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAdvancedNetworking(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AdvancedNetworking)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.cs new file mode 100644 index 000000000000..eb484662bb2a --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworking.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Advanced Networking profile for enabling observability and security feature suite on a cluster. For more information see aka.ms/aksadvancednetworking. + public partial class AdvancedNetworking + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AdvancedNetworking() + { + } + + /// Initializes a new instance of . + /// Indicates the enablement of Advanced Networking functionalities of observability and security on AKS clusters. When this is set to true, all observability and security features will be set to enabled unless explicitly disabled. If not specified, the default is false. + /// Observability profile to enable advanced network metrics and flow logs with historical contexts. + /// Security profile to enable security features on cilium-based cluster. + /// Keeps track of any properties unknown to the library. + internal AdvancedNetworking(bool? enabled, AdvancedNetworkingObservability observability, AdvancedNetworkingSecurity security, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + Observability = observability; + Security = security; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates the enablement of Advanced Networking functionalities of observability and security on AKS clusters. When this is set to true, all observability and security features will be set to enabled unless explicitly disabled. If not specified, the default is false. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Observability profile to enable advanced network metrics and flow logs with historical contexts. + internal AdvancedNetworkingObservability Observability { get; set; } + /// Indicates the enablement of Advanced Networking observability functionalities on clusters. + [WirePath("observability.enabled")] + public bool? ObservabilityEnabled + { + get => Observability is null ? default : Observability.Enabled; + set + { + if (Observability is null) + Observability = new AdvancedNetworkingObservability(); + Observability.Enabled = value; + } + } + + /// Security profile to enable security features on cilium-based cluster. + [WirePath("security")] + public AdvancedNetworkingSecurity Security { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.Serialization.cs new file mode 100644 index 000000000000..fc7c006cbd3f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class AdvancedNetworkingObservability : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworkingObservability)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AdvancedNetworkingObservability IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworkingObservability)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAdvancedNetworkingObservability(document.RootElement, options); + } + + internal static AdvancedNetworkingObservability DeserializeAdvancedNetworkingObservability(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AdvancedNetworkingObservability(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AdvancedNetworkingObservability)} does not support writing '{options.Format}' format."); + } + } + + AdvancedNetworkingObservability IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAdvancedNetworkingObservability(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AdvancedNetworkingObservability)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.cs new file mode 100644 index 000000000000..0a21cd603df1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingObservability.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Observability profile to enable advanced network metrics and flow logs with historical contexts. + internal partial class AdvancedNetworkingObservability + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AdvancedNetworkingObservability() + { + } + + /// Initializes a new instance of . + /// Indicates the enablement of Advanced Networking observability functionalities on clusters. + /// Keeps track of any properties unknown to the library. + internal AdvancedNetworkingObservability(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates the enablement of Advanced Networking observability functionalities on clusters. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.Serialization.cs new file mode 100644 index 000000000000..81d58647e959 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.Serialization.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class AdvancedNetworkingSecurity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworkingSecurity)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(AdvancedNetworkPolicies)) + { + writer.WritePropertyName("advancedNetworkPolicies"u8); + writer.WriteStringValue(AdvancedNetworkPolicies.Value.ToString()); + } + writer.WritePropertyName("transitEncryption"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(TransitEncryptionType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(TransitEncryptionType.Value.ToString()); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AdvancedNetworkingSecurity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedNetworkingSecurity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAdvancedNetworkingSecurity(document.RootElement, options); + } + + internal static AdvancedNetworkingSecurity DeserializeAdvancedNetworkingSecurity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + AdvancedNetworkPolicy? advancedNetworkPolicies = default; + TransitEncryptionType? type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("advancedNetworkPolicies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + advancedNetworkPolicies = new AdvancedNetworkPolicy(property.Value.GetString()); + continue; + } + if (property.NameEquals("transitEncryption"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new TransitEncryptionType(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AdvancedNetworkingSecurity(enabled, advancedNetworkPolicies, type, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdvancedNetworkPolicies), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" advancedNetworkPolicies: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AdvancedNetworkPolicies)) + { + builder.Append(" advancedNetworkPolicies: "); + builder.AppendLine($"'{AdvancedNetworkPolicies.Value.ToString()}'"); + } + } + + builder.Append(" transitEncryption:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TransitEncryptionType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TransitEncryptionType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{TransitEncryptionType.Value.ToString()}'"); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AdvancedNetworkingSecurity)} does not support writing '{options.Format}' format."); + } + } + + AdvancedNetworkingSecurity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAdvancedNetworkingSecurity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AdvancedNetworkingSecurity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.cs new file mode 100644 index 000000000000..c48b7fe224e5 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AdvancedNetworkingSecurity.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Security profile to enable security features on cilium-based cluster. + public partial class AdvancedNetworkingSecurity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AdvancedNetworkingSecurity() + { + } + + /// Initializes a new instance of . + /// Configure Advanced Networking Security features on Cilium clusters. See individual fields for their default values. + /// This allows users to configure Layer 7 network policies (FQDN, HTTP, Kafka). Policies themselves must be configured via the Cilium Network Policy resources, see https://docs.cilium.io/en/latest/security/policy/index.html. This can be enabled only on cilium-based clusters. If not specified, the default value is FQDN if security.enabled is set to true. + /// This can be enabled only on Cilium-based clusters. If not specified, the default value is None. + /// Keeps track of any properties unknown to the library. + internal AdvancedNetworkingSecurity(bool? enabled, AdvancedNetworkPolicy? advancedNetworkPolicies, TransitEncryptionType? transitEncryptionType, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + AdvancedNetworkPolicies = advancedNetworkPolicies; + TransitEncryptionType = transitEncryptionType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Configure Advanced Networking Security features on Cilium clusters. See individual fields for their default values. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// This allows users to configure Layer 7 network policies (FQDN, HTTP, Kafka). Policies themselves must be configured via the Cilium Network Policy resources, see https://docs.cilium.io/en/latest/security/policy/index.html. This can be enabled only on cilium-based clusters. If not specified, the default value is FQDN if security.enabled is set to true. + [WirePath("advancedNetworkPolicies")] + public AdvancedNetworkPolicy? AdvancedNetworkPolicies { get; set; } + /// This can be enabled only on Cilium-based clusters. If not specified, the default value is None. + [WirePath("transitEncryption.type")] + public TransitEncryptionType? TransitEncryptionType { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolArtifactStreamingProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolArtifactStreamingProfile.Serialization.cs new file mode 100644 index 000000000000..18fbc1d23098 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolArtifactStreamingProfile.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class AgentPoolArtifactStreamingProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolArtifactStreamingProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentPoolArtifactStreamingProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolArtifactStreamingProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolArtifactStreamingProfile(document.RootElement, options); + } + + internal static AgentPoolArtifactStreamingProfile DeserializeAgentPoolArtifactStreamingProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentPoolArtifactStreamingProfile(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AgentPoolArtifactStreamingProfile)} does not support writing '{options.Format}' format."); + } + } + + AgentPoolArtifactStreamingProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentPoolArtifactStreamingProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentPoolArtifactStreamingProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolArtifactStreamingProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolArtifactStreamingProfile.cs new file mode 100644 index 000000000000..92799ce4d14f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolArtifactStreamingProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The AgentPoolArtifactStreamingProfile. + internal partial class AgentPoolArtifactStreamingProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AgentPoolArtifactStreamingProfile() + { + } + + /// Initializes a new instance of . + /// Artifact streaming speeds up the cold-start of containers on a node through on-demand image loading. To use this feature, container images must also enable artifact streaming on ACR. If not specified, the default is false. + /// Keeps track of any properties unknown to the library. + internal AgentPoolArtifactStreamingProfile(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Artifact streaming speeds up the cold-start of containers on a node through on-demand image loading. To use this feature, container images must also enable artifact streaming on ACR. If not specified, the default is false. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.Serialization.cs new file mode 100644 index 000000000000..d6a76040c03e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.Serialization.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class AgentPoolDeleteMachinesParameter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolDeleteMachinesParameter)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("machineNames"u8); + writer.WriteStartArray(); + foreach (var item in MachineNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentPoolDeleteMachinesParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolDeleteMachinesParameter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolDeleteMachinesParameter(document.RootElement, options); + } + + internal static AgentPoolDeleteMachinesParameter DeserializeAgentPoolDeleteMachinesParameter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList machineNames = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("machineNames"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + machineNames = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentPoolDeleteMachinesParameter(machineNames, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgentPoolDeleteMachinesParameter)} does not support writing '{options.Format}' format."); + } + } + + AgentPoolDeleteMachinesParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentPoolDeleteMachinesParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentPoolDeleteMachinesParameter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.cs new file mode 100644 index 000000000000..8a2f8c563cac --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolDeleteMachinesParameter.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Specifies a list of machine names from the agent pool to be deleted. + public partial class AgentPoolDeleteMachinesParameter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The agent pool machine names. + /// is null. + public AgentPoolDeleteMachinesParameter(IEnumerable machineNames) + { + Argument.AssertNotNull(machineNames, nameof(machineNames)); + + MachineNames = machineNames.ToList(); + } + + /// Initializes a new instance of . + /// The agent pool machine names. + /// Keeps track of any properties unknown to the library. + internal AgentPoolDeleteMachinesParameter(IList machineNames, IDictionary serializedAdditionalRawData) + { + MachineNames = machineNames; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgentPoolDeleteMachinesParameter() + { + } + + /// The agent pool machine names. + [WirePath("machineNames")] + public IList MachineNames { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolGatewayProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolGatewayProfile.Serialization.cs new file mode 100644 index 000000000000..4683d7862040 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolGatewayProfile.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class AgentPoolGatewayProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolGatewayProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(PublicIPPrefixSize)) + { + writer.WritePropertyName("publicIPPrefixSize"u8); + writer.WriteNumberValue(PublicIPPrefixSize.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentPoolGatewayProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolGatewayProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolGatewayProfile(document.RootElement, options); + } + + internal static AgentPoolGatewayProfile DeserializeAgentPoolGatewayProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? publicIPPrefixSize = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("publicIPPrefixSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicIPPrefixSize = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentPoolGatewayProfile(publicIPPrefixSize, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicIPPrefixSize), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" publicIPPrefixSize: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PublicIPPrefixSize)) + { + builder.Append(" publicIPPrefixSize: "); + builder.AppendLine($"{PublicIPPrefixSize.Value}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AgentPoolGatewayProfile)} does not support writing '{options.Format}' format."); + } + } + + AgentPoolGatewayProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentPoolGatewayProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentPoolGatewayProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolGatewayProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolGatewayProfile.cs new file mode 100644 index 000000000000..482c6cf8c44e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolGatewayProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Profile of the managed cluster gateway agent pool. + internal partial class AgentPoolGatewayProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AgentPoolGatewayProfile() + { + } + + /// Initializes a new instance of . + /// The Gateway agent pool associates one public IPPrefix for each static egress gateway to provide public egress. The size of Public IPPrefix should be selected by the user. Each node in the agent pool is assigned with one IP from the IPPrefix. The IPPrefix size thus serves as a cap on the size of the Gateway agent pool. Due to Azure public IPPrefix size limitation, the valid value range is [28, 31] (/31 = 2 nodes/IPs, /30 = 4 nodes/IPs, /29 = 8 nodes/IPs, /28 = 16 nodes/IPs). The default value is 31. + /// Keeps track of any properties unknown to the library. + internal AgentPoolGatewayProfile(int? publicIPPrefixSize, IDictionary serializedAdditionalRawData) + { + PublicIPPrefixSize = publicIPPrefixSize; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The Gateway agent pool associates one public IPPrefix for each static egress gateway to provide public egress. The size of Public IPPrefix should be selected by the user. Each node in the agent pool is assigned with one IP from the IPPrefix. The IPPrefix size thus serves as a cap on the size of the Gateway agent pool. Due to Azure public IPPrefix size limitation, the valid value range is [28, 31] (/31 = 2 nodes/IPs, /30 = 4 nodes/IPs, /29 = 8 nodes/IPs, /28 = 16 nodes/IPs). The default value is 31. + [WirePath("publicIPPrefixSize")] + public int? PublicIPPrefixSize { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolMode.cs index 25d01165d700..de37604c505a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolMode.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolMode.cs @@ -24,11 +24,14 @@ public AgentPoolMode(string value) private const string SystemValue = "System"; private const string UserValue = "User"; + private const string GatewayValue = "Gateway"; /// System agent pools are primarily for hosting critical system pods such as CoreDNS and metrics-server. System agent pools osType must be Linux. System agent pools VM SKU must have at least 2vCPUs and 4GB of memory. public static AgentPoolMode System { get; } = new AgentPoolMode(SystemValue); /// User agent pools are primarily for hosting your application pods. public static AgentPoolMode User { get; } = new AgentPoolMode(UserValue); + /// Gateway agent pools are dedicated to providing static egress IPs to pods. For more details, see https://aka.ms/aks/static-egress-gateway. + public static AgentPoolMode Gateway { get; } = new AgentPoolMode(GatewayValue); /// Determines if two values are the same. public static bool operator ==(AgentPoolMode left, AgentPoolMode right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSSHAccess.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSSHAccess.cs new file mode 100644 index 000000000000..ce3f0dd05c41 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSSHAccess.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// SSH access method of an agent pool. + public readonly partial struct AgentPoolSSHAccess : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgentPoolSSHAccess(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LocalUserValue = "LocalUser"; + private const string DisabledValue = "Disabled"; + + /// Can SSH onto the node as a local user using private key. + public static AgentPoolSSHAccess LocalUser { get; } = new AgentPoolSSHAccess(LocalUserValue); + /// SSH service will be turned off on the node. + public static AgentPoolSSHAccess Disabled { get; } = new AgentPoolSSHAccess(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(AgentPoolSSHAccess left, AgentPoolSSHAccess right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgentPoolSSHAccess left, AgentPoolSSHAccess right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AgentPoolSSHAccess(string value) => new AgentPoolSSHAccess(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgentPoolSSHAccess other && Equals(other); + /// + public bool Equals(AgentPoolSSHAccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.Serialization.cs new file mode 100644 index 000000000000..ee0df2ccd2dc --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.Serialization.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class AgentPoolSecurityProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolSecurityProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SshAccess)) + { + writer.WritePropertyName("sshAccess"u8); + writer.WriteStringValue(SshAccess.Value.ToString()); + } + if (Optional.IsDefined(EnableVtpm)) + { + writer.WritePropertyName("enableVTPM"u8); + writer.WriteBooleanValue(EnableVtpm.Value); + } + if (Optional.IsDefined(EnableSecureBoot)) + { + writer.WritePropertyName("enableSecureBoot"u8); + writer.WriteBooleanValue(EnableSecureBoot.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentPoolSecurityProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolSecurityProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolSecurityProfile(document.RootElement, options); + } + + internal static AgentPoolSecurityProfile DeserializeAgentPoolSecurityProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AgentPoolSSHAccess? sshAccess = default; + bool? enableVTPM = default; + bool? enableSecureBoot = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sshAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sshAccess = new AgentPoolSSHAccess(property.Value.GetString()); + continue; + } + if (property.NameEquals("enableVTPM"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableVTPM = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("enableSecureBoot"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableSecureBoot = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentPoolSecurityProfile(sshAccess, enableVTPM, enableSecureBoot, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SshAccess), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sshAccess: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SshAccess)) + { + builder.Append(" sshAccess: "); + builder.AppendLine($"'{SshAccess.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableVtpm), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enableVTPM: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnableVtpm)) + { + builder.Append(" enableVTPM: "); + var boolValue = EnableVtpm.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableSecureBoot), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enableSecureBoot: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnableSecureBoot)) + { + builder.Append(" enableSecureBoot: "); + var boolValue = EnableSecureBoot.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AgentPoolSecurityProfile)} does not support writing '{options.Format}' format."); + } + } + + AgentPoolSecurityProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentPoolSecurityProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentPoolSecurityProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.cs new file mode 100644 index 000000000000..1e39e116b68b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSecurityProfile.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The security settings of an agent pool. + public partial class AgentPoolSecurityProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AgentPoolSecurityProfile() + { + } + + /// Initializes a new instance of . + /// SSH access method of an agent pool. + /// vTPM is a Trusted Launch feature for configuring a dedicated secure vault for keys and measurements held locally on the node. For more details, see aka.ms/aks/trustedlaunch. If not specified, the default is false. + /// Secure Boot is a feature of Trusted Launch which ensures that only signed operating systems and drivers can boot. For more details, see aka.ms/aks/trustedlaunch. If not specified, the default is false. + /// Keeps track of any properties unknown to the library. + internal AgentPoolSecurityProfile(AgentPoolSSHAccess? sshAccess, bool? enableVtpm, bool? enableSecureBoot, IDictionary serializedAdditionalRawData) + { + SshAccess = sshAccess; + EnableVtpm = enableVtpm; + EnableSecureBoot = enableSecureBoot; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// SSH access method of an agent pool. + [WirePath("sshAccess")] + public AgentPoolSSHAccess? SshAccess { get; set; } + /// vTPM is a Trusted Launch feature for configuring a dedicated secure vault for keys and measurements held locally on the node. For more details, see aka.ms/aks/trustedlaunch. If not specified, the default is false. + [WirePath("enableVTPM")] + public bool? EnableVtpm { get; set; } + /// Secure Boot is a feature of Trusted Launch which ensures that only signed operating systems and drivers can boot. For more details, see aka.ms/aks/trustedlaunch. If not specified, the default is false. + [WirePath("enableSecureBoot")] + public bool? EnableSecureBoot { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolStatus.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolStatus.Serialization.cs new file mode 100644 index 000000000000..494a614840c1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolStatus.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class AgentPoolStatus : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolStatus)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningError)) + { + writer.WritePropertyName("provisioningError"u8); + JsonSerializer.Serialize(writer, ProvisioningError); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentPoolStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolStatus(document.RootElement, options); + } + + internal static AgentPoolStatus DeserializeAgentPoolStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResponseError provisioningError = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningError"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningError = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentPoolStatus(provisioningError, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningError), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningError: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningError)) + { + builder.Append(" provisioningError: "); + BicepSerializationHelpers.AppendChildObject(builder, ProvisioningError, options, 2, false, " provisioningError: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AgentPoolStatus)} does not support writing '{options.Format}' format."); + } + } + + AgentPoolStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentPoolStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentPoolStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolStatus.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolStatus.cs new file mode 100644 index 000000000000..901a63639185 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolStatus.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Contains read-only information about the Agent Pool. + internal partial class AgentPoolStatus + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AgentPoolStatus() + { + } + + /// Initializes a new instance of . + /// Preserves the detailed info of failure. If there was no error, this field is omitted. + /// Keeps track of any properties unknown to the library. + internal AgentPoolStatus(ResponseError provisioningError, IDictionary serializedAdditionalRawData) + { + ProvisioningError = provisioningError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Preserves the detailed info of failure. If there was no error, this field is omitted. + [WirePath("provisioningError")] + public ResponseError ProvisioningError { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolType.cs index 90e83bff8f49..de4abf2c36e7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolType.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolType.cs @@ -24,11 +24,14 @@ public AgentPoolType(string value) private const string VirtualMachineScaleSetsValue = "VirtualMachineScaleSets"; private const string AvailabilitySetValue = "AvailabilitySet"; + private const string VirtualMachinesValue = "VirtualMachines"; /// Create an Agent Pool backed by a Virtual Machine Scale Set. public static AgentPoolType VirtualMachineScaleSets { get; } = new AgentPoolType(VirtualMachineScaleSetsValue); /// Use of this is strongly discouraged. public static AgentPoolType AvailabilitySet { get; } = new AgentPoolType(AvailabilitySetValue); + /// Create an Agent Pool backed by a Single Instance VM orchestration mode. + public static AgentPoolType VirtualMachines { get; } = new AgentPoolType(VirtualMachinesValue); /// Determines if two values are the same. public static bool operator ==(AgentPoolType left, AgentPoolType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs index 5653e1d6763f..75fc20f1ea62 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs @@ -45,6 +45,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("isPreview"u8); writer.WriteBooleanValue(IsPreview.Value); } + if (Optional.IsDefined(IsOutOfSupport)) + { + writer.WritePropertyName("isOutOfSupport"u8); + writer.WriteBooleanValue(IsOutOfSupport.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -84,6 +89,7 @@ internal static AgentPoolUpgradeProfilePropertiesUpgradesItem DeserializeAgentPo } string kubernetesVersion = default; bool? isPreview = default; + bool? isOutOfSupport = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -102,13 +108,22 @@ internal static AgentPoolUpgradeProfilePropertiesUpgradesItem DeserializeAgentPo isPreview = property.Value.GetBoolean(); continue; } + if (property.NameEquals("isOutOfSupport"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isOutOfSupport = property.Value.GetBoolean(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolUpgradeProfilePropertiesUpgradesItem(kubernetesVersion, isPreview, serializedAdditionalRawData); + return new AgentPoolUpgradeProfilePropertiesUpgradesItem(kubernetesVersion, isPreview, isOutOfSupport, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -161,6 +176,22 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsOutOfSupport), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isOutOfSupport: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsOutOfSupport)) + { + builder.Append(" isOutOfSupport: "); + var boolValue = IsOutOfSupport.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs index 09e9b07a6801..235fe13eae09 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs @@ -53,11 +53,13 @@ internal AgentPoolUpgradeProfilePropertiesUpgradesItem() /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// Whether the Kubernetes version is currently in preview. + /// Whether the Kubernetes version is out of support. /// Keeps track of any properties unknown to the library. - internal AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion, bool? isPreview, IDictionary serializedAdditionalRawData) + internal AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion, bool? isPreview, bool? isOutOfSupport, IDictionary serializedAdditionalRawData) { KubernetesVersion = kubernetesVersion; IsPreview = isPreview; + IsOutOfSupport = isOutOfSupport; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -67,5 +69,8 @@ internal AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion, /// Whether the Kubernetes version is currently in preview. [WirePath("isPreview")] public bool? IsPreview { get; } + /// Whether the Kubernetes version is out of support. + [WirePath("isOutOfSupport")] + public bool? IsOutOfSupport { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs index ea26983918b6..7bc18d26e104 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs @@ -40,11 +40,31 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("maxSurge"u8); writer.WriteStringValue(MaxSurge); } + if (Optional.IsDefined(MaxUnavailable)) + { + writer.WritePropertyName("maxUnavailable"u8); + writer.WriteStringValue(MaxUnavailable); + } + if (Optional.IsDefined(MaxBlockedNodes)) + { + writer.WritePropertyName("maxBlockedNodes"u8); + writer.WriteStringValue(MaxBlockedNodes); + } if (Optional.IsDefined(DrainTimeoutInMinutes)) { writer.WritePropertyName("drainTimeoutInMinutes"u8); writer.WriteNumberValue(DrainTimeoutInMinutes.Value); } + if (Optional.IsDefined(NodeSoakDurationInMinutes)) + { + writer.WritePropertyName("nodeSoakDurationInMinutes"u8); + writer.WriteNumberValue(NodeSoakDurationInMinutes.Value); + } + if (Optional.IsDefined(UndrainableNodeBehavior)) + { + writer.WritePropertyName("undrainableNodeBehavior"u8); + writer.WriteStringValue(UndrainableNodeBehavior.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -83,7 +103,11 @@ internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(Jso return null; } string maxSurge = default; + string maxUnavailable = default; + string maxBlockedNodes = default; int? drainTimeoutInMinutes = default; + int? nodeSoakDurationInMinutes = default; + UndrainableNodeBehavior? undrainableNodeBehavior = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -93,6 +117,16 @@ internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(Jso maxSurge = property.Value.GetString(); continue; } + if (property.NameEquals("maxUnavailable"u8)) + { + maxUnavailable = property.Value.GetString(); + continue; + } + if (property.NameEquals("maxBlockedNodes"u8)) + { + maxBlockedNodes = property.Value.GetString(); + continue; + } if (property.NameEquals("drainTimeoutInMinutes"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -102,13 +136,38 @@ internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(Jso drainTimeoutInMinutes = property.Value.GetInt32(); continue; } + if (property.NameEquals("nodeSoakDurationInMinutes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeSoakDurationInMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("undrainableNodeBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + undrainableNodeBehavior = new UndrainableNodeBehavior(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolUpgradeSettings(maxSurge, drainTimeoutInMinutes, serializedAdditionalRawData); + return new AgentPoolUpgradeSettings( + maxSurge, + maxUnavailable, + maxBlockedNodes, + drainTimeoutInMinutes, + nodeSoakDurationInMinutes, + undrainableNodeBehavior, + serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -145,6 +204,52 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxUnavailable), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxUnavailable: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaxUnavailable)) + { + builder.Append(" maxUnavailable: "); + if (MaxUnavailable.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MaxUnavailable}'''"); + } + else + { + builder.AppendLine($"'{MaxUnavailable}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxBlockedNodes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxBlockedNodes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaxBlockedNodes)) + { + builder.Append(" maxBlockedNodes: "); + if (MaxBlockedNodes.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MaxBlockedNodes}'''"); + } + else + { + builder.AppendLine($"'{MaxBlockedNodes}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DrainTimeoutInMinutes), out propertyOverride); if (hasPropertyOverride) { @@ -160,6 +265,36 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeSoakDurationInMinutes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeSoakDurationInMinutes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NodeSoakDurationInMinutes)) + { + builder.Append(" nodeSoakDurationInMinutes: "); + builder.AppendLine($"{NodeSoakDurationInMinutes.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UndrainableNodeBehavior), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" undrainableNodeBehavior: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UndrainableNodeBehavior)) + { + builder.Append(" undrainableNodeBehavior: "); + builder.AppendLine($"'{UndrainableNodeBehavior.Value.ToString()}'"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs index a57cb99ed6af..98179b202166 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs @@ -51,21 +51,41 @@ public AgentPoolUpgradeSettings() } /// Initializes a new instance of . - /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 10%. For more information, including best practices, see: https://learn.microsoft.com/en-us/azure/aks/upgrade-cluster. + /// This can either be set to an integer (e.g. '1') or a percentage (e.g. '5%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 0. For more information, including best practices, see: https://learn.microsoft.com/en-us/azure/aks/upgrade-cluster. + /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is maxSurge. This must always be greater than or equal to maxSurge. For more information, including best practices, see: https://learn.microsoft.com/en-us/azure/aks/upgrade-cluster. /// The amount of time (in minutes) to wait on eviction of pods and graceful termination per node. This eviction wait time honors waiting on pod disruption budgets. If this time is exceeded, the upgrade fails. If not specified, the default is 30 minutes. + /// The amount of time (in minutes) to wait after draining a node and before reimaging it and moving on to next node. If not specified, the default is 0 minutes. + /// Defines the behavior for undrainable nodes during upgrade. The most common cause of undrainable nodes is Pod Disruption Budgets (PDBs), but other issues, such as pod termination grace period is exceeding the remaining per-node drain timeout or pod is still being in a running state, can also cause undrainable nodes. /// Keeps track of any properties unknown to the library. - internal AgentPoolUpgradeSettings(string maxSurge, int? drainTimeoutInMinutes, IDictionary serializedAdditionalRawData) + internal AgentPoolUpgradeSettings(string maxSurge, string maxUnavailable, string maxBlockedNodes, int? drainTimeoutInMinutes, int? nodeSoakDurationInMinutes, UndrainableNodeBehavior? undrainableNodeBehavior, IDictionary serializedAdditionalRawData) { MaxSurge = maxSurge; + MaxUnavailable = maxUnavailable; + MaxBlockedNodes = maxBlockedNodes; DrainTimeoutInMinutes = drainTimeoutInMinutes; + NodeSoakDurationInMinutes = nodeSoakDurationInMinutes; + UndrainableNodeBehavior = undrainableNodeBehavior; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 10%. For more information, including best practices, see: https://learn.microsoft.com/en-us/azure/aks/upgrade-cluster. [WirePath("maxSurge")] public string MaxSurge { get; set; } + /// This can either be set to an integer (e.g. '1') or a percentage (e.g. '5%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 0. For more information, including best practices, see: https://learn.microsoft.com/en-us/azure/aks/upgrade-cluster. + [WirePath("maxUnavailable")] + public string MaxUnavailable { get; set; } + /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is maxSurge. This must always be greater than or equal to maxSurge. For more information, including best practices, see: https://learn.microsoft.com/en-us/azure/aks/upgrade-cluster. + [WirePath("maxBlockedNodes")] + public string MaxBlockedNodes { get; set; } /// The amount of time (in minutes) to wait on eviction of pods and graceful termination per node. This eviction wait time honors waiting on pod disruption budgets. If this time is exceeded, the upgrade fails. If not specified, the default is 30 minutes. [WirePath("drainTimeoutInMinutes")] public int? DrainTimeoutInMinutes { get; set; } + /// The amount of time (in minutes) to wait after draining a node and before reimaging it and moving on to next node. If not specified, the default is 0 minutes. + [WirePath("nodeSoakDurationInMinutes")] + public int? NodeSoakDurationInMinutes { get; set; } + /// Defines the behavior for undrainable nodes during upgrade. The most common cause of undrainable nodes is Pod Disruption Budgets (PDBs), but other issues, such as pod termination grace period is exceeding the remaining per-node drain timeout or pod is still being in a running state, can also cause undrainable nodes. + [WirePath("undrainableNodeBehavior")] + public UndrainableNodeBehavior? UndrainableNodeBehavior { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs new file mode 100644 index 000000000000..d1a9aa60ca8f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class AgentPoolWindowsProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolWindowsProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisableOutboundNat)) + { + writer.WritePropertyName("disableOutboundNat"u8); + writer.WriteBooleanValue(DisableOutboundNat.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgentPoolWindowsProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentPoolWindowsProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolWindowsProfile(document.RootElement, options); + } + + internal static AgentPoolWindowsProfile DeserializeAgentPoolWindowsProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? disableOutboundNat = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("disableOutboundNat"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableOutboundNat = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgentPoolWindowsProfile(disableOutboundNat, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisableOutboundNat), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" disableOutboundNat: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DisableOutboundNat)) + { + builder.Append(" disableOutboundNat: "); + var boolValue = DisableOutboundNat.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AgentPoolWindowsProfile)} does not support writing '{options.Format}' format."); + } + } + + AgentPoolWindowsProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAgentPoolWindowsProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentPoolWindowsProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs new file mode 100644 index 000000000000..f22bc75ada64 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The Windows agent pool's specific profile. + internal partial class AgentPoolWindowsProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AgentPoolWindowsProfile() + { + } + + /// Initializes a new instance of . + /// The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP enabled. + /// Keeps track of any properties unknown to the library. + internal AgentPoolWindowsProfile(bool? disableOutboundNat, IDictionary serializedAdditionalRawData) + { + DisableOutboundNat = disableOutboundNat; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP enabled. + [WirePath("disableOutboundNat")] + public bool? DisableOutboundNat { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ArtifactSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ArtifactSource.cs new file mode 100644 index 000000000000..5b31f994f257 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ArtifactSource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The source where the artifacts are downloaded from. + public readonly partial struct ArtifactSource : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactSource(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CacheValue = "Cache"; + private const string DirectValue = "Direct"; + + /// pull images from Azure Container Registry with cache. + public static ArtifactSource Cache { get; } = new ArtifactSource(CacheValue); + /// pull images from Microsoft Artifact Registry. + public static ArtifactSource Direct { get; } = new ArtifactSource(DirectValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactSource left, ArtifactSource right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactSource left, ArtifactSource right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ArtifactSource(string value) => new ArtifactSource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactSource other && Equals(other); + /// + public bool Equals(ArtifactSource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ClusterServiceLoadBalancerHealthProbeMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ClusterServiceLoadBalancerHealthProbeMode.cs new file mode 100644 index 000000000000..f9363e68b9dd --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ClusterServiceLoadBalancerHealthProbeMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The health probing behavior for External Traffic Policy Cluster services. + public readonly partial struct ClusterServiceLoadBalancerHealthProbeMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ClusterServiceLoadBalancerHealthProbeMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ServiceNodePortValue = "ServiceNodePort"; + private const string SharedValue = "Shared"; + + /// Each External Traffic Policy Cluster service will have its own health probe targeting service nodePort. + public static ClusterServiceLoadBalancerHealthProbeMode ServiceNodePort { get; } = new ClusterServiceLoadBalancerHealthProbeMode(ServiceNodePortValue); + /// All External Traffic Policy Cluster services in a Standard Load Balancer will have a dedicated health probe targeting the backend nodes' kube-proxy health check port 10256. + public static ClusterServiceLoadBalancerHealthProbeMode Shared { get; } = new ClusterServiceLoadBalancerHealthProbeMode(SharedValue); + /// Determines if two values are the same. + public static bool operator ==(ClusterServiceLoadBalancerHealthProbeMode left, ClusterServiceLoadBalancerHealthProbeMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ClusterServiceLoadBalancerHealthProbeMode left, ClusterServiceLoadBalancerHealthProbeMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ClusterServiceLoadBalancerHealthProbeMode(string value) => new ClusterServiceLoadBalancerHealthProbeMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ClusterServiceLoadBalancerHealthProbeMode other && Equals(other); + /// + public bool Equals(ClusterServiceLoadBalancerHealthProbeMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Component.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Component.Serialization.cs new file mode 100644 index 000000000000..980e98f881ba --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Component.Serialization.cs @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class Component : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Component)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (Optional.IsDefined(HasBreakingChanges)) + { + writer.WritePropertyName("hasBreakingChanges"u8); + writer.WriteBooleanValue(HasBreakingChanges.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Component IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Component)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeComponent(document.RootElement, options); + } + + internal static Component DeserializeComponent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string version = default; + bool? hasBreakingChanges = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("hasBreakingChanges"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hasBreakingChanges = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Component(name, version, hasBreakingChanges, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + if (Version.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Version}'''"); + } + else + { + builder.AppendLine($"'{Version}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HasBreakingChanges), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" hasBreakingChanges: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(HasBreakingChanges)) + { + builder.Append(" hasBreakingChanges: "); + var boolValue = HasBreakingChanges.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Component)} does not support writing '{options.Format}' format."); + } + } + + Component IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeComponent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Component)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Component.cs similarity index 56% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Component.cs index 38edc7fbc43c..1882be2cf3d7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Component.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// OS option property. - public partial class ContainerServiceOSOptionProperty + /// The Component. + public partial class Component { /// /// Keeps track of any properties unknown to the library. @@ -45,39 +45,32 @@ public partial class ContainerServiceOSOptionProperty /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// The OS type. - /// Whether the image is FIPS-enabled. - /// is null. - internal ContainerServiceOSOptionProperty(string osType, bool enableFipsImage) + /// Initializes a new instance of . + internal Component() { - Argument.AssertNotNull(osType, nameof(osType)); - - OSType = osType; - EnableFipsImage = enableFipsImage; } - /// Initializes a new instance of . - /// The OS type. - /// Whether the image is FIPS-enabled. + /// Initializes a new instance of . + /// Component name. + /// Component version. + /// If upgraded component version contains breaking changes from the current version. To see a detailed description of what the breaking changes are, visit https://learn.microsoft.com/azure/aks/supported-kubernetes-versions?tabs=azure-cli#aks-components-breaking-changes-by-version. /// Keeps track of any properties unknown to the library. - internal ContainerServiceOSOptionProperty(string osType, bool enableFipsImage, IDictionary serializedAdditionalRawData) + internal Component(string name, string version, bool? hasBreakingChanges, IDictionary serializedAdditionalRawData) { - OSType = osType; - EnableFipsImage = enableFipsImage; + Name = name; + Version = version; + HasBreakingChanges = hasBreakingChanges; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ContainerServiceOSOptionProperty() - { - } - - /// The OS type. - [WirePath("os-type")] - public string OSType { get; } - /// Whether the image is FIPS-enabled. - [WirePath("enable-fips-image")] - public bool EnableFipsImage { get; } + /// Component name. + [WirePath("name")] + public string Name { get; } + /// Component version. + [WirePath("version")] + public string Version { get; } + /// If upgraded component version contains breaking changes from the current version. To see a detailed description of what the breaking changes are, visit https://learn.microsoft.com/azure/aks/supported-kubernetes-versions?tabs=azure-cli#aks-components-breaking-changes-by-version. + [WirePath("hasBreakingChanges")] + public bool? HasBreakingChanges { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ComponentsByRelease.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ComponentsByRelease.Serialization.cs new file mode 100644 index 000000000000..e2a848cfe86b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ComponentsByRelease.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ComponentsByRelease : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ComponentsByRelease)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(KubernetesVersion)) + { + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + } + if (Optional.IsCollectionDefined(Components)) + { + writer.WritePropertyName("components"u8); + writer.WriteStartArray(); + foreach (var item in Components) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ComponentsByRelease IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ComponentsByRelease)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeComponentsByRelease(document.RootElement, options); + } + + internal static ComponentsByRelease DeserializeComponentsByRelease(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kubernetesVersion = default; + IReadOnlyList components = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kubernetesVersion"u8)) + { + kubernetesVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("components"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Component.DeserializeComponent(item, options)); + } + components = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ComponentsByRelease(kubernetesVersion, components ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubernetesVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kubernetesVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(KubernetesVersion)) + { + builder.Append(" kubernetesVersion: "); + if (KubernetesVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{KubernetesVersion}'''"); + } + else + { + builder.AppendLine($"'{KubernetesVersion}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Components), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" components: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Components)) + { + if (Components.Any()) + { + builder.Append(" components: "); + builder.AppendLine("["); + foreach (var item in Components) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " components: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ComponentsByRelease)} does not support writing '{options.Format}' format."); + } + } + + ComponentsByRelease IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeComponentsByRelease(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ComponentsByRelease)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ComponentsByRelease.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ComponentsByRelease.cs new file mode 100644 index 000000000000..e9e2de550026 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ComponentsByRelease.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// components of given Kubernetes version. + public partial class ComponentsByRelease + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ComponentsByRelease() + { + Components = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The Kubernetes version (major.minor). + /// components of current or upgraded Kubernetes version in the cluster. + /// Keeps track of any properties unknown to the library. + internal ComponentsByRelease(string kubernetesVersion, IReadOnlyList components, IDictionary serializedAdditionalRawData) + { + KubernetesVersion = kubernetesVersion; + Components = components; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The Kubernetes version (major.minor). + [WirePath("kubernetesVersion")] + public string KubernetesVersion { get; } + /// components of current or upgraded Kubernetes version in the cluster. + [WirePath("components")] + public IReadOnlyList Components { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs index a1efae39f6f4..1958beef1107 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs @@ -47,7 +47,7 @@ public partial class ContainerServiceMaintenanceRelativeMonthlySchedule /// Initializes a new instance of . /// Specifies the number of months between each set of occurrences. - /// Specifies on which week of the month the dayOfWeek applies. + /// Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs. /// Specifies on which day of the week the maintenance occurs. public ContainerServiceMaintenanceRelativeMonthlySchedule(int intervalMonths, ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex weekIndex, ContainerServiceWeekDay dayOfWeek) { @@ -58,7 +58,7 @@ public ContainerServiceMaintenanceRelativeMonthlySchedule(int intervalMonths, Co /// Initializes a new instance of . /// Specifies the number of months between each set of occurrences. - /// Specifies on which week of the month the dayOfWeek applies. + /// Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs. /// Specifies on which day of the week the maintenance occurs. /// Keeps track of any properties unknown to the library. internal ContainerServiceMaintenanceRelativeMonthlySchedule(int intervalMonths, ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex weekIndex, ContainerServiceWeekDay dayOfWeek, IDictionary serializedAdditionalRawData) @@ -77,7 +77,7 @@ internal ContainerServiceMaintenanceRelativeMonthlySchedule() /// Specifies the number of months between each set of occurrences. [WirePath("intervalMonths")] public int IntervalMonths { get; set; } - /// Specifies on which week of the month the dayOfWeek applies. + /// Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs. [WirePath("weekIndex")] public ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex WeekIndex { get; set; } /// Specifies on which day of the week the maintenance occurs. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex.cs index 6039e4261e73..3948f98fe390 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Specifies on which week of the month the dayOfWeek applies. + /// Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs. public readonly partial struct ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex : IEquatable { private readonly string _value; @@ -28,15 +28,15 @@ public ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(string value) private const string FourthValue = "Fourth"; private const string LastValue = "Last"; - /// First week of the month. + /// First. public static ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex First { get; } = new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(FirstValue); - /// Second week of the month. + /// Second. public static ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex Second { get; } = new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(SecondValue); - /// Third week of the month. + /// Third. public static ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex Third { get; } = new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(ThirdValue); - /// Fourth week of the month. + /// Fourth. public static ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex Fourth { get; } = new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(FourthValue); - /// Last week of the month. + /// Last. public static ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex Last { get; } = new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(LastValue); /// Determines if two values are the same. public static bool operator ==(ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex left, ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex right) => left.Equals(right); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPlugin.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPlugin.cs index 799f7ff37461..a6c37cbd65df 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPlugin.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPlugin.cs @@ -30,7 +30,7 @@ public ContainerServiceNetworkPlugin(string value) public static ContainerServiceNetworkPlugin Azure { get; } = new ContainerServiceNetworkPlugin(AzureValue); /// Use the Kubenet network plugin. See [Kubenet (basic) networking](https://docs.microsoft.com/azure/aks/concepts-network#kubenet-basic-networking) for more information. public static ContainerServiceNetworkPlugin Kubenet { get; } = new ContainerServiceNetworkPlugin(KubenetValue); - /// No CNI plugin is pre-installed. See [BYO CNI](https://docs.microsoft.com/en-us/azure/aks/use-byo-cni) for more information. + /// Do not use a network plugin. A custom CNI will need to be installed after cluster creation for networking functionality. public static ContainerServiceNetworkPlugin None { get; } = new ContainerServiceNetworkPlugin(NoneValue); /// Determines if two values are the same. public static bool operator ==(ContainerServiceNetworkPlugin left, ContainerServiceNetworkPlugin right) => left.Equals(right); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPluginMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPluginMode.cs index 6dfaab324dbe..023c1a324a04 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPluginMode.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPluginMode.cs @@ -24,7 +24,7 @@ public ContainerServiceNetworkPluginMode(string value) private const string OverlayValue = "overlay"; - /// Used with networkPlugin=azure, pods are given IPs from the PodCIDR address space but use Azure Routing Domains rather than Kubenet's method of route tables. For more information visit https://aka.ms/aks/azure-cni-overlay. + /// Pods are given IPs from the PodCIDR address space but use Azure Routing Domains rather than Kubenet reference plugins host-local and bridge. public static ContainerServiceNetworkPluginMode Overlay { get; } = new ContainerServiceNetworkPluginMode(OverlayValue); /// Determines if two values are the same. public static bool operator ==(ContainerServiceNetworkPluginMode left, ContainerServiceNetworkPluginMode right) => left.Equals(right); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs index 1c5d4ee4d4a2..def12ed901ee 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs @@ -22,10 +22,13 @@ public ContainerServiceNetworkPolicy(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } + private const string NoneValue = "none"; private const string CalicoValue = "calico"; private const string AzureValue = "azure"; private const string CiliumValue = "cilium"; + /// Network policies will not be enforced. This is the default value when NetworkPolicy is not specified. + public static ContainerServiceNetworkPolicy None { get; } = new ContainerServiceNetworkPolicy(NoneValue); /// Use Calico network policies. See [differences between Azure and Calico policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) for more information. public static ContainerServiceNetworkPolicy Calico { get; } = new ContainerServiceNetworkPolicy(CalicoValue); /// Use Azure network policies. See [differences between Azure and Calico policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) for more information. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs index 8c7481f491f7..2b672875d22b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs @@ -96,6 +96,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("natGatewayProfile"u8); writer.WriteObjectValue(NatGatewayProfile, options); } + if (Optional.IsDefined(StaticEgressGatewayProfile)) + { + writer.WritePropertyName("staticEgressGatewayProfile"u8); + writer.WriteObjectValue(StaticEgressGatewayProfile, options); + } if (Optional.IsCollectionDefined(PodCidrs)) { writer.WritePropertyName("podCidrs"u8); @@ -126,6 +131,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsDefined(PodLinkLocalAccess)) + { + writer.WritePropertyName("podLinkLocalAccess"u8); + writer.WriteStringValue(PodLinkLocalAccess.Value.ToString()); + } + if (Optional.IsDefined(KubeProxyConfig)) + { + writer.WritePropertyName("kubeProxyConfig"u8); + writer.WriteObjectValue(KubeProxyConfig, options); + } + if (Optional.IsDefined(AdvancedNetworking)) + { + writer.WritePropertyName("advancedNetworking"u8); + writer.WriteObjectValue(AdvancedNetworking, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -175,9 +195,13 @@ internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetwor ContainerServiceLoadBalancerSku? loadBalancerSku = default; ManagedClusterLoadBalancerProfile loadBalancerProfile = default; ManagedClusterNatGatewayProfile natGatewayProfile = default; + ManagedClusterStaticEgressGatewayProfile staticEgressGatewayProfile = default; IList podCidrs = default; IList serviceCidrs = default; IList ipFamilies = default; + PodLinkLocalAccess? podLinkLocalAccess = default; + ContainerServiceNetworkProfileKubeProxyConfig kubeProxyConfig = default; + AdvancedNetworking advancedNetworking = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -278,6 +302,15 @@ internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetwor natGatewayProfile = ManagedClusterNatGatewayProfile.DeserializeManagedClusterNatGatewayProfile(property.Value, options); continue; } + if (property.NameEquals("staticEgressGatewayProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + staticEgressGatewayProfile = ManagedClusterStaticEgressGatewayProfile.DeserializeManagedClusterStaticEgressGatewayProfile(property.Value, options); + continue; + } if (property.NameEquals("podCidrs"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -320,6 +353,33 @@ internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetwor ipFamilies = array; continue; } + if (property.NameEquals("podLinkLocalAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + podLinkLocalAccess = new PodLinkLocalAccess(property.Value.GetString()); + continue; + } + if (property.NameEquals("kubeProxyConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kubeProxyConfig = ContainerServiceNetworkProfileKubeProxyConfig.DeserializeContainerServiceNetworkProfileKubeProxyConfig(property.Value, options); + continue; + } + if (property.NameEquals("advancedNetworking"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + advancedNetworking = AdvancedNetworking.DeserializeAdvancedNetworking(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -339,9 +399,13 @@ internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetwor loadBalancerSku, loadBalancerProfile, natGatewayProfile, + staticEgressGatewayProfile, podCidrs ?? new ChangeTrackingList(), serviceCidrs ?? new ChangeTrackingList(), ipFamilies ?? new ChangeTrackingList(), + podLinkLocalAccess, + kubeProxyConfig, + advancedNetworking, serializedAdditionalRawData); } @@ -560,6 +624,24 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("StaticEgressGatewayProfileEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" staticEgressGatewayProfile: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(StaticEgressGatewayProfile)) + { + builder.Append(" staticEgressGatewayProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, StaticEgressGatewayProfile, options, 2, false, " staticEgressGatewayProfile: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodCidrs), out propertyOverride); if (hasPropertyOverride) { @@ -655,6 +737,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodLinkLocalAccess), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" podLinkLocalAccess: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PodLinkLocalAccess)) + { + builder.Append(" podLinkLocalAccess: "); + builder.AppendLine($"'{PodLinkLocalAccess.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeProxyConfig), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kubeProxyConfig: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(KubeProxyConfig)) + { + builder.Append(" kubeProxyConfig: "); + BicepSerializationHelpers.AppendChildObject(builder, KubeProxyConfig, options, 2, false, " kubeProxyConfig: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdvancedNetworking), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" advancedNetworking: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AdvancedNetworking)) + { + builder.Append(" advancedNetworking: "); + BicepSerializationHelpers.AppendChildObject(builder, AdvancedNetworking, options, 2, false, " advancedNetworking: "); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs index 81d5eb5c1e36..a4084c6a3afe 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs @@ -55,7 +55,7 @@ public ContainerServiceNetworkProfile() /// Initializes a new instance of . /// Network plugin used for building the Kubernetes network. - /// The mode the network plugin should use. + /// Network plugin mode used for building the Kubernetes network. /// Network policy used for building the Kubernetes network. /// This cannot be specified if networkPlugin is anything other than 'azure'. /// Network dataplane used in the Kubernetes cluster. @@ -66,11 +66,15 @@ public ContainerServiceNetworkProfile() /// The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs. /// Profile of the cluster load balancer. /// Profile of the cluster NAT gateway. + /// The profile for Static Egress Gateway addon. For more details about Static Egress Gateway, see https://aka.ms/aks/static-egress-gateway. /// One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. /// One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP ranges. /// IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6. + /// Defines access to special link local addresses (Azure Instance Metadata Service, aka IMDS) for pods with hostNetwork=false. if not specified, the default is 'IMDS'. + /// Holds configuration customizations for kube-proxy. Any values not defined will use the kube-proxy defaulting behavior. See https://v<version>.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ where <version> is represented by a <major version>-<minor version> string. Kubernetes version 1.23 would be '1-23'. + /// Advanced Networking profile for enabling observability and security feature suite on a cluster. For more information see aka.ms/aksadvancednetworking. /// Keeps track of any properties unknown to the library. - internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPlugin, ContainerServiceNetworkPluginMode? networkPluginMode, ContainerServiceNetworkPolicy? networkPolicy, ContainerServiceNetworkMode? networkMode, NetworkDataplane? networkDataplane, string podCidr, string serviceCidr, string dnsServiceIP, ContainerServiceOutboundType? outboundType, ContainerServiceLoadBalancerSku? loadBalancerSku, ManagedClusterLoadBalancerProfile loadBalancerProfile, ManagedClusterNatGatewayProfile natGatewayProfile, IList podCidrs, IList serviceCidrs, IList ipFamilies, IDictionary serializedAdditionalRawData) + internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPlugin, ContainerServiceNetworkPluginMode? networkPluginMode, ContainerServiceNetworkPolicy? networkPolicy, ContainerServiceNetworkMode? networkMode, NetworkDataplane? networkDataplane, string podCidr, string serviceCidr, string dnsServiceIP, ContainerServiceOutboundType? outboundType, ContainerServiceLoadBalancerSku? loadBalancerSku, ManagedClusterLoadBalancerProfile loadBalancerProfile, ManagedClusterNatGatewayProfile natGatewayProfile, ManagedClusterStaticEgressGatewayProfile staticEgressGatewayProfile, IList podCidrs, IList serviceCidrs, IList ipFamilies, PodLinkLocalAccess? podLinkLocalAccess, ContainerServiceNetworkProfileKubeProxyConfig kubeProxyConfig, AdvancedNetworking advancedNetworking, IDictionary serializedAdditionalRawData) { NetworkPlugin = networkPlugin; NetworkPluginMode = networkPluginMode; @@ -84,16 +88,20 @@ internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPl LoadBalancerSku = loadBalancerSku; LoadBalancerProfile = loadBalancerProfile; NatGatewayProfile = natGatewayProfile; + StaticEgressGatewayProfile = staticEgressGatewayProfile; PodCidrs = podCidrs; ServiceCidrs = serviceCidrs; IPFamilies = ipFamilies; + PodLinkLocalAccess = podLinkLocalAccess; + KubeProxyConfig = kubeProxyConfig; + AdvancedNetworking = advancedNetworking; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Network plugin used for building the Kubernetes network. [WirePath("networkPlugin")] public ContainerServiceNetworkPlugin? NetworkPlugin { get; set; } - /// The mode the network plugin should use. + /// Network plugin mode used for building the Kubernetes network. [WirePath("networkPluginMode")] public ContainerServiceNetworkPluginMode? NetworkPluginMode { get; set; } /// Network policy used for building the Kubernetes network. @@ -126,6 +134,21 @@ internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPl /// Profile of the cluster NAT gateway. [WirePath("natGatewayProfile")] public ManagedClusterNatGatewayProfile NatGatewayProfile { get; set; } + /// The profile for Static Egress Gateway addon. For more details about Static Egress Gateway, see https://aka.ms/aks/static-egress-gateway. + internal ManagedClusterStaticEgressGatewayProfile StaticEgressGatewayProfile { get; set; } + /// Indicates if Static Egress Gateway addon is enabled or not. + [WirePath("staticEgressGatewayProfile.enabled")] + public bool? StaticEgressGatewayProfileEnabled + { + get => StaticEgressGatewayProfile is null ? default : StaticEgressGatewayProfile.Enabled; + set + { + if (StaticEgressGatewayProfile is null) + StaticEgressGatewayProfile = new ManagedClusterStaticEgressGatewayProfile(); + StaticEgressGatewayProfile.Enabled = value; + } + } + /// One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. [WirePath("podCidrs")] public IList PodCidrs { get; } @@ -135,5 +158,14 @@ internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPl /// IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6. [WirePath("ipFamilies")] public IList IPFamilies { get; } + /// Defines access to special link local addresses (Azure Instance Metadata Service, aka IMDS) for pods with hostNetwork=false. if not specified, the default is 'IMDS'. + [WirePath("podLinkLocalAccess")] + public PodLinkLocalAccess? PodLinkLocalAccess { get; set; } + /// Holds configuration customizations for kube-proxy. Any values not defined will use the kube-proxy defaulting behavior. See https://v<version>.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ where <version> is represented by a <major version>-<minor version> string. Kubernetes version 1.23 would be '1-23'. + [WirePath("kubeProxyConfig")] + public ContainerServiceNetworkProfileKubeProxyConfig KubeProxyConfig { get; set; } + /// Advanced Networking profile for enabling observability and security feature suite on a cluster. For more information see aka.ms/aksadvancednetworking. + [WirePath("advancedNetworking")] + public AdvancedNetworking AdvancedNetworking { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.Serialization.cs new file mode 100644 index 000000000000..7990ab265dcb --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.Serialization.cs @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ContainerServiceNetworkProfileKubeProxyConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerServiceNetworkProfileKubeProxyConfig)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsDefined(IPVSConfig)) + { + writer.WritePropertyName("ipvsConfig"u8); + writer.WriteObjectValue(IPVSConfig, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ContainerServiceNetworkProfileKubeProxyConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerServiceNetworkProfileKubeProxyConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceNetworkProfileKubeProxyConfig(document.RootElement, options); + } + + internal static ContainerServiceNetworkProfileKubeProxyConfig DeserializeContainerServiceNetworkProfileKubeProxyConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + Mode? mode = default; + ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig ipvsConfig = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new Mode(property.Value.GetString()); + continue; + } + if (property.NameEquals("ipvsConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipvsConfig = ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig.DeserializeContainerServiceNetworkProfileKubeProxyConfigIPVSConfig(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ContainerServiceNetworkProfileKubeProxyConfig(enabled, mode, ipvsConfig, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Mode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" mode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Mode)) + { + builder.Append(" mode: "); + builder.AppendLine($"'{Mode.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IPVSConfig), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ipvsConfig: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IPVSConfig)) + { + builder.Append(" ipvsConfig: "); + BicepSerializationHelpers.AppendChildObject(builder, IPVSConfig, options, 2, false, " ipvsConfig: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ContainerServiceNetworkProfileKubeProxyConfig)} does not support writing '{options.Format}' format."); + } + } + + ContainerServiceNetworkProfileKubeProxyConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeContainerServiceNetworkProfileKubeProxyConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ContainerServiceNetworkProfileKubeProxyConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.cs new file mode 100644 index 000000000000..ed53c9f15423 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Holds configuration customizations for kube-proxy. Any values not defined will use the kube-proxy defaulting behavior. See https://v<version>.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ where <version> is represented by a <major version>-<minor version> string. Kubernetes version 1.23 would be '1-23'. + public partial class ContainerServiceNetworkProfileKubeProxyConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ContainerServiceNetworkProfileKubeProxyConfig() + { + } + + /// Initializes a new instance of . + /// Whether to enable on kube-proxy on the cluster (if no 'kubeProxyConfig' exists, kube-proxy is enabled in AKS by default without these customizations). + /// Specify which proxy mode to use ('IPTABLES' or 'IPVS'). + /// Holds configuration customizations for IPVS. May only be specified if 'mode' is set to 'IPVS'. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceNetworkProfileKubeProxyConfig(bool? enabled, Mode? mode, ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig ipvsConfig, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + Mode = mode; + IPVSConfig = ipvsConfig; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether to enable on kube-proxy on the cluster (if no 'kubeProxyConfig' exists, kube-proxy is enabled in AKS by default without these customizations). + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Specify which proxy mode to use ('IPTABLES' or 'IPVS'). + [WirePath("mode")] + public Mode? Mode { get; set; } + /// Holds configuration customizations for IPVS. May only be specified if 'mode' is set to 'IPVS'. + [WirePath("ipvsConfig")] + public ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig IPVSConfig { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig.Serialization.cs new file mode 100644 index 000000000000..c8332d9ff646 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig.Serialization.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Scheduler)) + { + writer.WritePropertyName("scheduler"u8); + writer.WriteStringValue(Scheduler.Value.ToString()); + } + if (Optional.IsDefined(TcpTimeoutSeconds)) + { + writer.WritePropertyName("tcpTimeoutSeconds"u8); + writer.WriteNumberValue(TcpTimeoutSeconds.Value); + } + if (Optional.IsDefined(TcpFinTimeoutSeconds)) + { + writer.WritePropertyName("tcpFinTimeoutSeconds"u8); + writer.WriteNumberValue(TcpFinTimeoutSeconds.Value); + } + if (Optional.IsDefined(UdpTimeoutSeconds)) + { + writer.WritePropertyName("udpTimeoutSeconds"u8); + writer.WriteNumberValue(UdpTimeoutSeconds.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceNetworkProfileKubeProxyConfigIPVSConfig(document.RootElement, options); + } + + internal static ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig DeserializeContainerServiceNetworkProfileKubeProxyConfigIPVSConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IPVSScheduler? scheduler = default; + int? tcpTimeoutSeconds = default; + int? tcpFinTimeoutSeconds = default; + int? udpTimeoutSeconds = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scheduler"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scheduler = new IPVSScheduler(property.Value.GetString()); + continue; + } + if (property.NameEquals("tcpTimeoutSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tcpTimeoutSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("tcpFinTimeoutSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tcpFinTimeoutSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("udpTimeoutSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + udpTimeoutSeconds = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig(scheduler, tcpTimeoutSeconds, tcpFinTimeoutSeconds, udpTimeoutSeconds, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Scheduler), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scheduler: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Scheduler)) + { + builder.Append(" scheduler: "); + builder.AppendLine($"'{Scheduler.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TcpTimeoutSeconds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tcpTimeoutSeconds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TcpTimeoutSeconds)) + { + builder.Append(" tcpTimeoutSeconds: "); + builder.AppendLine($"{TcpTimeoutSeconds.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TcpFinTimeoutSeconds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tcpFinTimeoutSeconds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TcpFinTimeoutSeconds)) + { + builder.Append(" tcpFinTimeoutSeconds: "); + builder.AppendLine($"{TcpFinTimeoutSeconds.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UdpTimeoutSeconds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" udpTimeoutSeconds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UdpTimeoutSeconds)) + { + builder.Append(" udpTimeoutSeconds: "); + builder.AppendLine($"{UdpTimeoutSeconds.Value}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig)} does not support writing '{options.Format}' format."); + } + } + + ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeContainerServiceNetworkProfileKubeProxyConfigIPVSConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig.cs new file mode 100644 index 000000000000..39dbe7c92293 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Holds configuration customizations for IPVS. May only be specified if 'mode' is set to 'IPVS'. + public partial class ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig() + { + } + + /// Initializes a new instance of . + /// IPVS scheduler, for more information please see http://www.linuxvirtualserver.org/docs/scheduling.html. + /// The timeout value used for idle IPVS TCP sessions in seconds. Must be a positive integer value. + /// The timeout value used for IPVS TCP sessions after receiving a FIN in seconds. Must be a positive integer value. + /// The timeout value used for IPVS UDP packets in seconds. Must be a positive integer value. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceNetworkProfileKubeProxyConfigIPVSConfig(IPVSScheduler? scheduler, int? tcpTimeoutSeconds, int? tcpFinTimeoutSeconds, int? udpTimeoutSeconds, IDictionary serializedAdditionalRawData) + { + Scheduler = scheduler; + TcpTimeoutSeconds = tcpTimeoutSeconds; + TcpFinTimeoutSeconds = tcpFinTimeoutSeconds; + UdpTimeoutSeconds = udpTimeoutSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// IPVS scheduler, for more information please see http://www.linuxvirtualserver.org/docs/scheduling.html. + [WirePath("scheduler")] + public IPVSScheduler? Scheduler { get; set; } + /// The timeout value used for idle IPVS TCP sessions in seconds. Must be a positive integer value. + [WirePath("tcpTimeoutSeconds")] + public int? TcpTimeoutSeconds { get; set; } + /// The timeout value used for IPVS TCP sessions after receiving a FIN in seconds. Must be a positive integer value. + [WirePath("tcpFinTimeoutSeconds")] + public int? TcpFinTimeoutSeconds { get; set; } + /// The timeout value used for IPVS UDP packets in seconds. Must be a positive integer value. + [WirePath("udpTimeoutSeconds")] + public int? UdpTimeoutSeconds { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSSku.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSSku.cs index 81fcdb956927..70ef8a3340f7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSSku.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSSku.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. public readonly partial struct ContainerServiceOSSku : IEquatable { private readonly string _value; @@ -23,13 +23,17 @@ public ContainerServiceOSSku(string value) } private const string UbuntuValue = "Ubuntu"; + private const string MarinerValue = "Mariner"; private const string AzureLinuxValue = "AzureLinux"; private const string CblMarinerValue = "CBLMariner"; private const string Windows2019Value = "Windows2019"; private const string Windows2022Value = "Windows2022"; + private const string WindowsAnnualValue = "WindowsAnnual"; /// Use Ubuntu as the OS for node images. public static ContainerServiceOSSku Ubuntu { get; } = new ContainerServiceOSSku(UbuntuValue); + /// Deprecated OSSKU. Microsoft recommends that new deployments choose 'AzureLinux' instead. + public static ContainerServiceOSSku Mariner { get; } = new ContainerServiceOSSku(MarinerValue); /// Use AzureLinux as the OS for node images. Azure Linux is a container-optimized Linux distro built by Microsoft, visit https://aka.ms/azurelinux for more information. public static ContainerServiceOSSku AzureLinux { get; } = new ContainerServiceOSSku(AzureLinuxValue); /// Deprecated OSSKU. Microsoft recommends that new deployments choose 'AzureLinux' instead. @@ -38,6 +42,8 @@ public ContainerServiceOSSku(string value) public static ContainerServiceOSSku Windows2019 { get; } = new ContainerServiceOSSku(Windows2019Value); /// Use Windows2022 as the OS for node images. Unsupported for system node pools. Windows2022 only supports Windows2022 containers; it cannot run Windows2019 containers and vice versa. public static ContainerServiceOSSku Windows2022 { get; } = new ContainerServiceOSSku(Windows2022Value); + /// Use Windows Annual Channel version as the OS for node images. Unsupported for system node pools. Details about supported container images and kubernetes versions under different AKS Annual Channel versions could be seen in https://aka.ms/aks/windows-annual-channel-details. + public static ContainerServiceOSSku WindowsAnnual { get; } = new ContainerServiceOSSku(WindowsAnnualValue); /// Determines if two values are the same. public static bool operator ==(ContainerServiceOSSku left, ContainerServiceOSSku right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs index 83a57bc5aa79..a606c6aa7f91 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs @@ -26,6 +26,7 @@ public ContainerServiceOutboundType(string value) private const string UserDefinedRoutingValue = "userDefinedRouting"; private const string ManagedNatGatewayValue = "managedNATGateway"; private const string UserAssignedNatGatewayValue = "userAssignedNATGateway"; + private const string NoneValue = "none"; /// The load balancer is used for egress through an AKS assigned public IP. This supports Kubernetes services of type 'loadBalancer'. For more information see [outbound type loadbalancer](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-loadbalancer). public static ContainerServiceOutboundType LoadBalancer { get; } = new ContainerServiceOutboundType(LoadBalancerValue); @@ -35,6 +36,8 @@ public ContainerServiceOutboundType(string value) public static ContainerServiceOutboundType ManagedNatGateway { get; } = new ContainerServiceOutboundType(ManagedNatGatewayValue); /// The user-assigned NAT gateway associated to the cluster subnet is used for egress. This is an advanced scenario and requires proper network configuration. public static ContainerServiceOutboundType UserAssignedNatGateway { get; } = new ContainerServiceOutboundType(UserAssignedNatGatewayValue); + /// The AKS cluster is not set with any outbound-type. All AKS nodes follows Azure VM default outbound behavior. Please refer to https://azure.microsoft.com/en-us/updates/default-outbound-access-for-vms-in-azure-will-be-retired-transition-to-a-new-method-of-internet-access/. + public static ContainerServiceOutboundType None { get; } = new ContainerServiceOutboundType(NoneValue); /// Determines if two values are the same. public static bool operator ==(ContainerServiceOutboundType left, ContainerServiceOutboundType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePublicNetworkAccess.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePublicNetworkAccess.cs index 3ccaa95a3517..590c95bdc404 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePublicNetworkAccess.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePublicNetworkAccess.cs @@ -24,11 +24,14 @@ public ContainerServicePublicNetworkAccess(string value) private const string EnabledValue = "Enabled"; private const string DisabledValue = "Disabled"; + private const string SecuredByPerimeterValue = "SecuredByPerimeter"; - /// Enabled. + /// Inbound/Outbound to the managedCluster is allowed. public static ContainerServicePublicNetworkAccess Enabled { get; } = new ContainerServicePublicNetworkAccess(EnabledValue); - /// Disabled. + /// Inbound traffic to managedCluster is disabled, traffic from managedCluster is allowed. public static ContainerServicePublicNetworkAccess Disabled { get; } = new ContainerServicePublicNetworkAccess(DisabledValue); + /// Inbound/Outbound traffic is managed by Microsoft.Network/NetworkSecurityPerimeters. + public static ContainerServicePublicNetworkAccess SecuredByPerimeter { get; } = new ContainerServicePublicNetworkAccess(SecuredByPerimeterValue); /// Determines if two values are the same. public static bool operator ==(ContainerServicePublicNetworkAccess left, ContainerServicePublicNetworkAccess right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DeletePolicy.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DeletePolicy.cs new file mode 100644 index 000000000000..e7c162f51e3b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DeletePolicy.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Delete options of a namespace. + public readonly partial struct DeletePolicy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeletePolicy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string KeepValue = "Keep"; + private const string DeleteValue = "Delete"; + + /// Only delete the ARM resource, keep the Kubernetes namespace. Also delete the ManagedByARM label. + public static DeletePolicy Keep { get; } = new DeletePolicy(KeepValue); + /// Delete both the ARM resource and the Kubernetes namespace together. + public static DeletePolicy Delete { get; } = new DeletePolicy(DeleteValue); + /// Determines if two values are the same. + public static bool operator ==(DeletePolicy left, DeletePolicy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeletePolicy left, DeletePolicy right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DeletePolicy(string value) => new DeletePolicy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeletePolicy other && Equals(other); + /// + public bool Equals(DeletePolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DriverType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DriverType.cs new file mode 100644 index 000000000000..a2d10ed31718 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DriverType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Specify the type of GPU driver to install when creating Windows agent pools. If not provided, AKS selects the driver based on system compatibility. This cannot be changed once the AgentPool has been created. This cannot be set on Linux AgentPools. For Linux AgentPools, the driver is selected based on system compatibility. + public readonly partial struct DriverType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DriverType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GridValue = "GRID"; + private const string CudaValue = "CUDA"; + + /// Install the GRID driver for the GPU, suitable for applications requiring virtualization support. + public static DriverType Grid { get; } = new DriverType(GridValue); + /// Install the CUDA driver for the GPU, optimized for computational tasks in scientific computing and data-intensive applications. + public static DriverType Cuda { get; } = new DriverType(CudaValue); + /// Determines if two values are the same. + public static bool operator ==(DriverType left, DriverType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DriverType left, DriverType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DriverType(string value) => new DriverType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DriverType other && Equals(other); + /// + public bool Equals(DriverType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuDriver.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuDriver.cs new file mode 100644 index 000000000000..6a93ccd8a853 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuDriver.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Whether to install GPU drivers. When it's not specified, default is Install. + public readonly partial struct GpuDriver : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GpuDriver(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InstallValue = "Install"; + private const string NoneValue = "None"; + + /// Install driver. + public static GpuDriver Install { get; } = new GpuDriver(InstallValue); + /// Skip driver install. + public static GpuDriver None { get; } = new GpuDriver(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(GpuDriver left, GpuDriver right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GpuDriver left, GpuDriver right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator GpuDriver(string value) => new GpuDriver(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GpuDriver other && Equals(other); + /// + public bool Equals(GpuDriver other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.Serialization.cs new file mode 100644 index 000000000000..2db50a025833 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class GpuProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GpuProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Driver)) + { + writer.WritePropertyName("driver"u8); + writer.WriteStringValue(Driver.Value.ToString()); + } + if (Optional.IsDefined(DriverType)) + { + writer.WritePropertyName("driverType"u8); + writer.WriteStringValue(DriverType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GpuProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GpuProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGpuProfile(document.RootElement, options); + } + + internal static GpuProfile DeserializeGpuProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GpuDriver? driver = default; + DriverType? driverType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("driver"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + driver = new GpuDriver(property.Value.GetString()); + continue; + } + if (property.NameEquals("driverType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + driverType = new DriverType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GpuProfile(driver, driverType, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Driver), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" driver: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Driver)) + { + builder.Append(" driver: "); + builder.AppendLine($"'{Driver.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DriverType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" driverType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DriverType)) + { + builder.Append(" driverType: "); + builder.AppendLine($"'{DriverType.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GpuProfile)} does not support writing '{options.Format}' format."); + } + } + + GpuProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGpuProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GpuProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.cs new file mode 100644 index 000000000000..dbb475be5c2a --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuProfile.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The GpuProfile. + public partial class GpuProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GpuProfile() + { + } + + /// Initializes a new instance of . + /// Whether to install GPU drivers. When it's not specified, default is Install. + /// Specify the type of GPU driver to install when creating Windows agent pools. If not provided, AKS selects the driver based on system compatibility. This cannot be changed once the AgentPool has been created. This cannot be set on Linux AgentPools. For Linux AgentPools, the driver is selected based on system compatibility. + /// Keeps track of any properties unknown to the library. + internal GpuProfile(GpuDriver? driver, DriverType? driverType, IDictionary serializedAdditionalRawData) + { + Driver = driver; + DriverType = driverType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether to install GPU drivers. When it's not specified, default is Install. + [WirePath("driver")] + public GpuDriver? Driver { get; set; } + /// Specify the type of GPU driver to install when creating Windows agent pools. If not provided, AKS selects the driver based on system compatibility. This cannot be changed once the AgentPool has been created. This cannot be set on Linux AgentPools. For Linux AgentPools, the driver is selected based on system compatibility. + [WirePath("driverType")] + public DriverType? DriverType { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsList.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsList.Serialization.cs new file mode 100644 index 000000000000..1f79f4781751 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsList.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class GuardrailsAvailableVersionsList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionsList)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GuardrailsAvailableVersionsList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionsList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGuardrailsAvailableVersionsList(document.RootElement, options); + } + + internal static GuardrailsAvailableVersionsList DeserializeGuardrailsAvailableVersionsList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GuardrailsAvailableVersionData.DeserializeGuardrailsAvailableVersionData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GuardrailsAvailableVersionsList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionsList)} does not support writing '{options.Format}' format."); + } + } + + GuardrailsAvailableVersionsList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGuardrailsAvailableVersionsList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionsList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsList.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsList.cs new file mode 100644 index 000000000000..b36b1382a962 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Hold values properties, which is array of GuardrailsVersions. + internal partial class GuardrailsAvailableVersionsList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal GuardrailsAvailableVersionsList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Array of AKS supported Guardrails versions. + /// The URL to get the next Guardrails available version. + /// Keeps track of any properties unknown to the library. + internal GuardrailsAvailableVersionsList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Array of AKS supported Guardrails versions. + public IReadOnlyList Value { get; } + /// The URL to get the next Guardrails available version. + public string NextLink { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsProperties.Serialization.cs new file mode 100644 index 000000000000..d4f709e84f6d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsProperties.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class GuardrailsAvailableVersionsProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionsProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(IsDefaultVersion)) + { + writer.WritePropertyName("isDefaultVersion"u8); + writer.WriteBooleanValue(IsDefaultVersion.Value); + } + if (options.Format != "W" && Optional.IsDefined(Support)) + { + writer.WritePropertyName("support"u8); + writer.WriteStringValue(Support.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GuardrailsAvailableVersionsProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionsProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGuardrailsAvailableVersionsProperties(document.RootElement, options); + } + + internal static GuardrailsAvailableVersionsProperties DeserializeGuardrailsAvailableVersionsProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? isDefaultVersion = default; + GuardrailsSupport? support = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("isDefaultVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDefaultVersion = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("support"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + support = new GuardrailsSupport(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GuardrailsAvailableVersionsProperties(isDefaultVersion, support, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsDefaultVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isDefaultVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsDefaultVersion)) + { + builder.Append(" isDefaultVersion: "); + var boolValue = IsDefaultVersion.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Support), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" support: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Support)) + { + builder.Append(" support: "); + builder.AppendLine($"'{Support.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionsProperties)} does not support writing '{options.Format}' format."); + } + } + + GuardrailsAvailableVersionsProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGuardrailsAvailableVersionsProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GuardrailsAvailableVersionsProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsProperties.cs new file mode 100644 index 000000000000..d7fb5c02414e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsAvailableVersionsProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Whether the version is default or not and support info. + public partial class GuardrailsAvailableVersionsProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GuardrailsAvailableVersionsProperties() + { + } + + /// Initializes a new instance of . + /// + /// Whether the version is preview or stable. + /// Keeps track of any properties unknown to the library. + internal GuardrailsAvailableVersionsProperties(bool? isDefaultVersion, GuardrailsSupport? support, IDictionary serializedAdditionalRawData) + { + IsDefaultVersion = isDefaultVersion; + Support = support; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets the is default version. + [WirePath("isDefaultVersion")] + public bool? IsDefaultVersion { get; } + /// Whether the version is preview or stable. + [WirePath("support")] + public GuardrailsSupport? Support { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsSupport.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsSupport.cs new file mode 100644 index 000000000000..21992665d94c --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GuardrailsSupport.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Whether the version is preview or stable. + public readonly partial struct GuardrailsSupport : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GuardrailsSupport(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PreviewValue = "Preview"; + private const string StableValue = "Stable"; + + /// The version is preview. It is not recommended to use preview versions on critical production clusters. The preview version may not support all use-cases. + public static GuardrailsSupport Preview { get; } = new GuardrailsSupport(PreviewValue); + /// The version is stable and can be used on critical production clusters. + public static GuardrailsSupport Stable { get; } = new GuardrailsSupport(StableValue); + /// Determines if two values are the same. + public static bool operator ==(GuardrailsSupport left, GuardrailsSupport right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GuardrailsSupport left, GuardrailsSupport right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator GuardrailsSupport(string value) => new GuardrailsSupport(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GuardrailsSupport other && Equals(other); + /// + public bool Equals(GuardrailsSupport other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IPFamily.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IPFamily.cs index f7b4e1596c14..9817d458c356 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IPFamily.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IPFamily.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// The IP version to use for cluster networking and IP assignment. + /// To determine if address belongs IPv4 or IPv6 family. public readonly partial struct IPFamily : IEquatable { private readonly string _value; @@ -25,9 +25,9 @@ public IPFamily(string value) private const string IPv4Value = "IPv4"; private const string IPv6Value = "IPv6"; - /// IPv4. + /// IPv4 family. public static IPFamily IPv4 { get; } = new IPFamily(IPv4Value); - /// IPv6. + /// IPv6 family. public static IPFamily IPv6 { get; } = new IPFamily(IPv6Value); /// Determines if two values are the same. public static bool operator ==(IPFamily left, IPFamily right) => left.Equals(right); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IPVSScheduler.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IPVSScheduler.cs new file mode 100644 index 000000000000..4968e583f6b9 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IPVSScheduler.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// IPVS scheduler, for more information please see http://www.linuxvirtualserver.org/docs/scheduling.html. + public readonly partial struct IPVSScheduler : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IPVSScheduler(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RoundRobinValue = "RoundRobin"; + private const string LeastConnectionValue = "LeastConnection"; + + /// Round Robin. + public static IPVSScheduler RoundRobin { get; } = new IPVSScheduler(RoundRobinValue); + /// Least Connection. + public static IPVSScheduler LeastConnection { get; } = new IPVSScheduler(LeastConnectionValue); + /// Determines if two values are the same. + public static bool operator ==(IPVSScheduler left, IPVSScheduler right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IPVSScheduler left, IPVSScheduler right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator IPVSScheduler(string value) => new IPVSScheduler(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IPVSScheduler other && Equals(other); + /// + public bool Equals(IPVSScheduler other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.Serialization.cs index 686b1c773dc0..b08567fa9126 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -38,16 +37,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled); - if (Optional.IsCollectionDefined(NodeSelector)) + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Namespace)) { - writer.WritePropertyName("nodeSelector"u8); - writer.WriteStartObject(); - foreach (var item in NodeSelector) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); + writer.WritePropertyName("namespace"u8); + writer.WriteStringValue(Namespace); + } + if (Optional.IsDefined(GatewayConfigurationName)) + { + writer.WritePropertyName("gatewayConfigurationName"u8); + writer.WriteStringValue(GatewayConfigurationName); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,7 +87,9 @@ internal static IstioEgressGateway DeserializeIstioEgressGateway(JsonElement ele return null; } bool enabled = default; - IDictionary nodeSelector = default; + string name = default; + string @namespace = default; + string gatewayConfigurationName = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -97,18 +99,19 @@ internal static IstioEgressGateway DeserializeIstioEgressGateway(JsonElement ele enabled = property.Value.GetBoolean(); continue; } - if (property.NameEquals("nodeSelector"u8)) + if (property.NameEquals("name"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - nodeSelector = dictionary; + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("gatewayConfigurationName"u8)) + { + gatewayConfigurationName = property.Value.GetString(); continue; } if (options.Format != "W") @@ -117,7 +120,7 @@ internal static IstioEgressGateway DeserializeIstioEgressGateway(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new IstioEgressGateway(enabled, nodeSelector ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new IstioEgressGateway(enabled, name, @namespace, gatewayConfigurationName, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -144,39 +147,71 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine($"{boolValue}"); } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeSelector), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" nodeSelector: "); + builder.Append(" name: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(NodeSelector)) + if (Optional.IsDefined(Name)) { - if (NodeSelector.Any()) + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Namespace), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" namespace: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Namespace)) + { + builder.Append(" namespace: "); + if (Namespace.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Namespace}'''"); + } + else + { + builder.AppendLine($"'{Namespace}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GatewayConfigurationName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" gatewayConfigurationName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(GatewayConfigurationName)) + { + builder.Append(" gatewayConfigurationName: "); + if (GatewayConfigurationName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{GatewayConfigurationName}'''"); + } + else { - builder.Append(" nodeSelector: "); - builder.AppendLine("{"); - foreach (var item in NodeSelector) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); + builder.AppendLine($"'{GatewayConfigurationName}'"); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs index c58b696e03c7..2767fbe47e24 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs @@ -47,20 +47,28 @@ public partial class IstioEgressGateway /// Initializes a new instance of . /// Whether to enable the egress gateway. - public IstioEgressGateway(bool isEnabled) + /// Name of the Istio add-on egress gateway. + /// is null. + public IstioEgressGateway(bool isEnabled, string name) { + Argument.AssertNotNull(name, nameof(name)); + IsEnabled = isEnabled; - NodeSelector = new ChangeTrackingDictionary(); + Name = name; } /// Initializes a new instance of . /// Whether to enable the egress gateway. - /// NodeSelector for scheduling the egress gateway. + /// Name of the Istio add-on egress gateway. + /// Namespace that the Istio add-on egress gateway should be deployed in. If unspecified, the default is aks-istio-egress. + /// Name of the gateway configuration custom resource for the Istio add-on egress gateway. Must be specified when enabling the Istio egress gateway. Must be deployed in the same namespace that the Istio egress gateway will be deployed in. /// Keeps track of any properties unknown to the library. - internal IstioEgressGateway(bool isEnabled, IDictionary nodeSelector, IDictionary serializedAdditionalRawData) + internal IstioEgressGateway(bool isEnabled, string name, string @namespace, string gatewayConfigurationName, IDictionary serializedAdditionalRawData) { IsEnabled = isEnabled; - NodeSelector = nodeSelector; + Name = name; + Namespace = @namespace; + GatewayConfigurationName = gatewayConfigurationName; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -72,8 +80,14 @@ internal IstioEgressGateway() /// Whether to enable the egress gateway. [WirePath("enabled")] public bool IsEnabled { get; set; } - /// NodeSelector for scheduling the egress gateway. - [WirePath("nodeSelector")] - public IDictionary NodeSelector { get; } + /// Name of the Istio add-on egress gateway. + [WirePath("name")] + public string Name { get; set; } + /// Namespace that the Istio add-on egress gateway should be deployed in. If unspecified, the default is aks-istio-egress. + [WirePath("namespace")] + public string Namespace { get; set; } + /// Name of the gateway configuration custom resource for the Istio add-on egress gateway. Must be specified when enabling the Istio egress gateway. Must be deployed in the same namespace that the Istio egress gateway will be deployed in. + [WirePath("gatewayConfigurationName")] + public string GatewayConfigurationName { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs index 993c1b7dc344..e1901a2fceab 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs @@ -96,6 +96,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("podMaxPids"u8); writer.WriteNumberValue(PodMaxPids.Value); } + if (Optional.IsDefined(SeccompDefault)) + { + writer.WritePropertyName("seccompDefault"u8); + writer.WriteStringValue(SeccompDefault.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -144,6 +149,7 @@ internal static KubeletConfig DeserializeKubeletConfig(JsonElement element, Mode int? containerLogMaxSizeMB = default; int? containerLogMaxFiles = default; int? podMaxPids = default; + SeccompDefault? seccompDefault = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -240,6 +246,15 @@ internal static KubeletConfig DeserializeKubeletConfig(JsonElement element, Mode podMaxPids = property.Value.GetInt32(); continue; } + if (property.NameEquals("seccompDefault"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + seccompDefault = new SeccompDefault(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -258,6 +273,7 @@ internal static KubeletConfig DeserializeKubeletConfig(JsonElement element, Mode containerLogMaxSizeMB, containerLogMaxFiles, podMaxPids, + seccompDefault, serializedAdditionalRawData); } @@ -484,6 +500,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SeccompDefault), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" seccompDefault: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SeccompDefault)) + { + builder.Append(" seccompDefault: "); + builder.AppendLine($"'{SeccompDefault.Value.ToString()}'"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs index 33c4ce6a4b1b..407767131062 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs @@ -63,8 +63,9 @@ public KubeletConfig() /// The maximum size (e.g. 10Mi) of container log file before it is rotated. /// The maximum number of container log files that can be present for a container. The number must be ≥ 2. /// The maximum number of processes per pod. + /// Specifies the default seccomp profile applied to all workloads. If not specified, 'Unconfined' will be used by default. /// Keeps track of any properties unknown to the library. - internal KubeletConfig(string cpuManagerPolicy, bool? isCpuCfsQuotaEnabled, string cpuCfsQuotaPeriod, int? imageGcHighThreshold, int? imageGcLowThreshold, string topologyManagerPolicy, IList allowedUnsafeSysctls, bool? failStartWithSwapOn, int? containerLogMaxSizeInMB, int? containerLogMaxFiles, int? podMaxPids, IDictionary serializedAdditionalRawData) + internal KubeletConfig(string cpuManagerPolicy, bool? isCpuCfsQuotaEnabled, string cpuCfsQuotaPeriod, int? imageGcHighThreshold, int? imageGcLowThreshold, string topologyManagerPolicy, IList allowedUnsafeSysctls, bool? failStartWithSwapOn, int? containerLogMaxSizeInMB, int? containerLogMaxFiles, int? podMaxPids, SeccompDefault? seccompDefault, IDictionary serializedAdditionalRawData) { CpuManagerPolicy = cpuManagerPolicy; IsCpuCfsQuotaEnabled = isCpuCfsQuotaEnabled; @@ -77,6 +78,7 @@ internal KubeletConfig(string cpuManagerPolicy, bool? isCpuCfsQuotaEnabled, stri ContainerLogMaxSizeInMB = containerLogMaxSizeInMB; ContainerLogMaxFiles = containerLogMaxFiles; PodMaxPids = podMaxPids; + SeccompDefault = seccompDefault; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -113,5 +115,8 @@ internal KubeletConfig(string cpuManagerPolicy, bool? isCpuCfsQuotaEnabled, stri /// The maximum number of processes per pod. [WirePath("podMaxPids")] public int? PodMaxPids { get; set; } + /// Specifies the default seccomp profile applied to all workloads. If not specified, 'Unconfined' will be used by default. + [WirePath("seccompDefault")] + public SeccompDefault? SeccompDefault { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs index 82648bb9b64e..7fdf4eb2d2e5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs @@ -46,6 +46,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("capabilities"u8); writer.WriteObjectValue(Capabilities, options); } + if (Optional.IsDefined(IsDefault)) + { + writer.WritePropertyName("isDefault"u8); + writer.WriteBooleanValue(IsDefault.Value); + } if (Optional.IsDefined(IsPreview)) { writer.WritePropertyName("isPreview"u8); @@ -101,6 +106,7 @@ internal static KubernetesVersion DeserializeKubernetesVersion(JsonElement eleme } string version = default; KubernetesVersionCapabilities capabilities = default; + bool? isDefault = default; bool? isPreview = default; IReadOnlyDictionary patchVersions = default; IDictionary serializedAdditionalRawData = default; @@ -121,6 +127,15 @@ internal static KubernetesVersion DeserializeKubernetesVersion(JsonElement eleme capabilities = KubernetesVersionCapabilities.DeserializeKubernetesVersionCapabilities(property.Value, options); continue; } + if (property.NameEquals("isDefault"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDefault = property.Value.GetBoolean(); + continue; + } if (property.NameEquals("isPreview"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -150,7 +165,13 @@ internal static KubernetesVersion DeserializeKubernetesVersion(JsonElement eleme } } serializedAdditionalRawData = rawDataDictionary; - return new KubernetesVersion(version, capabilities, isPreview, patchVersions ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new KubernetesVersion( + version, + capabilities, + isDefault, + isPreview, + patchVersions ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -205,6 +226,22 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsDefault), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isDefault: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsDefault)) + { + builder.Append(" isDefault: "); + var boolValue = IsDefault.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsPreview), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs index 1eedcc878d7c..b7a4c82e4848 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs @@ -54,13 +54,15 @@ internal KubernetesVersion() /// Initializes a new instance of . /// major.minor version of Kubernetes release. /// Capabilities on this Kubernetes version. + /// Whether this version is default. /// Whether this version is in preview mode. /// Patch versions of Kubernetes release. /// Keeps track of any properties unknown to the library. - internal KubernetesVersion(string version, KubernetesVersionCapabilities capabilities, bool? isPreview, IReadOnlyDictionary patchVersions, IDictionary serializedAdditionalRawData) + internal KubernetesVersion(string version, KubernetesVersionCapabilities capabilities, bool? isDefault, bool? isPreview, IReadOnlyDictionary patchVersions, IDictionary serializedAdditionalRawData) { Version = version; Capabilities = capabilities; + IsDefault = isDefault; IsPreview = isPreview; PatchVersions = patchVersions; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -78,6 +80,9 @@ public IReadOnlyList CapabilitiesSupportPlan get => Capabilities?.SupportPlan; } + /// Whether this version is default. + [WirePath("isDefault")] + public bool? IsDefault { get; } /// Whether this version is in preview mode. [WirePath("isPreview")] public bool? IsPreview { get; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelector.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelector.Serialization.cs new file mode 100644 index 000000000000..a82e27da447d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelector.Serialization.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class LabelSelector : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LabelSelector)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(MatchLabels)) + { + writer.WritePropertyName("matchLabels"u8); + writer.WriteStartArray(); + foreach (var item in MatchLabels) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MatchExpressions)) + { + writer.WritePropertyName("matchExpressions"u8); + writer.WriteStartArray(); + foreach (var item in MatchExpressions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LabelSelector IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LabelSelector)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLabelSelector(document.RootElement, options); + } + + internal static LabelSelector DeserializeLabelSelector(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList matchLabels = default; + IList matchExpressions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("matchLabels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + matchLabels = array; + continue; + } + if (property.NameEquals("matchExpressions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LabelSelectorRequirement.DeserializeLabelSelectorRequirement(item, options)); + } + matchExpressions = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LabelSelector(matchLabels ?? new ChangeTrackingList(), matchExpressions ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MatchLabels), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" matchLabels: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(MatchLabels)) + { + if (MatchLabels.Any()) + { + builder.Append(" matchLabels: "); + builder.AppendLine("["); + foreach (var item in MatchLabels) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MatchExpressions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" matchExpressions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(MatchExpressions)) + { + if (MatchExpressions.Any()) + { + builder.Append(" matchExpressions: "); + builder.AppendLine("["); + foreach (var item in MatchExpressions) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " matchExpressions: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(LabelSelector)} does not support writing '{options.Format}' format."); + } + } + + LabelSelector IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLabelSelector(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LabelSelector)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelector.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelector.cs new file mode 100644 index 000000000000..5ae2cdd69cb1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelector.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + public partial class LabelSelector + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LabelSelector() + { + MatchLabels = new ChangeTrackingList(); + MatchExpressions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// matchLabels is an array of {key=value} pairs. A single {key=value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is `key`, the operator is `In`, and the values array contains only `value`. The requirements are ANDed. + /// matchExpressions is a list of label selector requirements. The requirements are ANDed. + /// Keeps track of any properties unknown to the library. + internal LabelSelector(IList matchLabels, IList matchExpressions, IDictionary serializedAdditionalRawData) + { + MatchLabels = matchLabels; + MatchExpressions = matchExpressions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// matchLabels is an array of {key=value} pairs. A single {key=value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is `key`, the operator is `In`, and the values array contains only `value`. The requirements are ANDed. + [WirePath("matchLabels")] + public IList MatchLabels { get; } + /// matchExpressions is a list of label selector requirements. The requirements are ANDed. + [WirePath("matchExpressions")] + public IList MatchExpressions { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelectorRequirement.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelectorRequirement.Serialization.cs new file mode 100644 index 000000000000..dbaada4af9cf --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelectorRequirement.Serialization.cs @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class LabelSelectorRequirement : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LabelSelectorRequirement)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + if (Optional.IsDefined(Operator)) + { + writer.WritePropertyName("operator"u8); + writer.WriteStringValue(Operator.Value.ToString()); + } + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LabelSelectorRequirement IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LabelSelectorRequirement)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLabelSelectorRequirement(document.RootElement, options); + } + + internal static LabelSelectorRequirement DeserializeLabelSelectorRequirement(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + Operator? @operator = default; + IList values = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("operator"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + @operator = new Operator(property.Value.GetString()); + continue; + } + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LabelSelectorRequirement(key, @operator, values ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Key), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" key: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Key)) + { + builder.Append(" key: "); + if (Key.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Key}'''"); + } + else + { + builder.AppendLine($"'{Key}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Operator), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" operator: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Operator)) + { + builder.Append(" operator: "); + builder.AppendLine($"'{Operator.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Values), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" values: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Values)) + { + if (Values.Any()) + { + builder.Append(" values: "); + builder.AppendLine("["); + foreach (var item in Values) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(LabelSelectorRequirement)} does not support writing '{options.Format}' format."); + } + } + + LabelSelectorRequirement IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLabelSelectorRequirement(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LabelSelectorRequirement)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelectorRequirement.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelectorRequirement.cs new file mode 100644 index 000000000000..e578881a0e72 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LabelSelectorRequirement.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + public partial class LabelSelectorRequirement + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LabelSelectorRequirement() + { + Values = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// key is the label key that the selector applies to. + /// operator represents a key's relationship to a set of values. Valid operators are In and NotIn. + /// values is an array of string values, the values array must be non-empty. + /// Keeps track of any properties unknown to the library. + internal LabelSelectorRequirement(string key, Operator? @operator, IList values, IDictionary serializedAdditionalRawData) + { + Key = key; + Operator = @operator; + Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// key is the label key that the selector applies to. + [WirePath("key")] + public string Key { get; set; } + /// operator represents a key's relationship to a set of values. Valid operators are In and NotIn. + [WirePath("operator")] + public Operator? Operator { get; set; } + /// values is an array of string values, the values array must be non-empty. + [WirePath("values")] + public IList Values { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Level.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Level.cs new file mode 100644 index 000000000000..4d21d0ab7e31 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Level.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The Safeguards level to be used. By default, Safeguards is enabled for all namespaces except those that AKS excludes via systemExcludedNamespaces. + public readonly partial struct Level : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Level(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OffValue = "Off"; + private const string WarningValue = "Warning"; + private const string EnforcementValue = "Enforcement"; + + /// Off. + public static Level Off { get; } = new Level(OffValue); + /// Warning. + public static Level Warning { get; } = new Level(WarningValue); + /// Enforcement. + public static Level Enforcement { get; } = new Level(EnforcementValue); + /// Determines if two values are the same. + public static bool operator ==(Level left, Level right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Level left, Level right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Level(string value) => new Level(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Level other && Equals(other); + /// + public bool Equals(Level other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LoadBalancerListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LoadBalancerListResult.Serialization.cs new file mode 100644 index 000000000000..78b36f2a587e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LoadBalancerListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class LoadBalancerListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadBalancerListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LoadBalancerListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LoadBalancerListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLoadBalancerListResult(document.RootElement, options); + } + + internal static LoadBalancerListResult DeserializeLoadBalancerListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LoadBalancerData.DeserializeLoadBalancerData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LoadBalancerListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(LoadBalancerListResult)} does not support writing '{options.Format}' format."); + } + } + + LoadBalancerListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLoadBalancerListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LoadBalancerListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LoadBalancerListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LoadBalancerListResult.cs new file mode 100644 index 000000000000..82e6ddeb1245 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LoadBalancerListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The response from the List Load Balancers operation. + internal partial class LoadBalancerListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal LoadBalancerListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of Load Balancers. + /// The URL to get the next set of load balancer results. + /// Keeps track of any properties unknown to the library. + internal LoadBalancerListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The list of Load Balancers. + public IReadOnlyList Value { get; } + /// The URL to get the next set of load balancer results. + public string NextLink { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsForwardDestination.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsForwardDestination.cs new file mode 100644 index 000000000000..2abb8c7fbf44 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsForwardDestination.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Destination server for DNS queries to be forwarded from localDNS. + public readonly partial struct LocalDnsForwardDestination : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LocalDnsForwardDestination(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ClusterCoreDnsValue = "ClusterCoreDNS"; + private const string VnetDnsValue = "VnetDNS"; + + /// Forward DNS queries from localDNS to cluster CoreDNS. + public static LocalDnsForwardDestination ClusterCoreDns { get; } = new LocalDnsForwardDestination(ClusterCoreDnsValue); + /// Forward DNS queries from localDNS to DNS server configured in the VNET. A VNET can have multiple DNS servers configured. + public static LocalDnsForwardDestination VnetDns { get; } = new LocalDnsForwardDestination(VnetDnsValue); + /// Determines if two values are the same. + public static bool operator ==(LocalDnsForwardDestination left, LocalDnsForwardDestination right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LocalDnsForwardDestination left, LocalDnsForwardDestination right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LocalDnsForwardDestination(string value) => new LocalDnsForwardDestination(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LocalDnsForwardDestination other && Equals(other); + /// + public bool Equals(LocalDnsForwardDestination other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsForwardPolicy.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsForwardPolicy.cs new file mode 100644 index 000000000000..f9469ad589fb --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsForwardPolicy.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Forward policy for selecting upstream DNS server. See [forward plugin](https://coredns.io/plugins/forward) for more information. + public readonly partial struct LocalDnsForwardPolicy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LocalDnsForwardPolicy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SequentialValue = "Sequential"; + private const string RoundRobinValue = "RoundRobin"; + private const string RandomValue = "Random"; + + /// Implements sequential upstream DNS server selection. See [forward plugin](https://coredns.io/plugins/forward) for more information. + public static LocalDnsForwardPolicy Sequential { get; } = new LocalDnsForwardPolicy(SequentialValue); + /// Implements round robin upstream DNS server selection. See [forward plugin](https://coredns.io/plugins/forward) for more information. + public static LocalDnsForwardPolicy RoundRobin { get; } = new LocalDnsForwardPolicy(RoundRobinValue); + /// Implements random upstream DNS server selection. See [forward plugin](https://coredns.io/plugins/forward) for more information. + public static LocalDnsForwardPolicy Random { get; } = new LocalDnsForwardPolicy(RandomValue); + /// Determines if two values are the same. + public static bool operator ==(LocalDnsForwardPolicy left, LocalDnsForwardPolicy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LocalDnsForwardPolicy left, LocalDnsForwardPolicy right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LocalDnsForwardPolicy(string value) => new LocalDnsForwardPolicy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LocalDnsForwardPolicy other && Equals(other); + /// + public bool Equals(LocalDnsForwardPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsMode.cs new file mode 100644 index 000000000000..4b5b87a2a1df --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsMode.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Mode of enablement for localDNS. + public readonly partial struct LocalDnsMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LocalDnsMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PreferredValue = "Preferred"; + private const string RequiredValue = "Required"; + private const string DisabledValue = "Disabled"; + + /// If the current orchestrator version supports this feature, prefer enabling localDNS. + public static LocalDnsMode Preferred { get; } = new LocalDnsMode(PreferredValue); + /// Enable localDNS. + public static LocalDnsMode Required { get; } = new LocalDnsMode(RequiredValue); + /// Disable localDNS. + public static LocalDnsMode Disabled { get; } = new LocalDnsMode(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(LocalDnsMode left, LocalDnsMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LocalDnsMode left, LocalDnsMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LocalDnsMode(string value) => new LocalDnsMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LocalDnsMode other && Equals(other); + /// + public bool Equals(LocalDnsMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsOverrides.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsOverrides.Serialization.cs new file mode 100644 index 000000000000..b7325ce6bab7 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsOverrides.Serialization.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class LocalDnsOverrides : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LocalDnsOverrides)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(QueryLogging)) + { + writer.WritePropertyName("queryLogging"u8); + writer.WriteStringValue(QueryLogging.Value.ToString()); + } + if (Optional.IsDefined(Protocol)) + { + writer.WritePropertyName("protocol"u8); + writer.WriteStringValue(Protocol.Value.ToString()); + } + if (Optional.IsDefined(ForwardDestination)) + { + writer.WritePropertyName("forwardDestination"u8); + writer.WriteStringValue(ForwardDestination.Value.ToString()); + } + if (Optional.IsDefined(ForwardPolicy)) + { + writer.WritePropertyName("forwardPolicy"u8); + writer.WriteStringValue(ForwardPolicy.Value.ToString()); + } + if (Optional.IsDefined(MaxConcurrent)) + { + writer.WritePropertyName("maxConcurrent"u8); + writer.WriteNumberValue(MaxConcurrent.Value); + } + if (Optional.IsDefined(CacheDurationInSeconds)) + { + writer.WritePropertyName("cacheDurationInSeconds"u8); + writer.WriteNumberValue(CacheDurationInSeconds.Value); + } + if (Optional.IsDefined(ServeStaleDurationInSeconds)) + { + writer.WritePropertyName("serveStaleDurationInSeconds"u8); + writer.WriteNumberValue(ServeStaleDurationInSeconds.Value); + } + if (Optional.IsDefined(ServeStale)) + { + writer.WritePropertyName("serveStale"u8); + writer.WriteStringValue(ServeStale.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LocalDnsOverrides IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LocalDnsOverrides)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLocalDnsOverrides(document.RootElement, options); + } + + internal static LocalDnsOverrides DeserializeLocalDnsOverrides(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LocalDnsQueryLogging? queryLogging = default; + LocalDnsProtocol? protocol = default; + LocalDnsForwardDestination? forwardDestination = default; + LocalDnsForwardPolicy? forwardPolicy = default; + int? maxConcurrent = default; + int? cacheDurationInSeconds = default; + int? serveStaleDurationInSeconds = default; + LocalDnsServeStale? serveStale = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("queryLogging"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + queryLogging = new LocalDnsQueryLogging(property.Value.GetString()); + continue; + } + if (property.NameEquals("protocol"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocol = new LocalDnsProtocol(property.Value.GetString()); + continue; + } + if (property.NameEquals("forwardDestination"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forwardDestination = new LocalDnsForwardDestination(property.Value.GetString()); + continue; + } + if (property.NameEquals("forwardPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forwardPolicy = new LocalDnsForwardPolicy(property.Value.GetString()); + continue; + } + if (property.NameEquals("maxConcurrent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxConcurrent = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("cacheDurationInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cacheDurationInSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("serveStaleDurationInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serveStaleDurationInSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("serveStale"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serveStale = new LocalDnsServeStale(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LocalDnsOverrides( + queryLogging, + protocol, + forwardDestination, + forwardPolicy, + maxConcurrent, + cacheDurationInSeconds, + serveStaleDurationInSeconds, + serveStale, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QueryLogging), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" queryLogging: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(QueryLogging)) + { + builder.Append(" queryLogging: "); + builder.AppendLine($"'{QueryLogging.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Protocol), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" protocol: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Protocol)) + { + builder.Append(" protocol: "); + builder.AppendLine($"'{Protocol.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ForwardDestination), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" forwardDestination: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ForwardDestination)) + { + builder.Append(" forwardDestination: "); + builder.AppendLine($"'{ForwardDestination.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ForwardPolicy), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" forwardPolicy: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ForwardPolicy)) + { + builder.Append(" forwardPolicy: "); + builder.AppendLine($"'{ForwardPolicy.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxConcurrent), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxConcurrent: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaxConcurrent)) + { + builder.Append(" maxConcurrent: "); + builder.AppendLine($"{MaxConcurrent.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CacheDurationInSeconds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" cacheDurationInSeconds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CacheDurationInSeconds)) + { + builder.Append(" cacheDurationInSeconds: "); + builder.AppendLine($"{CacheDurationInSeconds.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServeStaleDurationInSeconds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" serveStaleDurationInSeconds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ServeStaleDurationInSeconds)) + { + builder.Append(" serveStaleDurationInSeconds: "); + builder.AppendLine($"{ServeStaleDurationInSeconds.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServeStale), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" serveStale: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ServeStale)) + { + builder.Append(" serveStale: "); + builder.AppendLine($"'{ServeStale.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(LocalDnsOverrides)} does not support writing '{options.Format}' format."); + } + } + + LocalDnsOverrides IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLocalDnsOverrides(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LocalDnsOverrides)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsOverrides.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsOverrides.cs new file mode 100644 index 000000000000..7370c8088580 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsOverrides.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Overrides for localDNS profile. + public partial class LocalDnsOverrides + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LocalDnsOverrides() + { + } + + /// Initializes a new instance of . + /// Log level for DNS queries in localDNS. + /// Enforce TCP or prefer UDP protocol for connections from localDNS to upstream DNS server. + /// Destination server for DNS queries to be forwarded from localDNS. + /// Forward policy for selecting upstream DNS server. See [forward plugin](https://coredns.io/plugins/forward) for more information. + /// Maximum number of concurrent queries. See [forward plugin](https://coredns.io/plugins/forward) for more information. + /// Cache max TTL in seconds. See [cache plugin](https://coredns.io/plugins/cache) for more information. + /// Serve stale duration in seconds. See [cache plugin](https://coredns.io/plugins/cache) for more information. + /// Policy for serving stale data. See [cache plugin](https://coredns.io/plugins/cache) for more information. + /// Keeps track of any properties unknown to the library. + internal LocalDnsOverrides(LocalDnsQueryLogging? queryLogging, LocalDnsProtocol? protocol, LocalDnsForwardDestination? forwardDestination, LocalDnsForwardPolicy? forwardPolicy, int? maxConcurrent, int? cacheDurationInSeconds, int? serveStaleDurationInSeconds, LocalDnsServeStale? serveStale, IDictionary serializedAdditionalRawData) + { + QueryLogging = queryLogging; + Protocol = protocol; + ForwardDestination = forwardDestination; + ForwardPolicy = forwardPolicy; + MaxConcurrent = maxConcurrent; + CacheDurationInSeconds = cacheDurationInSeconds; + ServeStaleDurationInSeconds = serveStaleDurationInSeconds; + ServeStale = serveStale; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Log level for DNS queries in localDNS. + [WirePath("queryLogging")] + public LocalDnsQueryLogging? QueryLogging { get; set; } + /// Enforce TCP or prefer UDP protocol for connections from localDNS to upstream DNS server. + [WirePath("protocol")] + public LocalDnsProtocol? Protocol { get; set; } + /// Destination server for DNS queries to be forwarded from localDNS. + [WirePath("forwardDestination")] + public LocalDnsForwardDestination? ForwardDestination { get; set; } + /// Forward policy for selecting upstream DNS server. See [forward plugin](https://coredns.io/plugins/forward) for more information. + [WirePath("forwardPolicy")] + public LocalDnsForwardPolicy? ForwardPolicy { get; set; } + /// Maximum number of concurrent queries. See [forward plugin](https://coredns.io/plugins/forward) for more information. + [WirePath("maxConcurrent")] + public int? MaxConcurrent { get; set; } + /// Cache max TTL in seconds. See [cache plugin](https://coredns.io/plugins/cache) for more information. + [WirePath("cacheDurationInSeconds")] + public int? CacheDurationInSeconds { get; set; } + /// Serve stale duration in seconds. See [cache plugin](https://coredns.io/plugins/cache) for more information. + [WirePath("serveStaleDurationInSeconds")] + public int? ServeStaleDurationInSeconds { get; set; } + /// Policy for serving stale data. See [cache plugin](https://coredns.io/plugins/cache) for more information. + [WirePath("serveStale")] + public LocalDnsServeStale? ServeStale { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsProfile.Serialization.cs new file mode 100644 index 000000000000..2593dfcb3778 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsProfile.Serialization.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class LocalDnsProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LocalDnsProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(VnetDnsOverrides)) + { + writer.WritePropertyName("vnetDNSOverrides"u8); + writer.WriteObjectValue(VnetDnsOverrides, options); + } + if (Optional.IsDefined(KubeDnsOverrides)) + { + writer.WritePropertyName("kubeDNSOverrides"u8); + writer.WriteObjectValue(KubeDnsOverrides, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LocalDnsProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LocalDnsProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLocalDnsProfile(document.RootElement, options); + } + + internal static LocalDnsProfile DeserializeLocalDnsProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LocalDnsMode? mode = default; + LocalDnsState? state = default; + LocalDnsOverrides vnetDnsOverrides = default; + LocalDnsOverrides kubeDnsOverrides = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new LocalDnsMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new LocalDnsState(property.Value.GetString()); + continue; + } + if (property.NameEquals("vnetDNSOverrides"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vnetDnsOverrides = LocalDnsOverrides.DeserializeLocalDnsOverrides(property.Value, options); + continue; + } + if (property.NameEquals("kubeDNSOverrides"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kubeDnsOverrides = LocalDnsOverrides.DeserializeLocalDnsOverrides(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LocalDnsProfile(mode, state, vnetDnsOverrides, kubeDnsOverrides, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Mode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" mode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Mode)) + { + builder.Append(" mode: "); + builder.AppendLine($"'{Mode.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(State), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" state: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(State)) + { + builder.Append(" state: "); + builder.AppendLine($"'{State.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VnetDnsOverrides), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vnetDNSOverrides: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VnetDnsOverrides)) + { + builder.Append(" vnetDNSOverrides: "); + BicepSerializationHelpers.AppendChildObject(builder, VnetDnsOverrides, options, 2, false, " vnetDNSOverrides: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeDnsOverrides), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kubeDNSOverrides: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(KubeDnsOverrides)) + { + builder.Append(" kubeDNSOverrides: "); + BicepSerializationHelpers.AppendChildObject(builder, KubeDnsOverrides, options, 2, false, " kubeDNSOverrides: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(LocalDnsProfile)} does not support writing '{options.Format}' format."); + } + } + + LocalDnsProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLocalDnsProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LocalDnsProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsProfile.cs new file mode 100644 index 000000000000..6bb335827da0 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsProfile.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Configures the per-node local DNS, with VnetDNS and KubeDNS overrides. LocalDNS helps improve performance and reliability of DNS resolution in an AKS cluster. For more details see aka.ms/aks/localdns. + public partial class LocalDnsProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LocalDnsProfile() + { + } + + /// Initializes a new instance of . + /// Mode of enablement for localDNS. + /// System-generated state of localDNS. + /// VnetDNS overrides apply to DNS traffic from pods with dnsPolicy:default or kubelet (referred to as VnetDNS traffic). + /// KubeDNS overrides apply to DNS traffic from pods with dnsPolicy:ClusterFirst (referred to as KubeDNS traffic). + /// Keeps track of any properties unknown to the library. + internal LocalDnsProfile(LocalDnsMode? mode, LocalDnsState? state, LocalDnsOverrides vnetDnsOverrides, LocalDnsOverrides kubeDnsOverrides, IDictionary serializedAdditionalRawData) + { + Mode = mode; + State = state; + VnetDnsOverrides = vnetDnsOverrides; + KubeDnsOverrides = kubeDnsOverrides; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Mode of enablement for localDNS. + [WirePath("mode")] + public LocalDnsMode? Mode { get; set; } + /// System-generated state of localDNS. + [WirePath("state")] + public LocalDnsState? State { get; } + /// VnetDNS overrides apply to DNS traffic from pods with dnsPolicy:default or kubelet (referred to as VnetDNS traffic). + [WirePath("vnetDNSOverrides")] + public LocalDnsOverrides VnetDnsOverrides { get; set; } + /// KubeDNS overrides apply to DNS traffic from pods with dnsPolicy:ClusterFirst (referred to as KubeDNS traffic). + [WirePath("kubeDNSOverrides")] + public LocalDnsOverrides KubeDnsOverrides { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsProtocol.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsProtocol.cs new file mode 100644 index 000000000000..3dbb9a6f15ca --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsProtocol.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Enforce TCP or prefer UDP protocol for connections from localDNS to upstream DNS server. + public readonly partial struct LocalDnsProtocol : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LocalDnsProtocol(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PreferUdpValue = "PreferUDP"; + private const string ForceTcpValue = "ForceTCP"; + + /// Prefer UDP protocol for connections from localDNS to upstream DNS server. + public static LocalDnsProtocol PreferUdp { get; } = new LocalDnsProtocol(PreferUdpValue); + /// Enforce TCP protocol for connections from localDNS to upstream DNS server. + public static LocalDnsProtocol ForceTcp { get; } = new LocalDnsProtocol(ForceTcpValue); + /// Determines if two values are the same. + public static bool operator ==(LocalDnsProtocol left, LocalDnsProtocol right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LocalDnsProtocol left, LocalDnsProtocol right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LocalDnsProtocol(string value) => new LocalDnsProtocol(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LocalDnsProtocol other && Equals(other); + /// + public bool Equals(LocalDnsProtocol other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsQueryLogging.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsQueryLogging.cs new file mode 100644 index 000000000000..b2519ef1d123 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsQueryLogging.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Log level for DNS queries in localDNS. + public readonly partial struct LocalDnsQueryLogging : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LocalDnsQueryLogging(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ErrorValue = "Error"; + private const string LogValue = "Log"; + + /// Enables error logging in localDNS. See [errors plugin](https://coredns.io/plugins/errors) for more information. + public static LocalDnsQueryLogging Error { get; } = new LocalDnsQueryLogging(ErrorValue); + /// Enables query logging in localDNS. See [log plugin](https://coredns.io/plugins/log) for more information. + public static LocalDnsQueryLogging Log { get; } = new LocalDnsQueryLogging(LogValue); + /// Determines if two values are the same. + public static bool operator ==(LocalDnsQueryLogging left, LocalDnsQueryLogging right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LocalDnsQueryLogging left, LocalDnsQueryLogging right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LocalDnsQueryLogging(string value) => new LocalDnsQueryLogging(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LocalDnsQueryLogging other && Equals(other); + /// + public bool Equals(LocalDnsQueryLogging other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsServeStale.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsServeStale.cs new file mode 100644 index 000000000000..a8f681fc6655 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsServeStale.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Policy for serving stale data. See [cache plugin](https://coredns.io/plugins/cache) for more information. + public readonly partial struct LocalDnsServeStale : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LocalDnsServeStale(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string VerifyValue = "Verify"; + private const string ImmediateValue = "Immediate"; + private const string DisableValue = "Disable"; + + /// Serve stale data with verification. First verify that an entry is still unavailable from the source before sending the expired entry to the client. See [cache plugin](https://coredns.io/plugins/cache) for more information. + public static LocalDnsServeStale Verify { get; } = new LocalDnsServeStale(VerifyValue); + /// Serve stale data immediately. Send the expired entry to the client before checking to see if the entry is available from the source. See [cache plugin](https://coredns.io/plugins/cache) for more information. + public static LocalDnsServeStale Immediate { get; } = new LocalDnsServeStale(ImmediateValue); + /// Disable serving stale data. + public static LocalDnsServeStale Disable { get; } = new LocalDnsServeStale(DisableValue); + /// Determines if two values are the same. + public static bool operator ==(LocalDnsServeStale left, LocalDnsServeStale right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LocalDnsServeStale left, LocalDnsServeStale right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LocalDnsServeStale(string value) => new LocalDnsServeStale(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LocalDnsServeStale other && Equals(other); + /// + public bool Equals(LocalDnsServeStale other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsState.cs new file mode 100644 index 000000000000..4058f77e130f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LocalDnsState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// System-generated state of localDNS. + public readonly partial struct LocalDnsState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LocalDnsState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// localDNS is enabled. + public static LocalDnsState Enabled { get; } = new LocalDnsState(EnabledValue); + /// localDNS is disabled. + public static LocalDnsState Disabled { get; } = new LocalDnsState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(LocalDnsState left, LocalDnsState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LocalDnsState left, LocalDnsState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LocalDnsState(string value) => new LocalDnsState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LocalDnsState other && Equals(other); + /// + public bool Equals(LocalDnsState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.Serialization.cs new file mode 100644 index 000000000000..e0e0e8ec1b0c --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class MachineIPAddress : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineIPAddress)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Family)) + { + writer.WritePropertyName("family"u8); + writer.WriteStringValue(Family.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(IP)) + { + writer.WritePropertyName("ip"u8); + writer.WriteStringValue(IP); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MachineIPAddress IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineIPAddress)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMachineIPAddress(document.RootElement, options); + } + + internal static MachineIPAddress DeserializeMachineIPAddress(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IPFamily? family = default; + string ip = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("family"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + family = new IPFamily(property.Value.GetString()); + continue; + } + if (property.NameEquals("ip"u8)) + { + ip = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MachineIPAddress(family, ip, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Family), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" family: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Family)) + { + builder.Append(" family: "); + builder.AppendLine($"'{Family.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ip: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IP)) + { + builder.Append(" ip: "); + if (IP.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{IP}'''"); + } + else + { + builder.AppendLine($"'{IP}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(MachineIPAddress)} does not support writing '{options.Format}' format."); + } + } + + MachineIPAddress IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMachineIPAddress(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MachineIPAddress)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.cs new file mode 100644 index 000000000000..a23d7fb7aa6a --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineIPAddress.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The machine IP address details. + public partial class MachineIPAddress + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MachineIPAddress() + { + } + + /// Initializes a new instance of . + /// To determine if address belongs IPv4 or IPv6 family. + /// IPv4 or IPv6 address of the machine. + /// Keeps track of any properties unknown to the library. + internal MachineIPAddress(IPFamily? family, string ip, IDictionary serializedAdditionalRawData) + { + Family = family; + IP = ip; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// To determine if address belongs IPv4 or IPv6 family. + [WirePath("family")] + public IPFamily? Family { get; } + /// IPv4 or IPv6 address of the machine. + [WirePath("ip")] + public string IP { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.Serialization.cs new file mode 100644 index 000000000000..726a4fe5f851 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class MachineListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MachineListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMachineListResult(document.RootElement, options); + } + + internal static MachineListResult DeserializeMachineListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MachineData.DeserializeMachineData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MachineListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(MachineListResult)} does not support writing '{options.Format}' format."); + } + } + + MachineListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMachineListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MachineListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.cs new file mode 100644 index 000000000000..95e8dcf44ef1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The response from the List Machines operation. + internal partial class MachineListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MachineListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of Machines in cluster. + /// The URL to get the next set of machine results. + /// Keeps track of any properties unknown to the library. + internal MachineListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The list of Machines in cluster. + public IReadOnlyList Value { get; } + /// The URL to get the next set of machine results. + public Uri NextLink { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.Serialization.cs new file mode 100644 index 000000000000..a2b3660419d7 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.Serialization.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class MachineNetworkProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineNetworkProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsCollectionDefined(IPAddresses)) + { + writer.WritePropertyName("ipAddresses"u8); + writer.WriteStartArray(); + foreach (var item in IPAddresses) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MachineNetworkProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineNetworkProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMachineNetworkProperties(document.RootElement, options); + } + + internal static MachineNetworkProperties DeserializeMachineNetworkProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList ipAddresses = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MachineIPAddress.DeserializeMachineIPAddress(item, options)); + } + ipAddresses = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MachineNetworkProperties(ipAddresses ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IPAddresses), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ipAddresses: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(IPAddresses)) + { + if (IPAddresses.Any()) + { + builder.Append(" ipAddresses: "); + builder.AppendLine("["); + foreach (var item in IPAddresses) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " ipAddresses: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(MachineNetworkProperties)} does not support writing '{options.Format}' format."); + } + } + + MachineNetworkProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMachineNetworkProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MachineNetworkProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.cs new file mode 100644 index 000000000000..1e7ac382e543 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineNetworkProperties.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// network properties of the machine. + internal partial class MachineNetworkProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MachineNetworkProperties() + { + IPAddresses = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// IPv4, IPv6 addresses of the machine. + /// Keeps track of any properties unknown to the library. + internal MachineNetworkProperties(IReadOnlyList ipAddresses, IDictionary serializedAdditionalRawData) + { + IPAddresses = ipAddresses; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// IPv4, IPv6 addresses of the machine. + [WirePath("ipAddresses")] + public IReadOnlyList IPAddresses { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.Serialization.cs new file mode 100644 index 000000000000..7dc4dceec42d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class MachineProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Network)) + { + writer.WritePropertyName("network"u8); + writer.WriteObjectValue(Network, options); + } + if (options.Format != "W" && Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MachineProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MachineProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMachineProperties(document.RootElement, options); + } + + internal static MachineProperties DeserializeMachineProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MachineNetworkProperties network = default; + ResourceIdentifier resourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("network"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + network = MachineNetworkProperties.DeserializeMachineNetworkProperties(property.Value, options); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MachineProperties(network, resourceId, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("NetworkIPAddresses", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" network: "); + builder.AppendLine("{"); + builder.Append(" ipAddresses: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Network)) + { + builder.Append(" network: "); + BicepSerializationHelpers.AppendChildObject(builder, Network, options, 2, false, " network: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceId)) + { + builder.Append(" resourceId: "); + builder.AppendLine($"'{ResourceId.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(MachineProperties)} does not support writing '{options.Format}' format."); + } + } + + MachineProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMachineProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MachineProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.cs new file mode 100644 index 000000000000..96db91ddcb07 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MachineProperties.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The properties of the machine. + public partial class MachineProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MachineProperties() + { + } + + /// Initializes a new instance of . + /// network properties of the machine. + /// Arm resource id of the machine. It can be used to GET underlying VM Instance. + /// Keeps track of any properties unknown to the library. + internal MachineProperties(MachineNetworkProperties network, ResourceIdentifier resourceId, IDictionary serializedAdditionalRawData) + { + Network = network; + ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// network properties of the machine. + internal MachineNetworkProperties Network { get; } + /// IPv4, IPv6 addresses of the machine. + [WirePath("network.ipAddresses")] + public IReadOnlyList NetworkIPAddresses + { + get => Network?.IPAddresses; + } + + /// Arm resource id of the machine. It can be used to GET underlying VM Instance. + [WirePath("resourceId")] + public ResourceIdentifier ResourceId { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAIToolchainOperatorProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAIToolchainOperatorProfile.Serialization.cs new file mode 100644 index 000000000000..d84a9edcefb1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAIToolchainOperatorProfile.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterAIToolchainOperatorProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAIToolchainOperatorProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterAIToolchainOperatorProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAIToolchainOperatorProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAIToolchainOperatorProfile(document.RootElement, options); + } + + internal static ManagedClusterAIToolchainOperatorProfile DeserializeManagedClusterAIToolchainOperatorProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterAIToolchainOperatorProfile(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterAIToolchainOperatorProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterAIToolchainOperatorProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterAIToolchainOperatorProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterAIToolchainOperatorProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAIToolchainOperatorProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAIToolchainOperatorProfile.cs new file mode 100644 index 000000000000..26255d0bb43b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAIToolchainOperatorProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// When enabling the operator, a set of AKS managed CRDs and controllers will be installed in the cluster. The operator automates the deployment of OSS models for inference and/or training purposes. It provides a set of preset models and enables distributed inference against them. + internal partial class ManagedClusterAIToolchainOperatorProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterAIToolchainOperatorProfile() + { + } + + /// Initializes a new instance of . + /// Indicates if AI toolchain operator enabled or not. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAIToolchainOperatorProfile(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates if AI toolchain operator enabled or not. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs index 54ecedfa5c07..b0c362d9fccd 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs @@ -62,14 +62,17 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo return null; } string name = default; + ETag? etag = default; int? count = default; string vmSize = default; int? osDiskSizeGB = default; ContainerServiceOSDiskType? osDiskType = default; KubeletDiskType? kubeletDiskType = default; WorkloadRuntime? workloadRuntime = default; + string messageOfTheDay = default; ResourceIdentifier vnetSubnetId = default; ResourceIdentifier podSubnetId = default; + PodIPAllocationMode? podIPAllocationMode = default; int? maxPods = default; ContainerServiceOSType? osType = default; ContainerServiceOSSku? osSku = default; @@ -87,6 +90,7 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo ContainerServicePowerState powerState = default; IList availabilityZones = default; bool? enableNodePublicIP = default; + bool? enableCustomCATrust = default; ResourceIdentifier nodePublicIPPrefixId = default; ScaleSetPriority? scaleSetPriority = default; ScaleSetEvictionPolicy? scaleSetEvictionPolicy = default; @@ -94,6 +98,7 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo IDictionary tags = default; IDictionary nodeLabels = default; IList nodeTaints = default; + IList nodeInitializationTaints = default; ResourceIdentifier proximityPlacementGroupId = default; KubeletConfig kubeletConfig = default; LinuxOSConfig linuxOSConfig = default; @@ -104,7 +109,16 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo ContainerServiceCreationData creationData = default; ResourceIdentifier capacityReservationGroupId = default; ResourceIdentifier hostGroupId = default; + AgentPoolWindowsProfile windowsProfile = default; AgentPoolNetworkProfile networkProfile = default; + AgentPoolSecurityProfile securityProfile = default; + GpuProfile gpuProfile = default; + AgentPoolArtifactStreamingProfile artifactStreamingProfile = default; + VirtualMachinesProfile virtualMachinesProfile = default; + IList virtualMachineNodesStatus = default; + AgentPoolGatewayProfile gatewayProfile = default; + AgentPoolStatus status = default; + LocalDnsProfile localDnsProfile = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -114,6 +128,15 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo name = property.Value.GetString(); continue; } + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } if (property.NameEquals("count"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -164,6 +187,11 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo workloadRuntime = new WorkloadRuntime(property.Value.GetString()); continue; } + if (property.NameEquals("messageOfTheDay"u8)) + { + messageOfTheDay = property.Value.GetString(); + continue; + } if (property.NameEquals("vnetSubnetID"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -182,6 +210,15 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo podSubnetId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (property.NameEquals("podIPAllocationMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + podIPAllocationMode = new PodIPAllocationMode(property.Value.GetString()); + continue; + } if (property.NameEquals("maxPods"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -324,6 +361,15 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo enableNodePublicIP = property.Value.GetBoolean(); continue; } + if (property.NameEquals("enableCustomCATrust"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableCustomCATrust = property.Value.GetBoolean(); + continue; + } if (property.NameEquals("nodePublicIPPrefixID"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -402,6 +448,20 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo nodeTaints = array; continue; } + if (property.NameEquals("nodeInitializationTaints"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + nodeInitializationTaints = array; + continue; + } if (property.NameEquals("proximityPlacementGroupID"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -492,6 +552,15 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo hostGroupId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (property.NameEquals("windowsProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + windowsProfile = AgentPoolWindowsProfile.DeserializeAgentPoolWindowsProfile(property.Value, options); + continue; + } if (property.NameEquals("networkProfile"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -501,6 +570,83 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property.Value, options); continue; } + if (property.NameEquals("securityProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityProfile = AgentPoolSecurityProfile.DeserializeAgentPoolSecurityProfile(property.Value, options); + continue; + } + if (property.NameEquals("gpuProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gpuProfile = GpuProfile.DeserializeGpuProfile(property.Value, options); + continue; + } + if (property.NameEquals("artifactStreamingProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStreamingProfile = AgentPoolArtifactStreamingProfile.DeserializeAgentPoolArtifactStreamingProfile(property.Value, options); + continue; + } + if (property.NameEquals("virtualMachinesProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualMachinesProfile = VirtualMachinesProfile.DeserializeVirtualMachinesProfile(property.Value, options); + continue; + } + if (property.NameEquals("virtualMachineNodesStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VirtualMachineNodes.DeserializeVirtualMachineNodes(item, options)); + } + virtualMachineNodesStatus = array; + continue; + } + if (property.NameEquals("gatewayProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gatewayProfile = AgentPoolGatewayProfile.DeserializeAgentPoolGatewayProfile(property.Value, options); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = AgentPoolStatus.DeserializeAgentPoolStatus(property.Value, options); + continue; + } + if (property.NameEquals("localDNSProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + localDnsProfile = LocalDnsProfile.DeserializeLocalDnsProfile(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -508,14 +654,17 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo } serializedAdditionalRawData = rawDataDictionary; return new ManagedClusterAgentPoolProfile( + etag, count, vmSize, osDiskSizeGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, + podIPAllocationMode, maxPods, osType, osSku, @@ -533,6 +682,7 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo powerState, availabilityZones ?? new ChangeTrackingList(), enableNodePublicIP, + enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, @@ -540,6 +690,7 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo tags ?? new ChangeTrackingDictionary(), nodeLabels ?? new ChangeTrackingDictionary(), nodeTaints ?? new ChangeTrackingList(), + nodeInitializationTaints ?? new ChangeTrackingList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, @@ -550,7 +701,16 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo creationData, capacityReservationGroupId, hostGroupId, + windowsProfile, networkProfile, + securityProfile, + gpuProfile, + artifactStreamingProfile, + virtualMachinesProfile, + virtualMachineNodesStatus ?? new ChangeTrackingList(), + gatewayProfile, + status, + localDnsProfile, serializedAdditionalRawData, name); } @@ -589,6 +749,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" eTag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" eTag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Count), out propertyOverride); if (hasPropertyOverride) { @@ -687,6 +862,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MessageOfTheDay), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" messageOfTheDay: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MessageOfTheDay)) + { + builder.Append(" messageOfTheDay: "); + if (MessageOfTheDay.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MessageOfTheDay}'''"); + } + else + { + builder.AppendLine($"'{MessageOfTheDay}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VnetSubnetId), out propertyOverride); if (hasPropertyOverride) { @@ -717,6 +915,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodIPAllocationMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" podIPAllocationMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PodIPAllocationMode)) + { + builder.Append(" podIPAllocationMode: "); + builder.AppendLine($"'{PodIPAllocationMode.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxPods), out propertyOverride); if (hasPropertyOverride) { @@ -1030,6 +1243,22 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableCustomCATrust), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enableCustomCATrust: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnableCustomCATrust)) + { + builder.Append(" enableCustomCATrust: "); + var boolValue = EnableCustomCATrust.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodePublicIPPrefixId), out propertyOverride); if (hasPropertyOverride) { @@ -1200,6 +1429,42 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeInitializationTaints), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeInitializationTaints: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(NodeInitializationTaints)) + { + if (NodeInitializationTaints.Any()) + { + builder.Append(" nodeInitializationTaints: "); + builder.AppendLine("["); + foreach (var item in NodeInitializationTaints) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProximityPlacementGroupId), out propertyOverride); if (hasPropertyOverride) { @@ -1356,6 +1621,24 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("DisableOutboundNat", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" windowsProfile: "); + builder.AppendLine("{"); + builder.Append(" disableOutboundNat: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(WindowsProfile)) + { + builder.Append(" windowsProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, WindowsProfile, options, 2, false, " windowsProfile: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkProfile), out propertyOverride); if (hasPropertyOverride) { @@ -1371,6 +1654,146 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" securityProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecurityProfile)) + { + builder.Append(" securityProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, SecurityProfile, options, 2, false, " securityProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GpuProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" gpuProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(GpuProfile)) + { + builder.Append(" gpuProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, GpuProfile, options, 2, false, " gpuProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("ArtifactStreamingProfileEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" artifactStreamingProfile: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(ArtifactStreamingProfile)) + { + builder.Append(" artifactStreamingProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, ArtifactStreamingProfile, options, 2, false, " artifactStreamingProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("VirtualMachinesScale", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" virtualMachinesProfile: "); + builder.AppendLine("{"); + builder.Append(" scale: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(VirtualMachinesProfile)) + { + builder.Append(" virtualMachinesProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, VirtualMachinesProfile, options, 2, false, " virtualMachinesProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VirtualMachineNodesStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" virtualMachineNodesStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(VirtualMachineNodesStatus)) + { + if (VirtualMachineNodesStatus.Any()) + { + builder.Append(" virtualMachineNodesStatus: "); + builder.AppendLine("["); + foreach (var item in VirtualMachineNodesStatus) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " virtualMachineNodesStatus: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("GatewayPublicIPPrefixSize", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" gatewayProfile: "); + builder.AppendLine("{"); + builder.Append(" publicIPPrefixSize: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(GatewayProfile)) + { + builder.Append(" gatewayProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, GatewayProfile, options, 2, false, " gatewayProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("StatusProvisioningError", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine("{"); + builder.Append(" provisioningError: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 2, false, " status: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LocalDnsProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" localDNSProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LocalDnsProfile)) + { + builder.Append(" localDNSProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, LocalDnsProfile, options, 2, false, " localDNSProfile: "); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs index 5814a5f2d5a7..aa876bc8d579 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs @@ -25,31 +25,35 @@ public ManagedClusterAgentPoolProfile(string name) } /// Initializes a new instance of . + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The IP allocation mode for pods in the agent pool. Must be used with podSubnetId. The default is 'DynamicIndividual'. /// The maximum number of pods that can run on a node. /// The operating system type. The default is Linux. - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. /// The maximum number of nodes for auto-scaling. /// The minimum number of nodes for auto-scaling. /// Whether to enable auto-scaler. /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. /// The type of Agent Pool. /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). - /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// Both patch version <major.minor.patch> and <major.minor> are supported. When <major.minor> is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same <major.minor> once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. /// The version of node image. /// Settings for upgrading the agentpool. /// The current deployment or provisioning state. /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// When set to true, AKS adds a label to the node indicating that the feature is enabled and deploys a daemonset along with host services to sync custom certificate authorities from user-provided list of base64 encoded certificates into node trust stores. Defaults to false. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. @@ -57,6 +61,7 @@ public ManagedClusterAgentPoolProfile(string name) /// The tags to be persisted on the agent pool virtual machine scale set. /// The node labels to be persisted across all nodes in agent pool. /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// These taints will not be reconciled by AKS and can be removed with a kubectl call. This field can be modified after node pool is created, but nodes will not be recreated with new taints until another operation that requires recreation (e.g. node image upgrade) happens. These taints allow for required configuration to run before the node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with `kubectl taint nodes node1 key1=value1:NoSchedule-`. /// The ID for Proximity Placement Group. /// The Kubelet configuration on the agent pool nodes. /// The OS configuration of Linux agent nodes. @@ -67,10 +72,19 @@ public ManagedClusterAgentPoolProfile(string name) /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// The Windows agent pool's specific profile. /// Network-related settings of an agent pool. + /// The security settings of an agent pool. + /// The GPU settings of an agent pool. + /// Configuration for using artifact streaming on AKS. + /// Specifications on VirtualMachines agent pool. + /// The status of nodes in a VirtualMachines agent pool. + /// Profile specific to a managed agent pool in Gateway mode. This field cannot be set if agent pool mode is not Gateway. + /// Contains read-only information about the Agent Pool. + /// Configures the per-node local DNS, with VnetDNS and KubeDNS overrides. LocalDNS helps improve performance and reliability of DNS resolution in an AKS cluster. For more details see aka.ms/aks/localdns. /// Keeps track of any properties unknown to the library. /// Windows agent pool names must be 6 characters or less. - internal ManagedClusterAgentPoolProfile(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, IDictionary serializedAdditionalRawData, string name) : base(count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, agentPoolType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeSettings, provisioningState, powerState, availabilityZones, enableNodePublicIP, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints, proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationData, capacityReservationGroupId, hostGroupId, networkProfile, serializedAdditionalRawData) + internal ManagedClusterAgentPoolProfile(ETag? etag, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, PodIPAllocationMode? podIPAllocationMode, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, bool? enableCustomCATrust, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, IList nodeInitializationTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolWindowsProfile windowsProfile, AgentPoolNetworkProfile networkProfile, AgentPoolSecurityProfile securityProfile, GpuProfile gpuProfile, AgentPoolArtifactStreamingProfile artifactStreamingProfile, VirtualMachinesProfile virtualMachinesProfile, IList virtualMachineNodesStatus, AgentPoolGatewayProfile gatewayProfile, AgentPoolStatus status, LocalDnsProfile localDnsProfile, IDictionary serializedAdditionalRawData, string name) : base(etag, count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetId, podSubnetId, podIPAllocationMode, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, agentPoolType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeSettings, provisioningState, powerState, availabilityZones, enableNodePublicIP, enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints, nodeInitializationTaints, proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationData, capacityReservationGroupId, hostGroupId, windowsProfile, networkProfile, securityProfile, gpuProfile, artifactStreamingProfile, virtualMachinesProfile, virtualMachineNodesStatus, gatewayProfile, status, localDnsProfile, serializedAdditionalRawData) { Name = name; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs index db1fb26d5b79..afe69fef573e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs @@ -36,6 +36,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ManagedClusterAgentPoolProfileProperties)} does not support writing '{format}' format."); } + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } if (Optional.IsDefined(Count)) { writer.WritePropertyName("count"u8); @@ -66,6 +71,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("workloadRuntime"u8); writer.WriteStringValue(WorkloadRuntime.Value.ToString()); } + if (Optional.IsDefined(MessageOfTheDay)) + { + writer.WritePropertyName("messageOfTheDay"u8); + writer.WriteStringValue(MessageOfTheDay); + } if (Optional.IsDefined(VnetSubnetId)) { writer.WritePropertyName("vnetSubnetID"u8); @@ -76,6 +86,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("podSubnetID"u8); writer.WriteStringValue(PodSubnetId); } + if (Optional.IsDefined(PodIPAllocationMode)) + { + writer.WritePropertyName("podIPAllocationMode"u8); + writer.WriteStringValue(PodIPAllocationMode.Value.ToString()); + } if (Optional.IsDefined(MaxPods)) { writer.WritePropertyName("maxPods"u8); @@ -166,6 +181,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("enableNodePublicIP"u8); writer.WriteBooleanValue(EnableNodePublicIP.Value); } + if (Optional.IsDefined(EnableCustomCATrust)) + { + writer.WritePropertyName("enableCustomCATrust"u8); + writer.WriteBooleanValue(EnableCustomCATrust.Value); + } if (Optional.IsDefined(NodePublicIPPrefixId)) { writer.WritePropertyName("nodePublicIPPrefixID"u8); @@ -218,6 +238,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsCollectionDefined(NodeInitializationTaints)) + { + writer.WritePropertyName("nodeInitializationTaints"u8); + writer.WriteStartArray(); + foreach (var item in NodeInitializationTaints) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } if (Optional.IsDefined(ProximityPlacementGroupId)) { writer.WritePropertyName("proximityPlacementGroupID"u8); @@ -268,11 +298,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("hostGroupID"u8); writer.WriteStringValue(HostGroupId); } + if (Optional.IsDefined(WindowsProfile)) + { + writer.WritePropertyName("windowsProfile"u8); + writer.WriteObjectValue(WindowsProfile, options); + } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); writer.WriteObjectValue(NetworkProfile, options); } + if (Optional.IsDefined(SecurityProfile)) + { + writer.WritePropertyName("securityProfile"u8); + writer.WriteObjectValue(SecurityProfile, options); + } + if (Optional.IsDefined(GpuProfile)) + { + writer.WritePropertyName("gpuProfile"u8); + writer.WriteObjectValue(GpuProfile, options); + } + if (Optional.IsDefined(ArtifactStreamingProfile)) + { + writer.WritePropertyName("artifactStreamingProfile"u8); + writer.WriteObjectValue(ArtifactStreamingProfile, options); + } + if (Optional.IsDefined(VirtualMachinesProfile)) + { + writer.WritePropertyName("virtualMachinesProfile"u8); + writer.WriteObjectValue(VirtualMachinesProfile, options); + } + if (Optional.IsCollectionDefined(VirtualMachineNodesStatus)) + { + writer.WritePropertyName("virtualMachineNodesStatus"u8); + writer.WriteStartArray(); + foreach (var item in VirtualMachineNodesStatus) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(GatewayProfile)) + { + writer.WritePropertyName("gatewayProfile"u8); + writer.WriteObjectValue(GatewayProfile, options); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); + } + if (Optional.IsDefined(LocalDnsProfile)) + { + writer.WritePropertyName("localDNSProfile"u8); + writer.WriteObjectValue(LocalDnsProfile, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -310,14 +390,17 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust { return null; } + ETag? etag = default; int? count = default; string vmSize = default; int? osDiskSizeGB = default; ContainerServiceOSDiskType? osDiskType = default; KubeletDiskType? kubeletDiskType = default; WorkloadRuntime? workloadRuntime = default; + string messageOfTheDay = default; ResourceIdentifier vnetSubnetId = default; ResourceIdentifier podSubnetId = default; + PodIPAllocationMode? podIPAllocationMode = default; int? maxPods = default; ContainerServiceOSType? osType = default; ContainerServiceOSSku? osSku = default; @@ -335,6 +418,7 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust ContainerServicePowerState powerState = default; IList availabilityZones = default; bool? enableNodePublicIP = default; + bool? enableCustomCATrust = default; ResourceIdentifier nodePublicIPPrefixId = default; ScaleSetPriority? scaleSetPriority = default; ScaleSetEvictionPolicy? scaleSetEvictionPolicy = default; @@ -342,6 +426,7 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust IDictionary tags = default; IDictionary nodeLabels = default; IList nodeTaints = default; + IList nodeInitializationTaints = default; ResourceIdentifier proximityPlacementGroupId = default; KubeletConfig kubeletConfig = default; LinuxOSConfig linuxOSConfig = default; @@ -352,11 +437,29 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust ContainerServiceCreationData creationData = default; ResourceIdentifier capacityReservationGroupId = default; ResourceIdentifier hostGroupId = default; + AgentPoolWindowsProfile windowsProfile = default; AgentPoolNetworkProfile networkProfile = default; + AgentPoolSecurityProfile securityProfile = default; + GpuProfile gpuProfile = default; + AgentPoolArtifactStreamingProfile artifactStreamingProfile = default; + VirtualMachinesProfile virtualMachinesProfile = default; + IList virtualMachineNodesStatus = default; + AgentPoolGatewayProfile gatewayProfile = default; + AgentPoolStatus status = default; + LocalDnsProfile localDnsProfile = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } if (property.NameEquals("count"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -407,6 +510,11 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust workloadRuntime = new WorkloadRuntime(property.Value.GetString()); continue; } + if (property.NameEquals("messageOfTheDay"u8)) + { + messageOfTheDay = property.Value.GetString(); + continue; + } if (property.NameEquals("vnetSubnetID"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -425,6 +533,15 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust podSubnetId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (property.NameEquals("podIPAllocationMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + podIPAllocationMode = new PodIPAllocationMode(property.Value.GetString()); + continue; + } if (property.NameEquals("maxPods"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -567,6 +684,15 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust enableNodePublicIP = property.Value.GetBoolean(); continue; } + if (property.NameEquals("enableCustomCATrust"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableCustomCATrust = property.Value.GetBoolean(); + continue; + } if (property.NameEquals("nodePublicIPPrefixID"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -645,6 +771,20 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust nodeTaints = array; continue; } + if (property.NameEquals("nodeInitializationTaints"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + nodeInitializationTaints = array; + continue; + } if (property.NameEquals("proximityPlacementGroupID"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -735,6 +875,15 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust hostGroupId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (property.NameEquals("windowsProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + windowsProfile = AgentPoolWindowsProfile.DeserializeAgentPoolWindowsProfile(property.Value, options); + continue; + } if (property.NameEquals("networkProfile"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -744,6 +893,83 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property.Value, options); continue; } + if (property.NameEquals("securityProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityProfile = AgentPoolSecurityProfile.DeserializeAgentPoolSecurityProfile(property.Value, options); + continue; + } + if (property.NameEquals("gpuProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gpuProfile = GpuProfile.DeserializeGpuProfile(property.Value, options); + continue; + } + if (property.NameEquals("artifactStreamingProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStreamingProfile = AgentPoolArtifactStreamingProfile.DeserializeAgentPoolArtifactStreamingProfile(property.Value, options); + continue; + } + if (property.NameEquals("virtualMachinesProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualMachinesProfile = VirtualMachinesProfile.DeserializeVirtualMachinesProfile(property.Value, options); + continue; + } + if (property.NameEquals("virtualMachineNodesStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VirtualMachineNodes.DeserializeVirtualMachineNodes(item, options)); + } + virtualMachineNodesStatus = array; + continue; + } + if (property.NameEquals("gatewayProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gatewayProfile = AgentPoolGatewayProfile.DeserializeAgentPoolGatewayProfile(property.Value, options); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = AgentPoolStatus.DeserializeAgentPoolStatus(property.Value, options); + continue; + } + if (property.NameEquals("localDNSProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + localDnsProfile = LocalDnsProfile.DeserializeLocalDnsProfile(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -751,14 +977,17 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust } serializedAdditionalRawData = rawDataDictionary; return new ManagedClusterAgentPoolProfileProperties( + etag, count, vmSize, osDiskSizeGB, osDiskType, kubeletDiskType, workloadRuntime, + messageOfTheDay, vnetSubnetId, podSubnetId, + podIPAllocationMode, maxPods, osType, osSku, @@ -776,6 +1005,7 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust powerState, availabilityZones ?? new ChangeTrackingList(), enableNodePublicIP, + enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, @@ -783,6 +1013,7 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust tags ?? new ChangeTrackingDictionary(), nodeLabels ?? new ChangeTrackingDictionary(), nodeTaints ?? new ChangeTrackingList(), + nodeInitializationTaints ?? new ChangeTrackingList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, @@ -793,7 +1024,16 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust creationData, capacityReservationGroupId, hostGroupId, + windowsProfile, networkProfile, + securityProfile, + gpuProfile, + artifactStreamingProfile, + virtualMachinesProfile, + virtualMachineNodesStatus ?? new ChangeTrackingList(), + gatewayProfile, + status, + localDnsProfile, serializedAdditionalRawData); } @@ -808,6 +1048,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" eTag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" eTag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Count), out propertyOverride); if (hasPropertyOverride) { @@ -906,6 +1161,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MessageOfTheDay), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" messageOfTheDay: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MessageOfTheDay)) + { + builder.Append(" messageOfTheDay: "); + if (MessageOfTheDay.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MessageOfTheDay}'''"); + } + else + { + builder.AppendLine($"'{MessageOfTheDay}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VnetSubnetId), out propertyOverride); if (hasPropertyOverride) { @@ -936,6 +1214,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodIPAllocationMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" podIPAllocationMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PodIPAllocationMode)) + { + builder.Append(" podIPAllocationMode: "); + builder.AppendLine($"'{PodIPAllocationMode.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxPods), out propertyOverride); if (hasPropertyOverride) { @@ -1249,6 +1542,22 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableCustomCATrust), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enableCustomCATrust: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnableCustomCATrust)) + { + builder.Append(" enableCustomCATrust: "); + var boolValue = EnableCustomCATrust.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodePublicIPPrefixId), out propertyOverride); if (hasPropertyOverride) { @@ -1419,6 +1728,42 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeInitializationTaints), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeInitializationTaints: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(NodeInitializationTaints)) + { + if (NodeInitializationTaints.Any()) + { + builder.Append(" nodeInitializationTaints: "); + builder.AppendLine("["); + foreach (var item in NodeInitializationTaints) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProximityPlacementGroupId), out propertyOverride); if (hasPropertyOverride) { @@ -1575,6 +1920,24 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("DisableOutboundNat", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" windowsProfile: "); + builder.AppendLine("{"); + builder.Append(" disableOutboundNat: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(WindowsProfile)) + { + builder.Append(" windowsProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, WindowsProfile, options, 2, false, " windowsProfile: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkProfile), out propertyOverride); if (hasPropertyOverride) { @@ -1590,6 +1953,146 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" securityProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecurityProfile)) + { + builder.Append(" securityProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, SecurityProfile, options, 2, false, " securityProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GpuProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" gpuProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(GpuProfile)) + { + builder.Append(" gpuProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, GpuProfile, options, 2, false, " gpuProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("ArtifactStreamingProfileEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" artifactStreamingProfile: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(ArtifactStreamingProfile)) + { + builder.Append(" artifactStreamingProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, ArtifactStreamingProfile, options, 2, false, " artifactStreamingProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("VirtualMachinesScale", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" virtualMachinesProfile: "); + builder.AppendLine("{"); + builder.Append(" scale: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(VirtualMachinesProfile)) + { + builder.Append(" virtualMachinesProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, VirtualMachinesProfile, options, 2, false, " virtualMachinesProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VirtualMachineNodesStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" virtualMachineNodesStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(VirtualMachineNodesStatus)) + { + if (VirtualMachineNodesStatus.Any()) + { + builder.Append(" virtualMachineNodesStatus: "); + builder.AppendLine("["); + foreach (var item in VirtualMachineNodesStatus) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " virtualMachineNodesStatus: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("GatewayPublicIPPrefixSize", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" gatewayProfile: "); + builder.AppendLine("{"); + builder.Append(" publicIPPrefixSize: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(GatewayProfile)) + { + builder.Append(" gatewayProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, GatewayProfile, options, 2, false, " gatewayProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("StatusProvisioningError", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine("{"); + builder.Append(" provisioningError: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 2, false, " status: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LocalDnsProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" localDNSProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LocalDnsProfile)) + { + builder.Append(" localDNSProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, LocalDnsProfile, options, 2, false, " localDNSProfile: "); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs index b23edbb4a140..931d04d649c6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs @@ -53,34 +53,40 @@ public ManagedClusterAgentPoolProfileProperties() Tags = new ChangeTrackingDictionary(); NodeLabels = new ChangeTrackingDictionary(); NodeTaints = new ChangeTrackingList(); + NodeInitializationTaints = new ChangeTrackingList(); + VirtualMachineNodesStatus = new ChangeTrackingList(); } /// Initializes a new instance of . + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. /// The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os). /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. /// Determines the type of workload a node can run. + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + /// The IP allocation mode for pods in the agent pool. Must be used with podSubnetId. The default is 'DynamicIndividual'. /// The maximum number of pods that can run on a node. /// The operating system type. The default is Linux. - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. /// The maximum number of nodes for auto-scaling. /// The minimum number of nodes for auto-scaling. /// Whether to enable auto-scaler. /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. /// The type of Agent Pool. /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). - /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// Both patch version <major.minor.patch> and <major.minor> are supported. When <major.minor> is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same <major.minor> once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// If orchestratorVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. /// The version of node image. /// Settings for upgrading the agentpool. /// The current deployment or provisioning state. /// When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded. /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + /// When set to true, AKS adds a label to the node indicating that the feature is enabled and deploys a daemonset along with host services to sync custom certificate authorities from user-provided list of base64 encoded certificates into node trust stores. Defaults to false. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. @@ -88,6 +94,7 @@ public ManagedClusterAgentPoolProfileProperties() /// The tags to be persisted on the agent pool virtual machine scale set. /// The node labels to be persisted across all nodes in agent pool. /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + /// These taints will not be reconciled by AKS and can be removed with a kubectl call. This field can be modified after node pool is created, but nodes will not be recreated with new taints until another operation that requires recreation (e.g. node image upgrade) happens. These taints allow for required configuration to run before the node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with `kubectl taint nodes node1 key1=value1:NoSchedule-`. /// The ID for Proximity Placement Group. /// The Kubelet configuration on the agent pool nodes. /// The OS configuration of Linux agent nodes. @@ -98,18 +105,30 @@ public ManagedClusterAgentPoolProfileProperties() /// CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. /// AKS will associate the specified agent pool with the Capacity Reservation Group. /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// The Windows agent pool's specific profile. /// Network-related settings of an agent pool. + /// The security settings of an agent pool. + /// The GPU settings of an agent pool. + /// Configuration for using artifact streaming on AKS. + /// Specifications on VirtualMachines agent pool. + /// The status of nodes in a VirtualMachines agent pool. + /// Profile specific to a managed agent pool in Gateway mode. This field cannot be set if agent pool mode is not Gateway. + /// Contains read-only information about the Agent Pool. + /// Configures the per-node local DNS, with VnetDNS and KubeDNS overrides. LocalDNS helps improve performance and reliability of DNS resolution in an AKS cluster. For more details see aka.ms/aks/localdns. /// Keeps track of any properties unknown to the library. - internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolNetworkProfile networkProfile, IDictionary serializedAdditionalRawData) + internal ManagedClusterAgentPoolProfileProperties(ETag? etag, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, PodIPAllocationMode? podIPAllocationMode, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, bool? enableCustomCATrust, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, IList nodeInitializationTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolWindowsProfile windowsProfile, AgentPoolNetworkProfile networkProfile, AgentPoolSecurityProfile securityProfile, GpuProfile gpuProfile, AgentPoolArtifactStreamingProfile artifactStreamingProfile, VirtualMachinesProfile virtualMachinesProfile, IList virtualMachineNodesStatus, AgentPoolGatewayProfile gatewayProfile, AgentPoolStatus status, LocalDnsProfile localDnsProfile, IDictionary serializedAdditionalRawData) { + ETag = etag; Count = count; VmSize = vmSize; OSDiskSizeInGB = osDiskSizeInGB; OSDiskType = osDiskType; KubeletDiskType = kubeletDiskType; WorkloadRuntime = workloadRuntime; + MessageOfTheDay = messageOfTheDay; VnetSubnetId = vnetSubnetId; PodSubnetId = podSubnetId; + PodIPAllocationMode = podIPAllocationMode; MaxPods = maxPods; OSType = osType; OSSku = osSku; @@ -127,6 +146,7 @@ internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int PowerState = powerState; AvailabilityZones = availabilityZones; EnableNodePublicIP = enableNodePublicIP; + EnableCustomCATrust = enableCustomCATrust; NodePublicIPPrefixId = nodePublicIPPrefixId; ScaleSetPriority = scaleSetPriority; ScaleSetEvictionPolicy = scaleSetEvictionPolicy; @@ -134,6 +154,7 @@ internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int Tags = tags; NodeLabels = nodeLabels; NodeTaints = nodeTaints; + NodeInitializationTaints = nodeInitializationTaints; ProximityPlacementGroupId = proximityPlacementGroupId; KubeletConfig = kubeletConfig; LinuxOSConfig = linuxOSConfig; @@ -144,10 +165,22 @@ internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int CreationData = creationData; CapacityReservationGroupId = capacityReservationGroupId; HostGroupId = hostGroupId; + WindowsProfile = windowsProfile; NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + GpuProfile = gpuProfile; + ArtifactStreamingProfile = artifactStreamingProfile; + VirtualMachinesProfile = virtualMachinesProfile; + VirtualMachineNodesStatus = virtualMachineNodesStatus; + GatewayProfile = gatewayProfile; + Status = status; + LocalDnsProfile = localDnsProfile; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. + [WirePath("eTag")] + public ETag? ETag { get; } /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. [WirePath("count")] public int? Count { get; set; } @@ -166,19 +199,25 @@ internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int /// Determines the type of workload a node can run. [WirePath("workloadRuntime")] public WorkloadRuntime? WorkloadRuntime { get; set; } + /// A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). + [WirePath("messageOfTheDay")] + public string MessageOfTheDay { get; set; } /// If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. [WirePath("vnetSubnetID")] public ResourceIdentifier VnetSubnetId { get; set; } /// If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. [WirePath("podSubnetID")] public ResourceIdentifier PodSubnetId { get; set; } + /// The IP allocation mode for pods in the agent pool. Must be used with podSubnetId. The default is 'DynamicIndividual'. + [WirePath("podIPAllocationMode")] + public PodIPAllocationMode? PodIPAllocationMode { get; set; } /// The maximum number of pods that can run on a node. [WirePath("maxPods")] public int? MaxPods { get; set; } /// The operating system type. The default is Linux. [WirePath("osType")] public ContainerServiceOSType? OSType { get; set; } - /// Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows. + /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. [WirePath("osSKU")] public ContainerServiceOSSku? OSSku { get; set; } /// The maximum number of nodes for auto-scaling. @@ -199,10 +238,10 @@ internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int /// A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools. [WirePath("mode")] public AgentPoolMode? Mode { get; set; } - /// Both patch version <major.minor.patch> (e.g. 1.20.13) and <major.minor> (e.g. 1.20) are supported. When <major.minor> is specified, the latest supported GA patch version is chosen automatically. Updating the cluster with the same <major.minor> once it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + /// Both patch version <major.minor.patch> and <major.minor> are supported. When <major.minor> is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same <major.minor> once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). [WirePath("orchestratorVersion")] public string OrchestratorVersion { get; set; } - /// If orchestratorVersion is a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion is <major.minor>, this field will contain the full <major.minor.patch> version being used. + /// If orchestratorVersion was a fully specified version <major.minor.patch>, this field will be exactly equal to it. If orchestratorVersion was <major.minor>, this field will contain the full <major.minor.patch> version being used. [WirePath("currentOrchestratorVersion")] public string CurrentOrchestratorVersion { get; } /// The version of node image. @@ -235,6 +274,9 @@ public ContainerServiceStateCode? PowerStateCode /// Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. [WirePath("enableNodePublicIP")] public bool? EnableNodePublicIP { get; set; } + /// When set to true, AKS adds a label to the node indicating that the feature is enabled and deploys a daemonset along with host services to sync custom certificate authorities from user-provided list of base64 encoded certificates into node trust stores. Defaults to false. + [WirePath("enableCustomCATrust")] + public bool? EnableCustomCATrust { get; set; } /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. [WirePath("nodePublicIPPrefixID")] public ResourceIdentifier NodePublicIPPrefixId { get; set; } @@ -256,6 +298,9 @@ public ContainerServiceStateCode? PowerStateCode /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. [WirePath("nodeTaints")] public IList NodeTaints { get; } + /// These taints will not be reconciled by AKS and can be removed with a kubectl call. This field can be modified after node pool is created, but nodes will not be recreated with new taints until another operation that requires recreation (e.g. node image upgrade) happens. These taints allow for required configuration to run before the node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with `kubectl taint nodes node1 key1=value1:NoSchedule-`. + [WirePath("nodeInitializationTaints")] + public IList NodeInitializationTaints { get; } /// The ID for Proximity Placement Group. [WirePath("proximityPlacementGroupID")] public ResourceIdentifier ProximityPlacementGroupId { get; set; } @@ -298,8 +343,89 @@ public ResourceIdentifier CreationDataSourceResourceId /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). [WirePath("hostGroupID")] public ResourceIdentifier HostGroupId { get; set; } + /// The Windows agent pool's specific profile. + internal AgentPoolWindowsProfile WindowsProfile { get; set; } + /// The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP enabled. + [WirePath("windowsProfile.disableOutboundNat")] + public bool? DisableOutboundNat + { + get => WindowsProfile is null ? default : WindowsProfile.DisableOutboundNat; + set + { + if (WindowsProfile is null) + WindowsProfile = new AgentPoolWindowsProfile(); + WindowsProfile.DisableOutboundNat = value; + } + } + /// Network-related settings of an agent pool. [WirePath("networkProfile")] public AgentPoolNetworkProfile NetworkProfile { get; set; } + /// The security settings of an agent pool. + [WirePath("securityProfile")] + public AgentPoolSecurityProfile SecurityProfile { get; set; } + /// The GPU settings of an agent pool. + [WirePath("gpuProfile")] + public GpuProfile GpuProfile { get; set; } + /// Configuration for using artifact streaming on AKS. + internal AgentPoolArtifactStreamingProfile ArtifactStreamingProfile { get; set; } + /// Artifact streaming speeds up the cold-start of containers on a node through on-demand image loading. To use this feature, container images must also enable artifact streaming on ACR. If not specified, the default is false. + [WirePath("artifactStreamingProfile.enabled")] + public bool? ArtifactStreamingProfileEnabled + { + get => ArtifactStreamingProfile is null ? default : ArtifactStreamingProfile.Enabled; + set + { + if (ArtifactStreamingProfile is null) + ArtifactStreamingProfile = new AgentPoolArtifactStreamingProfile(); + ArtifactStreamingProfile.Enabled = value; + } + } + + /// Specifications on VirtualMachines agent pool. + internal VirtualMachinesProfile VirtualMachinesProfile { get; set; } + /// Specifications on how to scale a VirtualMachines agent pool. + [WirePath("virtualMachinesProfile.scale")] + public ScaleProfile VirtualMachinesScale + { + get => VirtualMachinesProfile is null ? default : VirtualMachinesProfile.Scale; + set + { + if (VirtualMachinesProfile is null) + VirtualMachinesProfile = new VirtualMachinesProfile(); + VirtualMachinesProfile.Scale = value; + } + } + + /// The status of nodes in a VirtualMachines agent pool. + [WirePath("virtualMachineNodesStatus")] + public IList VirtualMachineNodesStatus { get; } + /// Profile specific to a managed agent pool in Gateway mode. This field cannot be set if agent pool mode is not Gateway. + internal AgentPoolGatewayProfile GatewayProfile { get; set; } + /// The Gateway agent pool associates one public IPPrefix for each static egress gateway to provide public egress. The size of Public IPPrefix should be selected by the user. Each node in the agent pool is assigned with one IP from the IPPrefix. The IPPrefix size thus serves as a cap on the size of the Gateway agent pool. Due to Azure public IPPrefix size limitation, the valid value range is [28, 31] (/31 = 2 nodes/IPs, /30 = 4 nodes/IPs, /29 = 8 nodes/IPs, /28 = 16 nodes/IPs). The default value is 31. + [WirePath("gatewayProfile.publicIPPrefixSize")] + public int? GatewayPublicIPPrefixSize + { + get => GatewayProfile is null ? default : GatewayProfile.PublicIPPrefixSize; + set + { + if (GatewayProfile is null) + GatewayProfile = new AgentPoolGatewayProfile(); + GatewayProfile.PublicIPPrefixSize = value; + } + } + + /// Contains read-only information about the Agent Pool. + internal AgentPoolStatus Status { get; set; } + /// Preserves the detailed info of failure. If there was no error, this field is omitted. + [WirePath("status.provisioningError")] + public ResponseError StatusProvisioningError + { + get => Status is null ? default : Status.ProvisioningError; + } + + /// Configures the per-node local DNS, with VnetDNS and KubeDNS overrides. LocalDNS helps improve performance and reliability of DNS resolution in an AKS cluster. For more details see aka.ms/aks/localdns. + [WirePath("localDNSProfile")] + public LocalDnsProfile LocalDnsProfile { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.Serialization.cs index 49530d309fd2..bd887074ca35 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.Serialization.cs @@ -66,6 +66,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("disableRunCommand"u8); writer.WriteBooleanValue(DisableRunCommand.Value); } + if (Optional.IsDefined(EnableVnetIntegration)) + { + writer.WritePropertyName("enableVnetIntegration"u8); + writer.WriteBooleanValue(EnableVnetIntegration.Value); + } + if (Optional.IsDefined(SubnetId)) + { + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -108,6 +118,8 @@ internal static ManagedClusterApiServerAccessProfile DeserializeManagedClusterAp string privateDnsZone = default; bool? enablePrivateClusterPublicFQDN = default; bool? disableRunCommand = default; + bool? enableVnetIntegration = default; + ResourceIdentifier subnetId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -158,6 +170,24 @@ internal static ManagedClusterApiServerAccessProfile DeserializeManagedClusterAp disableRunCommand = property.Value.GetBoolean(); continue; } + if (property.NameEquals("enableVnetIntegration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableVnetIntegration = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("subnetId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subnetId = new ResourceIdentifier(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -170,6 +200,8 @@ internal static ManagedClusterApiServerAccessProfile DeserializeManagedClusterAp privateDnsZone, enablePrivateClusterPublicFQDN, disableRunCommand, + enableVnetIntegration, + subnetId, serializedAdditionalRawData); } @@ -291,6 +323,37 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableVnetIntegration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enableVnetIntegration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnableVnetIntegration)) + { + builder.Append(" enableVnetIntegration: "); + var boolValue = EnableVnetIntegration.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SubnetId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" subnetId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SubnetId)) + { + builder.Append(" subnetId: "); + builder.AppendLine($"'{SubnetId.ToString()}'"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs index 915054a6d67f..d8b13f19ef9a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models { @@ -57,14 +58,18 @@ public ManagedClusterApiServerAccessProfile() /// The default is System. For more details see [configure private DNS zone](https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone). Allowed values are 'system' and 'none'. /// Whether to create additional public FQDN for private cluster or not. /// Whether to disable run command for the cluster or not. + /// Whether to enable apiserver vnet integration for the cluster or not. + /// It is required when: 1. creating a new cluster with BYO Vnet; 2. updating an existing cluster to enable apiserver vnet integration. /// Keeps track of any properties unknown to the library. - internal ManagedClusterApiServerAccessProfile(IList authorizedIPRanges, bool? enablePrivateCluster, string privateDnsZone, bool? enablePrivateClusterPublicFqdn, bool? disableRunCommand, IDictionary serializedAdditionalRawData) + internal ManagedClusterApiServerAccessProfile(IList authorizedIPRanges, bool? enablePrivateCluster, string privateDnsZone, bool? enablePrivateClusterPublicFqdn, bool? disableRunCommand, bool? enableVnetIntegration, ResourceIdentifier subnetId, IDictionary serializedAdditionalRawData) { AuthorizedIPRanges = authorizedIPRanges; EnablePrivateCluster = enablePrivateCluster; PrivateDnsZone = privateDnsZone; EnablePrivateClusterPublicFqdn = enablePrivateClusterPublicFqdn; DisableRunCommand = disableRunCommand; + EnableVnetIntegration = enableVnetIntegration; + SubnetId = subnetId; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -83,5 +88,11 @@ internal ManagedClusterApiServerAccessProfile(IList authorizedIPRanges, /// Whether to disable run command for the cluster or not. [WirePath("disableRunCommand")] public bool? DisableRunCommand { get; set; } + /// Whether to enable apiserver vnet integration for the cluster or not. + [WirePath("enableVnetIntegration")] + public bool? EnableVnetIntegration { get; set; } + /// It is required when: 1. creating a new cluster with BYO Vnet; 2. updating an existing cluster to enable apiserver vnet integration. + [WirePath("subnetId")] + public ResourceIdentifier SubnetId { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs index 64ec1cc6e8da..ca58d90544a8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs @@ -40,6 +40,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("balance-similar-node-groups"u8); writer.WriteStringValue(BalanceSimilarNodeGroups); } + if (Optional.IsDefined(DaemonsetEvictionForEmptyNodes)) + { + writer.WritePropertyName("daemonset-eviction-for-empty-nodes"u8); + writer.WriteBooleanValue(DaemonsetEvictionForEmptyNodes.Value); + } + if (Optional.IsDefined(DaemonsetEvictionForOccupiedNodes)) + { + writer.WritePropertyName("daemonset-eviction-for-occupied-nodes"u8); + writer.WriteBooleanValue(DaemonsetEvictionForOccupiedNodes.Value); + } + if (Optional.IsDefined(IgnoreDaemonsetsUtilization)) + { + writer.WritePropertyName("ignore-daemonsets-utilization"u8); + writer.WriteBooleanValue(IgnoreDaemonsetsUtilization.Value); + } if (Optional.IsDefined(Expander)) { writer.WritePropertyName("expander"u8); @@ -158,6 +173,9 @@ internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoSca return null; } string balanceSimilarNodeGroups = default; + bool? daemonsetEvictionForEmptyNodes = default; + bool? daemonsetEvictionForOccupiedNodes = default; + bool? ignoreDaemonsetsUtilization = default; AutoScaleExpander? expander = default; string maxEmptyBulkDelete = default; string maxGracefulTerminationSec = default; @@ -183,6 +201,33 @@ internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoSca balanceSimilarNodeGroups = property.Value.GetString(); continue; } + if (property.NameEquals("daemonset-eviction-for-empty-nodes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + daemonsetEvictionForEmptyNodes = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("daemonset-eviction-for-occupied-nodes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + daemonsetEvictionForOccupiedNodes = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("ignore-daemonsets-utilization"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ignoreDaemonsetsUtilization = property.Value.GetBoolean(); + continue; + } if (property.NameEquals("expander"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -275,6 +320,9 @@ internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoSca serializedAdditionalRawData = rawDataDictionary; return new ManagedClusterAutoScalerProfile( balanceSimilarNodeGroups, + daemonsetEvictionForEmptyNodes, + daemonsetEvictionForOccupiedNodes, + ignoreDaemonsetsUtilization, expander, maxEmptyBulkDelete, maxGracefulTerminationSec, @@ -328,6 +376,54 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DaemonsetEvictionForEmptyNodes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" daemonset-eviction-for-empty-nodes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DaemonsetEvictionForEmptyNodes)) + { + builder.Append(" daemonset-eviction-for-empty-nodes: "); + var boolValue = DaemonsetEvictionForEmptyNodes.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DaemonsetEvictionForOccupiedNodes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" daemonset-eviction-for-occupied-nodes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DaemonsetEvictionForOccupiedNodes)) + { + builder.Append(" daemonset-eviction-for-occupied-nodes: "); + var boolValue = DaemonsetEvictionForOccupiedNodes.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IgnoreDaemonsetsUtilization), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ignore-daemonsets-utilization: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IgnoreDaemonsetsUtilization)) + { + builder.Append(" ignore-daemonsets-utilization: "); + var boolValue = IgnoreDaemonsetsUtilization.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Expander), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs index 4cd1ca0a37ba..971361e05b8b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs @@ -52,7 +52,10 @@ public ManagedClusterAutoScalerProfile() /// Initializes a new instance of . /// Valid values are 'true' and 'false'. - /// If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information. + /// If set to true, all daemonset pods on empty nodes will be evicted before deletion of the node. If the daemonset pod cannot be evicted another node will be chosen for scaling. If set to false, the node will be deleted without ensuring that daemonset pods are deleted or evicted. + /// If set to true, all daemonset pods on occupied nodes will be evicted before deletion of the node. If the daemonset pod cannot be evicted another node will be chosen for scaling. If set to false, the node will be deleted without ensuring that daemonset pods are deleted or evicted. + /// If set to true, the resources used by daemonset will be taken into account when making scaling down decisions. + /// Available values are: 'least-waste', 'most-pods', 'priority', 'random'. /// The default is 10. /// The default is 600. /// The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. @@ -69,9 +72,12 @@ public ManagedClusterAutoScalerProfile() /// The default is true. /// The default is true. /// Keeps track of any properties unknown to the library. - internal ManagedClusterAutoScalerProfile(string balanceSimilarNodeGroups, AutoScaleExpander? expander, string maxEmptyBulkDelete, string maxGracefulTerminationSec, string maxNodeProvisionTime, string maxTotalUnreadyPercentage, string newPodScaleUpDelay, string okTotalUnreadyCount, string scanIntervalInSeconds, string scaleDownDelayAfterAdd, string scaleDownDelayAfterDelete, string scaleDownDelayAfterFailure, string scaleDownUnneededTime, string scaleDownUnreadyTime, string scaleDownUtilizationThreshold, string skipNodesWithLocalStorage, string skipNodesWithSystemPods, IDictionary serializedAdditionalRawData) + internal ManagedClusterAutoScalerProfile(string balanceSimilarNodeGroups, bool? daemonsetEvictionForEmptyNodes, bool? daemonsetEvictionForOccupiedNodes, bool? ignoreDaemonsetsUtilization, AutoScaleExpander? expander, string maxEmptyBulkDelete, string maxGracefulTerminationSec, string maxNodeProvisionTime, string maxTotalUnreadyPercentage, string newPodScaleUpDelay, string okTotalUnreadyCount, string scanIntervalInSeconds, string scaleDownDelayAfterAdd, string scaleDownDelayAfterDelete, string scaleDownDelayAfterFailure, string scaleDownUnneededTime, string scaleDownUnreadyTime, string scaleDownUtilizationThreshold, string skipNodesWithLocalStorage, string skipNodesWithSystemPods, IDictionary serializedAdditionalRawData) { BalanceSimilarNodeGroups = balanceSimilarNodeGroups; + DaemonsetEvictionForEmptyNodes = daemonsetEvictionForEmptyNodes; + DaemonsetEvictionForOccupiedNodes = daemonsetEvictionForOccupiedNodes; + IgnoreDaemonsetsUtilization = ignoreDaemonsetsUtilization; Expander = expander; MaxEmptyBulkDelete = maxEmptyBulkDelete; MaxGracefulTerminationSec = maxGracefulTerminationSec; @@ -94,7 +100,16 @@ internal ManagedClusterAutoScalerProfile(string balanceSimilarNodeGroups, AutoSc /// Valid values are 'true' and 'false'. [WirePath("balance-similar-node-groups")] public string BalanceSimilarNodeGroups { get; set; } - /// If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information. + /// If set to true, all daemonset pods on empty nodes will be evicted before deletion of the node. If the daemonset pod cannot be evicted another node will be chosen for scaling. If set to false, the node will be deleted without ensuring that daemonset pods are deleted or evicted. + [WirePath("daemonset-eviction-for-empty-nodes")] + public bool? DaemonsetEvictionForEmptyNodes { get; set; } + /// If set to true, all daemonset pods on occupied nodes will be evicted before deletion of the node. If the daemonset pod cannot be evicted another node will be chosen for scaling. If set to false, the node will be deleted without ensuring that daemonset pods are deleted or evicted. + [WirePath("daemonset-eviction-for-occupied-nodes")] + public bool? DaemonsetEvictionForOccupiedNodes { get; set; } + /// If set to true, the resources used by daemonset will be taken into account when making scaling down decisions. + [WirePath("ignore-daemonsets-utilization")] + public bool? IgnoreDaemonsetsUtilization { get; set; } + /// Available values are: 'least-waste', 'most-pods', 'priority', 'random'. [WirePath("expander")] public AutoScaleExpander? Expander { get; set; } /// The default is 10. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs index 9caa4775c4ba..091d6c30c7b5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs @@ -52,7 +52,7 @@ public ManagedClusterAutoUpgradeProfile() /// Initializes a new instance of . /// For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). - /// Manner in which the OS on your nodes is updated. The default is NodeImage. + /// The default is Unmanaged, but may change to either NodeImage or SecurityPatch at GA. /// Keeps track of any properties unknown to the library. internal ManagedClusterAutoUpgradeProfile(UpgradeChannel? upgradeChannel, ManagedClusterNodeOSUpgradeChannel? nodeOSUpgradeChannel, IDictionary serializedAdditionalRawData) { @@ -64,7 +64,7 @@ internal ManagedClusterAutoUpgradeProfile(UpgradeChannel? upgradeChannel, Manage /// For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). [WirePath("upgradeChannel")] public UpgradeChannel? UpgradeChannel { get; set; } - /// Manner in which the OS on your nodes is updated. The default is NodeImage. + /// The default is Unmanaged, but may change to either NodeImage or SecurityPatch at GA. [WirePath("nodeOSUpgradeChannel")] public ManagedClusterNodeOSUpgradeChannel? NodeOSUpgradeChannel { get; set; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.Serialization.cs index 34b3e2249f3f..43711da619c0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.Serialization.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterAzureMonitorProfile : IUtf8JsonSerializable, IJsonModel + public partial class ManagedClusterAzureMonitorProfile : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -40,6 +40,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("metrics"u8); writer.WriteObjectValue(Metrics, options); } + if (Optional.IsDefined(ContainerInsights)) + { + writer.WritePropertyName("containerInsights"u8); + writer.WriteObjectValue(ContainerInsights, options); + } + if (Optional.IsDefined(AppMonitoring)) + { + writer.WritePropertyName("appMonitoring"u8); + writer.WriteObjectValue(AppMonitoring, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -78,6 +88,8 @@ internal static ManagedClusterAzureMonitorProfile DeserializeManagedClusterAzure return null; } ManagedClusterMonitorProfileMetrics metrics = default; + ManagedClusterAzureMonitorProfileContainerInsights containerInsights = default; + ManagedClusterAzureMonitorProfileAppMonitoring appMonitoring = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -91,13 +103,31 @@ internal static ManagedClusterAzureMonitorProfile DeserializeManagedClusterAzure metrics = ManagedClusterMonitorProfileMetrics.DeserializeManagedClusterMonitorProfileMetrics(property.Value, options); continue; } + if (property.NameEquals("containerInsights"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerInsights = ManagedClusterAzureMonitorProfileContainerInsights.DeserializeManagedClusterAzureMonitorProfileContainerInsights(property.Value, options); + continue; + } + if (property.NameEquals("appMonitoring"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + appMonitoring = ManagedClusterAzureMonitorProfileAppMonitoring.DeserializeManagedClusterAzureMonitorProfileAppMonitoring(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterAzureMonitorProfile(metrics, serializedAdditionalRawData); + return new ManagedClusterAzureMonitorProfile(metrics, containerInsights, appMonitoring, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -126,6 +156,36 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContainerInsights), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" containerInsights: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContainerInsights)) + { + builder.Append(" containerInsights: "); + BicepSerializationHelpers.AppendChildObject(builder, ContainerInsights, options, 2, false, " containerInsights: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AppMonitoring), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" appMonitoring: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AppMonitoring)) + { + builder.Append(" appMonitoring: "); + BicepSerializationHelpers.AppendChildObject(builder, AppMonitoring, options, 2, false, " appMonitoring: "); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs index 271a2f5835c8..c344e98b7099 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Azure Monitor addon profiles for monitoring the managed cluster. - internal partial class ManagedClusterAzureMonitorProfile + /// Prometheus addon profile for the container service cluster. + public partial class ManagedClusterAzureMonitorProfile { /// /// Keeps track of any properties unknown to the library. @@ -51,16 +51,26 @@ public ManagedClusterAzureMonitorProfile() } /// Initializes a new instance of . - /// Metrics profile for the Azure Monitor managed service for Prometheus addon. Collect out-of-the-box Kubernetes infrastructure metrics to send to an Azure Monitor Workspace and configure additional scraping for custom targets. See aka.ms/AzureManagedPrometheus for an overview. + /// Metrics profile for the prometheus service addon. + /// Azure Monitor Container Insights Profile for Kubernetes Events, Inventory and Container stdout & stderr logs etc. See aka.ms/AzureMonitorContainerInsights for an overview. + /// Application Monitoring Profile for Kubernetes Application Container. Collects application logs, metrics and traces through auto-instrumentation of the application using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. /// Keeps track of any properties unknown to the library. - internal ManagedClusterAzureMonitorProfile(ManagedClusterMonitorProfileMetrics metrics, IDictionary serializedAdditionalRawData) + internal ManagedClusterAzureMonitorProfile(ManagedClusterMonitorProfileMetrics metrics, ManagedClusterAzureMonitorProfileContainerInsights containerInsights, ManagedClusterAzureMonitorProfileAppMonitoring appMonitoring, IDictionary serializedAdditionalRawData) { Metrics = metrics; + ContainerInsights = containerInsights; + AppMonitoring = appMonitoring; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Metrics profile for the Azure Monitor managed service for Prometheus addon. Collect out-of-the-box Kubernetes infrastructure metrics to send to an Azure Monitor Workspace and configure additional scraping for custom targets. See aka.ms/AzureManagedPrometheus for an overview. + /// Metrics profile for the prometheus service addon. [WirePath("metrics")] public ManagedClusterMonitorProfileMetrics Metrics { get; set; } + /// Azure Monitor Container Insights Profile for Kubernetes Events, Inventory and Container stdout & stderr logs etc. See aka.ms/AzureMonitorContainerInsights for an overview. + [WirePath("containerInsights")] + public ManagedClusterAzureMonitorProfileContainerInsights ContainerInsights { get; set; } + /// Application Monitoring Profile for Kubernetes Application Container. Collects application logs, metrics and traces through auto-instrumentation of the application using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + [WirePath("appMonitoring")] + public ManagedClusterAzureMonitorProfileAppMonitoring AppMonitoring { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoring.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoring.Serialization.cs new file mode 100644 index 000000000000..7087d2f03a0e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoring.Serialization.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterAzureMonitorProfileAppMonitoring : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoring)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AutoInstrumentation)) + { + writer.WritePropertyName("autoInstrumentation"u8); + writer.WriteObjectValue(AutoInstrumentation, options); + } + if (Optional.IsDefined(OpenTelemetryMetrics)) + { + writer.WritePropertyName("openTelemetryMetrics"u8); + writer.WriteObjectValue(OpenTelemetryMetrics, options); + } + if (Optional.IsDefined(OpenTelemetryLogs)) + { + writer.WritePropertyName("openTelemetryLogs"u8); + writer.WriteObjectValue(OpenTelemetryLogs, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterAzureMonitorProfileAppMonitoring IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoring)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAzureMonitorProfileAppMonitoring(document.RootElement, options); + } + + internal static ManagedClusterAzureMonitorProfileAppMonitoring DeserializeManagedClusterAzureMonitorProfileAppMonitoring(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation autoInstrumentation = default; + ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics openTelemetryMetrics = default; + ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs openTelemetryLogs = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("autoInstrumentation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoInstrumentation = ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation.DeserializeManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation(property.Value, options); + continue; + } + if (property.NameEquals("openTelemetryMetrics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + openTelemetryMetrics = ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics.DeserializeManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics(property.Value, options); + continue; + } + if (property.NameEquals("openTelemetryLogs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + openTelemetryLogs = ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs.DeserializeManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterAzureMonitorProfileAppMonitoring(autoInstrumentation, openTelemetryMetrics, openTelemetryLogs, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("AutoInstrumentationEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" autoInstrumentation: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(AutoInstrumentation)) + { + builder.Append(" autoInstrumentation: "); + BicepSerializationHelpers.AppendChildObject(builder, AutoInstrumentation, options, 2, false, " autoInstrumentation: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OpenTelemetryMetrics), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" openTelemetryMetrics: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(OpenTelemetryMetrics)) + { + builder.Append(" openTelemetryMetrics: "); + BicepSerializationHelpers.AppendChildObject(builder, OpenTelemetryMetrics, options, 2, false, " openTelemetryMetrics: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OpenTelemetryLogs), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" openTelemetryLogs: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(OpenTelemetryLogs)) + { + builder.Append(" openTelemetryLogs: "); + BicepSerializationHelpers.AppendChildObject(builder, OpenTelemetryLogs, options, 2, false, " openTelemetryLogs: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoring)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterAzureMonitorProfileAppMonitoring IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterAzureMonitorProfileAppMonitoring(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoring)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoring.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoring.cs new file mode 100644 index 000000000000..25c1f76827be --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoring.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Application Monitoring Profile for Kubernetes Application Container. Collects application logs, metrics and traces through auto-instrumentation of the application using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + public partial class ManagedClusterAzureMonitorProfileAppMonitoring + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterAzureMonitorProfileAppMonitoring() + { + } + + /// Initializes a new instance of . + /// Application Monitoring Auto Instrumentation for Kubernetes Application Container. Deploys web hook to auto-instrument Azure Monitor OpenTelemetry based SDKs to collect OpenTelemetry metrics, logs and traces of the application. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + /// Application Monitoring Open Telemetry Metrics Profile for Kubernetes Application Container Metrics. Collects OpenTelemetry metrics of the application using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + /// Application Monitoring Open Telemetry Metrics Profile for Kubernetes Application Container Logs and Traces. Collects OpenTelemetry logs and traces of the application using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAzureMonitorProfileAppMonitoring(ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation autoInstrumentation, ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics openTelemetryMetrics, ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs openTelemetryLogs, IDictionary serializedAdditionalRawData) + { + AutoInstrumentation = autoInstrumentation; + OpenTelemetryMetrics = openTelemetryMetrics; + OpenTelemetryLogs = openTelemetryLogs; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Application Monitoring Auto Instrumentation for Kubernetes Application Container. Deploys web hook to auto-instrument Azure Monitor OpenTelemetry based SDKs to collect OpenTelemetry metrics, logs and traces of the application. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + internal ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation AutoInstrumentation { get; set; } + /// Indicates if Application Monitoring Auto Instrumentation is enabled or not. + [WirePath("autoInstrumentation.enabled")] + public bool? AutoInstrumentationEnabled + { + get => AutoInstrumentation is null ? default : AutoInstrumentation.Enabled; + set + { + if (AutoInstrumentation is null) + AutoInstrumentation = new ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation(); + AutoInstrumentation.Enabled = value; + } + } + + /// Application Monitoring Open Telemetry Metrics Profile for Kubernetes Application Container Metrics. Collects OpenTelemetry metrics of the application using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + [WirePath("openTelemetryMetrics")] + public ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics OpenTelemetryMetrics { get; set; } + /// Application Monitoring Open Telemetry Metrics Profile for Kubernetes Application Container Logs and Traces. Collects OpenTelemetry logs and traces of the application using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + [WirePath("openTelemetryLogs")] + public ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs OpenTelemetryLogs { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation.Serialization.cs new file mode 100644 index 000000000000..66f36e31d01c --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation(document.RootElement, options); + } + + internal static ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation DeserializeManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation.cs new file mode 100644 index 000000000000..9973f7486cd9 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Application Monitoring Auto Instrumentation for Kubernetes Application Container. Deploys web hook to auto-instrument Azure Monitor OpenTelemetry based SDKs to collect OpenTelemetry metrics, logs and traces of the application. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + internal partial class ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation() + { + } + + /// Initializes a new instance of . + /// Indicates if Application Monitoring Auto Instrumentation is enabled or not. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAzureMonitorProfileAppMonitoringAutoInstrumentation(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates if Application Monitoring Auto Instrumentation is enabled or not. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs.Serialization.cs new file mode 100644 index 000000000000..51d8d9ebacf3 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs(document.RootElement, options); + } + + internal static ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs DeserializeManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + long? port = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("port"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs(enabled, port, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Port), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" port: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Port)) + { + builder.Append(" port: "); + builder.AppendLine($"'{Port.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs.cs new file mode 100644 index 000000000000..0d810cbc4a19 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Application Monitoring Open Telemetry Metrics Profile for Kubernetes Application Container Logs and Traces. Collects OpenTelemetry logs and traces of the application using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + public partial class ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs() + { + } + + /// Initializes a new instance of . + /// Indicates if Application Monitoring Open Telemetry Logs and traces is enabled or not. + /// The Open Telemetry host port for Open Telemetry logs and traces. If not specified, the default port is 28331. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryLogs(bool? enabled, long? port, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates if Application Monitoring Open Telemetry Logs and traces is enabled or not. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// The Open Telemetry host port for Open Telemetry logs and traces. If not specified, the default port is 28331. + [WirePath("port")] + public long? Port { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics.Serialization.cs new file mode 100644 index 000000000000..7e7a0dad35af --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics(document.RootElement, options); + } + + internal static ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics DeserializeManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + long? port = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("port"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics(enabled, port, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Port), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" port: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Port)) + { + builder.Append(" port: "); + builder.AppendLine($"'{Port.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics.cs new file mode 100644 index 000000000000..9ec2c91897dd --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Application Monitoring Open Telemetry Metrics Profile for Kubernetes Application Container Metrics. Collects OpenTelemetry metrics of the application using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + public partial class ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics() + { + } + + /// Initializes a new instance of . + /// Indicates if Application Monitoring Open Telemetry Metrics is enabled or not. + /// The Open Telemetry host port for Open Telemetry metrics. If not specified, the default port is 28333. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics(bool? enabled, long? port, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates if Application Monitoring Open Telemetry Metrics is enabled or not. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// The Open Telemetry host port for Open Telemetry metrics. If not specified, the default port is 28333. + [WirePath("port")] + public long? Port { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileContainerInsights.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileContainerInsights.Serialization.cs new file mode 100644 index 000000000000..f2b811ecf852 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileContainerInsights.Serialization.cs @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterAzureMonitorProfileContainerInsights : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileContainerInsights)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(LogAnalyticsWorkspaceResourceId)) + { + writer.WritePropertyName("logAnalyticsWorkspaceResourceId"u8); + writer.WriteStringValue(LogAnalyticsWorkspaceResourceId); + } + if (Optional.IsDefined(SyslogPort)) + { + writer.WritePropertyName("syslogPort"u8); + writer.WriteNumberValue(SyslogPort.Value); + } + if (Optional.IsDefined(DisableCustomMetrics)) + { + writer.WritePropertyName("disableCustomMetrics"u8); + writer.WriteBooleanValue(DisableCustomMetrics.Value); + } + if (Optional.IsDefined(DisablePrometheusMetricsScraping)) + { + writer.WritePropertyName("disablePrometheusMetricsScraping"u8); + writer.WriteBooleanValue(DisablePrometheusMetricsScraping.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterAzureMonitorProfileContainerInsights IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileContainerInsights)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAzureMonitorProfileContainerInsights(document.RootElement, options); + } + + internal static ManagedClusterAzureMonitorProfileContainerInsights DeserializeManagedClusterAzureMonitorProfileContainerInsights(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + ResourceIdentifier logAnalyticsWorkspaceResourceId = default; + long? syslogPort = default; + bool? disableCustomMetrics = default; + bool? disablePrometheusMetricsScraping = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("logAnalyticsWorkspaceResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logAnalyticsWorkspaceResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("syslogPort"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + syslogPort = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("disableCustomMetrics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableCustomMetrics = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("disablePrometheusMetricsScraping"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disablePrometheusMetricsScraping = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterAzureMonitorProfileContainerInsights( + enabled, + logAnalyticsWorkspaceResourceId, + syslogPort, + disableCustomMetrics, + disablePrometheusMetricsScraping, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LogAnalyticsWorkspaceResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" logAnalyticsWorkspaceResourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LogAnalyticsWorkspaceResourceId)) + { + builder.Append(" logAnalyticsWorkspaceResourceId: "); + builder.AppendLine($"'{LogAnalyticsWorkspaceResourceId.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SyslogPort), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" syslogPort: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SyslogPort)) + { + builder.Append(" syslogPort: "); + builder.AppendLine($"'{SyslogPort.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisableCustomMetrics), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" disableCustomMetrics: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DisableCustomMetrics)) + { + builder.Append(" disableCustomMetrics: "); + var boolValue = DisableCustomMetrics.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisablePrometheusMetricsScraping), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" disablePrometheusMetricsScraping: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DisablePrometheusMetricsScraping)) + { + builder.Append(" disablePrometheusMetricsScraping: "); + var boolValue = DisablePrometheusMetricsScraping.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileContainerInsights)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterAzureMonitorProfileContainerInsights IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterAzureMonitorProfileContainerInsights(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfileContainerInsights)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileContainerInsights.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileContainerInsights.cs new file mode 100644 index 000000000000..33dad4d8f66d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileContainerInsights.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Azure Monitor Container Insights Profile for Kubernetes Events, Inventory and Container stdout & stderr logs etc. See aka.ms/AzureMonitorContainerInsights for an overview. + public partial class ManagedClusterAzureMonitorProfileContainerInsights + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterAzureMonitorProfileContainerInsights() + { + } + + /// Initializes a new instance of . + /// Indicates if Azure Monitor Container Insights Logs Addon is enabled or not. + /// Fully Qualified ARM Resource Id of Azure Log Analytics Workspace for storing Azure Monitor Container Insights Logs. + /// The syslog host port. If not specified, the default port is 28330. + /// Indicates whether custom metrics collection has to be disabled or not. If not specified the default is false. No custom metrics will be emitted if this field is false but the container insights enabled field is false. + /// Indicates whether prometheus metrics scraping is disabled or not. If not specified the default is false. No prometheus metrics will be emitted if this field is false but the container insights enabled field is false. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAzureMonitorProfileContainerInsights(bool? enabled, ResourceIdentifier logAnalyticsWorkspaceResourceId, long? syslogPort, bool? disableCustomMetrics, bool? disablePrometheusMetricsScraping, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; + SyslogPort = syslogPort; + DisableCustomMetrics = disableCustomMetrics; + DisablePrometheusMetricsScraping = disablePrometheusMetricsScraping; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates if Azure Monitor Container Insights Logs Addon is enabled or not. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Fully Qualified ARM Resource Id of Azure Log Analytics Workspace for storing Azure Monitor Container Insights Logs. + [WirePath("logAnalyticsWorkspaceResourceId")] + public ResourceIdentifier LogAnalyticsWorkspaceResourceId { get; set; } + /// The syslog host port. If not specified, the default port is 28330. + [WirePath("syslogPort")] + public long? SyslogPort { get; set; } + /// Indicates whether custom metrics collection has to be disabled or not. If not specified the default is false. No custom metrics will be emitted if this field is false but the container insights enabled field is false. + [WirePath("disableCustomMetrics")] + public bool? DisableCustomMetrics { get; set; } + /// Indicates whether prometheus metrics scraping is disabled or not. If not specified the default is false. No prometheus metrics will be emitted if this field is false but the container insights enabled field is false. + [WirePath("disablePrometheusMetricsScraping")] + public bool? DisablePrometheusMetricsScraping { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.Serialization.cs new file mode 100644 index 000000000000..ddd49428e4b2 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterBootstrapProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterBootstrapProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ArtifactSource)) + { + writer.WritePropertyName("artifactSource"u8); + writer.WriteStringValue(ArtifactSource.Value.ToString()); + } + if (Optional.IsDefined(ContainerRegistryId)) + { + writer.WritePropertyName("containerRegistryId"u8); + writer.WriteStringValue(ContainerRegistryId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterBootstrapProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterBootstrapProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterBootstrapProfile(document.RootElement, options); + } + + internal static ManagedClusterBootstrapProfile DeserializeManagedClusterBootstrapProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ArtifactSource? artifactSource = default; + ResourceIdentifier containerRegistryId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactSource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactSource = new ArtifactSource(property.Value.GetString()); + continue; + } + if (property.NameEquals("containerRegistryId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerRegistryId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterBootstrapProfile(artifactSource, containerRegistryId, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ArtifactSource), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" artifactSource: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ArtifactSource)) + { + builder.Append(" artifactSource: "); + builder.AppendLine($"'{ArtifactSource.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContainerRegistryId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" containerRegistryId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContainerRegistryId)) + { + builder.Append(" containerRegistryId: "); + builder.AppendLine($"'{ContainerRegistryId.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterBootstrapProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterBootstrapProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterBootstrapProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterBootstrapProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.cs new file mode 100644 index 000000000000..e7b95028c2a0 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterBootstrapProfile.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The bootstrap profile. + public partial class ManagedClusterBootstrapProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterBootstrapProfile() + { + } + + /// Initializes a new instance of . + /// The source where the artifacts are downloaded from. + /// The resource Id of Azure Container Registry. The registry must have private network access, premium SKU and zone redundancy. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterBootstrapProfile(ArtifactSource? artifactSource, ResourceIdentifier containerRegistryId, IDictionary serializedAdditionalRawData) + { + ArtifactSource = artifactSource; + ContainerRegistryId = containerRegistryId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The source where the artifacts are downloaded from. + [WirePath("artifactSource")] + public ArtifactSource? ArtifactSource { get; set; } + /// The resource Id of Azure Container Registry. The registry must have private network access, premium SKU and zone redundancy. + [WirePath("containerRegistryId")] + public ResourceIdentifier ContainerRegistryId { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.Serialization.cs new file mode 100644 index 000000000000..fe5820f61d2b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterCostAnalysis : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterCostAnalysis)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterCostAnalysis IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterCostAnalysis)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterCostAnalysis(document.RootElement, options); + } + + internal static ManagedClusterCostAnalysis DeserializeManagedClusterCostAnalysis(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterCostAnalysis(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterCostAnalysis)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterCostAnalysis IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterCostAnalysis(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterCostAnalysis)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.cs new file mode 100644 index 000000000000..63379cdd6fdf --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCostAnalysis.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The cost analysis configuration for the cluster. + internal partial class ManagedClusterCostAnalysis + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterCostAnalysis() + { + } + + /// Initializes a new instance of . + /// The Managed Cluster sku.tier must be set to 'Standard' or 'Premium' to enable this feature. Enabling this will add Kubernetes Namespace and Deployment details to the Cost Analysis views in the Azure portal. If not specified, the default is false. For more information see aka.ms/aks/docs/cost-analysis. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterCostAnalysis(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The Managed Cluster sku.tier must be set to 'Standard' or 'Premium' to enable this feature. Enabling this will add Kubernetes Namespace and Deployment details to the Cost Analysis views in the Azure portal. If not specified, the default is false. For more information see aka.ms/aks/docs/cost-analysis. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.Serialization.cs index c5168270ebd1..72b47de9cc03 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.Serialization.cs @@ -56,11 +56,26 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (options.Format != "W" && Optional.IsCollectionDefined(EffectiveNoProxy)) + { + writer.WritePropertyName("effectiveNoProxy"u8); + writer.WriteStartArray(); + foreach (var item in EffectiveNoProxy) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } if (Optional.IsDefined(TrustedCA)) { writer.WritePropertyName("trustedCa"u8); writer.WriteStringValue(TrustedCA); } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -101,7 +116,9 @@ internal static ManagedClusterHttpProxyConfig DeserializeManagedClusterHttpProxy string httpProxy = default; string httpsProxy = default; IList noProxy = default; + IReadOnlyList effectiveNoProxy = default; string trustedCA = default; + bool? enabled = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -130,18 +147,48 @@ internal static ManagedClusterHttpProxyConfig DeserializeManagedClusterHttpProxy noProxy = array; continue; } + if (property.NameEquals("effectiveNoProxy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + effectiveNoProxy = array; + continue; + } if (property.NameEquals("trustedCa"u8)) { trustedCA = property.Value.GetString(); continue; } + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterHttpProxyConfig(httpProxy, httpsProxy, noProxy ?? new ChangeTrackingList(), trustedCA, serializedAdditionalRawData); + return new ManagedClusterHttpProxyConfig( + httpProxy, + httpsProxy, + noProxy ?? new ChangeTrackingList(), + effectiveNoProxy ?? new ChangeTrackingList(), + trustedCA, + enabled, + serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -237,6 +284,42 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EffectiveNoProxy), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" effectiveNoProxy: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(EffectiveNoProxy)) + { + if (EffectiveNoProxy.Any()) + { + builder.Append(" effectiveNoProxy: "); + builder.AppendLine("["); + foreach (var item in EffectiveNoProxy) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TrustedCA), out propertyOverride); if (hasPropertyOverride) { @@ -260,6 +343,22 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs index 0364bd27b21f..e6661a7cbed3 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs @@ -49,20 +49,25 @@ public partial class ManagedClusterHttpProxyConfig public ManagedClusterHttpProxyConfig() { NoProxy = new ChangeTrackingList(); + EffectiveNoProxy = new ChangeTrackingList(); } /// Initializes a new instance of . /// The HTTP proxy server endpoint to use. /// The HTTPS proxy server endpoint to use. /// The endpoints that should not go through proxy. + /// A read-only list of all endpoints for which traffic should not be sent to the proxy. This list is a superset of noProxy and values injected by AKS. /// Alternative CA cert to use for connecting to proxy servers. + /// Whether to enable HTTP proxy. When disabled, the specified proxy configuration will be not be set on pods and nodes. /// Keeps track of any properties unknown to the library. - internal ManagedClusterHttpProxyConfig(string httpProxy, string httpsProxy, IList noProxy, string trustedCA, IDictionary serializedAdditionalRawData) + internal ManagedClusterHttpProxyConfig(string httpProxy, string httpsProxy, IList noProxy, IReadOnlyList effectiveNoProxy, string trustedCA, bool? enabled, IDictionary serializedAdditionalRawData) { HttpProxy = httpProxy; HttpsProxy = httpsProxy; NoProxy = noProxy; + EffectiveNoProxy = effectiveNoProxy; TrustedCA = trustedCA; + Enabled = enabled; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -75,8 +80,14 @@ internal ManagedClusterHttpProxyConfig(string httpProxy, string httpsProxy, ILis /// The endpoints that should not go through proxy. [WirePath("noProxy")] public IList NoProxy { get; } + /// A read-only list of all endpoints for which traffic should not be sent to the proxy. This list is a superset of noProxy and values injected by AKS. + [WirePath("effectiveNoProxy")] + public IReadOnlyList EffectiveNoProxy { get; } /// Alternative CA cert to use for connecting to proxy servers. [WirePath("trustedCa")] public string TrustedCA { get; set; } + /// Whether to enable HTTP proxy. When disabled, the specified proxy configuration will be not be set on pods and nodes. + [WirePath("enabled")] + public bool? Enabled { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs new file mode 100644 index 000000000000..64f368711676 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterIngressProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterIngressProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(WebAppRouting)) + { + writer.WritePropertyName("webAppRouting"u8); + writer.WriteObjectValue(WebAppRouting, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterIngressProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterIngressProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterIngressProfile(document.RootElement, options); + } + + internal static ManagedClusterIngressProfile DeserializeManagedClusterIngressProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedClusterIngressProfileWebAppRouting webAppRouting = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("webAppRouting"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + webAppRouting = ManagedClusterIngressProfileWebAppRouting.DeserializeManagedClusterIngressProfileWebAppRouting(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterIngressProfile(webAppRouting, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WebAppRouting), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" webAppRouting: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(WebAppRouting)) + { + builder.Append(" webAppRouting: "); + BicepSerializationHelpers.AppendChildObject(builder, WebAppRouting, options, 2, false, " webAppRouting: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterIngressProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterIngressProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterIngressProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterIngressProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs new file mode 100644 index 000000000000..8f78e05a26b2 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Ingress profile for the container service cluster. + internal partial class ManagedClusterIngressProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterIngressProfile() + { + } + + /// Initializes a new instance of . + /// Web App Routing settings for the ingress profile. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterIngressProfile(ManagedClusterIngressProfileWebAppRouting webAppRouting, IDictionary serializedAdditionalRawData) + { + WebAppRouting = webAppRouting; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Web App Routing settings for the ingress profile. + [WirePath("webAppRouting")] + public ManagedClusterIngressProfileWebAppRouting WebAppRouting { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileNginx.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileNginx.Serialization.cs new file mode 100644 index 000000000000..f2d4d6e991a1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileNginx.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterIngressProfileNginx : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileNginx)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DefaultIngressControllerType)) + { + writer.WritePropertyName("defaultIngressControllerType"u8); + writer.WriteStringValue(DefaultIngressControllerType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterIngressProfileNginx IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileNginx)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterIngressProfileNginx(document.RootElement, options); + } + + internal static ManagedClusterIngressProfileNginx DeserializeManagedClusterIngressProfileNginx(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NginxIngressControllerType? defaultIngressControllerType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("defaultIngressControllerType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultIngressControllerType = new NginxIngressControllerType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterIngressProfileNginx(defaultIngressControllerType, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultIngressControllerType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" defaultIngressControllerType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DefaultIngressControllerType)) + { + builder.Append(" defaultIngressControllerType: "); + builder.AppendLine($"'{DefaultIngressControllerType.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileNginx)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterIngressProfileNginx IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterIngressProfileNginx(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileNginx)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileNginx.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileNginx.cs new file mode 100644 index 000000000000..34e1e374ce3c --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileNginx.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The ManagedClusterIngressProfileNginx. + internal partial class ManagedClusterIngressProfileNginx + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterIngressProfileNginx() + { + } + + /// Initializes a new instance of . + /// Ingress type for the default NginxIngressController custom resource. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterIngressProfileNginx(NginxIngressControllerType? defaultIngressControllerType, IDictionary serializedAdditionalRawData) + { + DefaultIngressControllerType = defaultIngressControllerType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Ingress type for the default NginxIngressController custom resource. + [WirePath("defaultIngressControllerType")] + public NginxIngressControllerType? DefaultIngressControllerType { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs new file mode 100644 index 000000000000..fb5c639e4b33 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterIngressProfileWebAppRouting : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileWebAppRouting)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsCollectionDefined(DnsZoneResourceIds)) + { + writer.WritePropertyName("dnsZoneResourceIds"u8); + writer.WriteStartArray(); + foreach (var item in DnsZoneResourceIds) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Nginx)) + { + writer.WritePropertyName("nginx"u8); + writer.WriteObjectValue(Nginx, options); + } + if (options.Format != "W" && Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterIngressProfileWebAppRouting IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileWebAppRouting)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterIngressProfileWebAppRouting(document.RootElement, options); + } + + internal static ManagedClusterIngressProfileWebAppRouting DeserializeManagedClusterIngressProfileWebAppRouting(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IList dnsZoneResourceIds = default; + ManagedClusterIngressProfileNginx nginx = default; + ContainerServiceUserAssignedIdentity identity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("dnsZoneResourceIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(new ResourceIdentifier(item.GetString())); + } + } + dnsZoneResourceIds = array; + continue; + } + if (property.NameEquals("nginx"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nginx = ManagedClusterIngressProfileNginx.DeserializeManagedClusterIngressProfileNginx(property.Value, options); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ContainerServiceUserAssignedIdentity.DeserializeContainerServiceUserAssignedIdentity(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterIngressProfileWebAppRouting(enabled, dnsZoneResourceIds ?? new ChangeTrackingList(), nginx, identity, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsZoneResourceIds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsZoneResourceIds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(DnsZoneResourceIds)) + { + if (DnsZoneResourceIds.Any()) + { + builder.Append(" dnsZoneResourceIds: "); + builder.AppendLine("["); + foreach (var item in DnsZoneResourceIds) + { + if (item == null) + { + builder.Append("null"); + continue; + } + builder.AppendLine($" '{item.ToString()}'"); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("NginxDefaultIngressControllerType", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nginx: "); + builder.AppendLine("{"); + builder.Append(" defaultIngressControllerType: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Nginx)) + { + builder.Append(" nginx: "); + BicepSerializationHelpers.AppendChildObject(builder, Nginx, options, 2, false, " nginx: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" identity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Identity)) + { + builder.Append(" identity: "); + BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileWebAppRouting)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterIngressProfileWebAppRouting IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterIngressProfileWebAppRouting(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterIngressProfileWebAppRouting)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs new file mode 100644 index 000000000000..bbf3d9c4f520 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Web App Routing settings for the ingress profile. + public partial class ManagedClusterIngressProfileWebAppRouting + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterIngressProfileWebAppRouting() + { + DnsZoneResourceIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Whether to enable Web App Routing. + /// Resource IDs of the DNS zones to be associated with the Web App Routing add-on. Used only when Web App Routing is enabled. Public and private DNS zones can be in different resource groups, but all public DNS zones must be in the same resource group and all private DNS zones must be in the same resource group. + /// Configuration for the default NginxIngressController. See more at https://learn.microsoft.com/en-us/azure/aks/app-routing-nginx-configuration#the-default-nginx-ingress-controller. + /// Managed identity of the Web Application Routing add-on. This is the identity that should be granted permissions, for example, to manage the associated Azure DNS resource and get certificates from Azure Key Vault. See [this overview of the add-on](https://learn.microsoft.com/en-us/azure/aks/web-app-routing?tabs=with-osm) for more instructions. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterIngressProfileWebAppRouting(bool? enabled, IList dnsZoneResourceIds, ManagedClusterIngressProfileNginx nginx, ContainerServiceUserAssignedIdentity identity, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + DnsZoneResourceIds = dnsZoneResourceIds; + Nginx = nginx; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether to enable Web App Routing. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Resource IDs of the DNS zones to be associated with the Web App Routing add-on. Used only when Web App Routing is enabled. Public and private DNS zones can be in different resource groups, but all public DNS zones must be in the same resource group and all private DNS zones must be in the same resource group. + [WirePath("dnsZoneResourceIds")] + public IList DnsZoneResourceIds { get; } + /// Configuration for the default NginxIngressController. See more at https://learn.microsoft.com/en-us/azure/aks/app-routing-nginx-configuration#the-default-nginx-ingress-controller. + internal ManagedClusterIngressProfileNginx Nginx { get; set; } + /// Ingress type for the default NginxIngressController custom resource. + [WirePath("nginx.defaultIngressControllerType")] + public NginxIngressControllerType? NginxDefaultIngressControllerType + { + get => Nginx is null ? default : Nginx.DefaultIngressControllerType; + set + { + if (Nginx is null) + Nginx = new ManagedClusterIngressProfileNginx(); + Nginx.DefaultIngressControllerType = value; + } + } + + /// Managed identity of the Web Application Routing add-on. This is the identity that should be granted permissions, for example, to manage the associated Azure DNS resource and get certificates from Azure Key Vault. See [this overview of the add-on](https://learn.microsoft.com/en-us/azure/aks/web-app-routing?tabs=with-osm) for more instructions. + [WirePath("identity")] + public ContainerServiceUserAssignedIdentity Identity { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs index 9835a59fa46d..1e14bd713577 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs @@ -52,7 +52,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("outboundIPs"u8); writer.WriteObjectValue(OutboundIPs, options); } - if (Optional.IsCollectionDefined(EffectiveOutboundIPs)) + if (options.Format != "W" && Optional.IsCollectionDefined(EffectiveOutboundIPs)) { writer.WritePropertyName("effectiveOutboundIPs"u8); writer.WriteStartArray(); @@ -82,6 +82,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("backendPoolType"u8); writer.WriteStringValue(BackendPoolType.Value.ToString()); } + if (Optional.IsDefined(ClusterServiceLoadBalancerHealthProbeMode)) + { + writer.WritePropertyName("clusterServiceLoadBalancerHealthProbeMode"u8); + writer.WriteStringValue(ClusterServiceLoadBalancerHealthProbeMode.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -122,11 +127,12 @@ internal static ManagedClusterLoadBalancerProfile DeserializeManagedClusterLoadB ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = default; ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes = default; ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs = default; - IList effectiveOutboundIPs = default; + IReadOnlyList effectiveOutboundIPs = default; int? allocatedOutboundPorts = default; int? idleTimeoutInMinutes = default; bool? enableMultipleStandardLoadBalancers = default; ManagedClusterLoadBalancerBackendPoolType? backendPoolType = default; + ClusterServiceLoadBalancerHealthProbeMode? clusterServiceLoadBalancerHealthProbeMode = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -208,6 +214,15 @@ internal static ManagedClusterLoadBalancerProfile DeserializeManagedClusterLoadB backendPoolType = new ManagedClusterLoadBalancerBackendPoolType(property.Value.GetString()); continue; } + if (property.NameEquals("clusterServiceLoadBalancerHealthProbeMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clusterServiceLoadBalancerHealthProbeMode = new ClusterServiceLoadBalancerHealthProbeMode(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -223,6 +238,7 @@ internal static ManagedClusterLoadBalancerProfile DeserializeManagedClusterLoadB idleTimeoutInMinutes, enableMultipleStandardLoadBalancers, backendPoolType, + clusterServiceLoadBalancerHealthProbeMode, serializedAdditionalRawData); } @@ -372,6 +388,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClusterServiceLoadBalancerHealthProbeMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" clusterServiceLoadBalancerHealthProbeMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ClusterServiceLoadBalancerHealthProbeMode)) + { + builder.Append(" clusterServiceLoadBalancerHealthProbeMode: "); + builder.AppendLine($"'{ClusterServiceLoadBalancerHealthProbeMode.Value.ToString()}'"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs index a40f522564dc..9ee68dceb0af 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs @@ -61,8 +61,9 @@ public ManagedClusterLoadBalancerProfile() /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes. /// Enable multiple standard load balancers per AKS cluster or not. /// The type of the managed inbound Load Balancer BackendPool. + /// The health probing behavior for External Traffic Policy Cluster services. /// Keeps track of any properties unknown to the library. - internal ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs, ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes, ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs, IList effectiveOutboundIPs, int? allocatedOutboundPorts, int? idleTimeoutInMinutes, bool? enableMultipleStandardLoadBalancers, ManagedClusterLoadBalancerBackendPoolType? backendPoolType, IDictionary serializedAdditionalRawData) + internal ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs, ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes, ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs, IReadOnlyList effectiveOutboundIPs, int? allocatedOutboundPorts, int? idleTimeoutInMinutes, bool? enableMultipleStandardLoadBalancers, ManagedClusterLoadBalancerBackendPoolType? backendPoolType, ClusterServiceLoadBalancerHealthProbeMode? clusterServiceLoadBalancerHealthProbeMode, IDictionary serializedAdditionalRawData) { ManagedOutboundIPs = managedOutboundIPs; OutboundIPPrefixes = outboundIPPrefixes; @@ -72,6 +73,7 @@ internal ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileMana IdleTimeoutInMinutes = idleTimeoutInMinutes; EnableMultipleStandardLoadBalancers = enableMultipleStandardLoadBalancers; BackendPoolType = backendPoolType; + ClusterServiceLoadBalancerHealthProbeMode = clusterServiceLoadBalancerHealthProbeMode; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -108,7 +110,7 @@ public IList OutboundPublicIPs /// The effective outbound IP resources of the cluster load balancer. [WirePath("effectiveOutboundIPs")] - public IList EffectiveOutboundIPs { get; } + public IReadOnlyList EffectiveOutboundIPs { get; } /// The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports. [WirePath("allocatedOutboundPorts")] public int? AllocatedOutboundPorts { get; set; } @@ -121,5 +123,8 @@ public IList OutboundPublicIPs /// The type of the managed inbound Load Balancer BackendPool. [WirePath("backendPoolType")] public ManagedClusterLoadBalancerBackendPoolType? BackendPoolType { get; set; } + /// The health probing behavior for External Traffic Policy Cluster services. + [WirePath("clusterServiceLoadBalancerHealthProbeMode")] + public ClusterServiceLoadBalancerHealthProbeMode? ClusterServiceLoadBalancerHealthProbeMode { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.Serialization.cs new file mode 100644 index 000000000000..916275a9c3e8 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.Serialization.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterMetricsProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterMetricsProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(CostAnalysis)) + { + writer.WritePropertyName("costAnalysis"u8); + writer.WriteObjectValue(CostAnalysis, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterMetricsProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterMetricsProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterMetricsProfile(document.RootElement, options); + } + + internal static ManagedClusterMetricsProfile DeserializeManagedClusterMetricsProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedClusterCostAnalysis costAnalysis = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("costAnalysis"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + costAnalysis = ManagedClusterCostAnalysis.DeserializeManagedClusterCostAnalysis(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterMetricsProfile(costAnalysis, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("CostAnalysisEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" costAnalysis: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(CostAnalysis)) + { + builder.Append(" costAnalysis: "); + BicepSerializationHelpers.AppendChildObject(builder, CostAnalysis, options, 2, false, " costAnalysis: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterMetricsProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterMetricsProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterMetricsProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterMetricsProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.cs new file mode 100644 index 000000000000..32d90c17d3ff --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMetricsProfile.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The metrics profile for the ManagedCluster. + internal partial class ManagedClusterMetricsProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterMetricsProfile() + { + } + + /// Initializes a new instance of . + /// The cost analysis configuration for the cluster. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterMetricsProfile(ManagedClusterCostAnalysis costAnalysis, IDictionary serializedAdditionalRawData) + { + CostAnalysis = costAnalysis; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The cost analysis configuration for the cluster. + internal ManagedClusterCostAnalysis CostAnalysis { get; set; } + /// The Managed Cluster sku.tier must be set to 'Standard' or 'Premium' to enable this feature. Enabling this will add Kubernetes Namespace and Deployment details to the Cost Analysis views in the Azure portal. If not specified, the default is false. For more information see aka.ms/aks/docs/cost-analysis. + [WirePath("costAnalysis.enabled")] + public bool? CostAnalysisEnabled + { + get => CostAnalysis is null ? default : CostAnalysis.Enabled; + set + { + if (CostAnalysis is null) + CostAnalysis = new ManagedClusterCostAnalysis(); + CostAnalysis.Enabled = value; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs index 116f6cef5d12..540c4a5edd74 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Kube State Metrics profile for the Azure Managed Prometheus addon. These optional settings are for the kube-state-metrics pod that is deployed with the addon. See aka.ms/AzureManagedPrometheus-optional-parameters for details. + /// Kube State Metrics for prometheus addon profile for the container service cluster. public partial class ManagedClusterMonitorProfileKubeStateMetrics { /// @@ -51,8 +51,8 @@ public ManagedClusterMonitorProfileKubeStateMetrics() } /// Initializes a new instance of . - /// Comma-separated list of additional Kubernetes label keys that will be used in the resource's labels metric (Example: 'namespaces=[k8s-label-1,k8s-label-n,...],pods=[app],...'). By default the metric contains only resource name and namespace labels. - /// Comma-separated list of Kubernetes annotation keys that will be used in the resource's labels metric (Example: 'namespaces=[kubernetes.io/team,...],pods=[kubernetes.io/team],...'). By default the metric contains only resource name and namespace labels. + /// Comma-separated list of Kubernetes annotations keys that will be used in the resource's labels metric. + /// Comma-separated list of additional Kubernetes label keys that will be used in the resource's labels metric. /// Keeps track of any properties unknown to the library. internal ManagedClusterMonitorProfileKubeStateMetrics(string metricLabelsAllowlist, string metricAnnotationsAllowList, IDictionary serializedAdditionalRawData) { @@ -61,10 +61,10 @@ internal ManagedClusterMonitorProfileKubeStateMetrics(string metricLabelsAllowli _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Comma-separated list of additional Kubernetes label keys that will be used in the resource's labels metric (Example: 'namespaces=[k8s-label-1,k8s-label-n,...],pods=[app],...'). By default the metric contains only resource name and namespace labels. + /// Comma-separated list of Kubernetes annotations keys that will be used in the resource's labels metric. [WirePath("metricLabelsAllowlist")] public string MetricLabelsAllowlist { get; set; } - /// Comma-separated list of Kubernetes annotation keys that will be used in the resource's labels metric (Example: 'namespaces=[kubernetes.io/team,...],pods=[kubernetes.io/team],...'). By default the metric contains only resource name and namespace labels. + /// Comma-separated list of additional Kubernetes label keys that will be used in the resource's labels metric. [WirePath("metricAnnotationsAllowList")] public string MetricAnnotationsAllowList { get; set; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs index ad0cbaa3c2b8..7eed6d287880 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Metrics profile for the Azure Monitor managed service for Prometheus addon. Collect out-of-the-box Kubernetes infrastructure metrics to send to an Azure Monitor Workspace and configure additional scraping for custom targets. See aka.ms/AzureManagedPrometheus for an overview. + /// Metrics profile for the prometheus service addon. public partial class ManagedClusterMonitorProfileMetrics { /// @@ -46,15 +46,15 @@ public partial class ManagedClusterMonitorProfileMetrics private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// Whether to enable or disable the Azure Managed Prometheus addon for Prometheus monitoring. See aka.ms/AzureManagedPrometheus-aks-enable for details on enabling and disabling. + /// Whether to enable the Prometheus collector. public ManagedClusterMonitorProfileMetrics(bool isEnabled) { IsEnabled = isEnabled; } /// Initializes a new instance of . - /// Whether to enable or disable the Azure Managed Prometheus addon for Prometheus monitoring. See aka.ms/AzureManagedPrometheus-aks-enable for details on enabling and disabling. - /// Kube State Metrics profile for the Azure Managed Prometheus addon. These optional settings are for the kube-state-metrics pod that is deployed with the addon. See aka.ms/AzureManagedPrometheus-optional-parameters for details. + /// Whether to enable the Prometheus collector. + /// Kube State Metrics for prometheus addon profile for the container service cluster. /// Keeps track of any properties unknown to the library. internal ManagedClusterMonitorProfileMetrics(bool isEnabled, ManagedClusterMonitorProfileKubeStateMetrics kubeStateMetrics, IDictionary serializedAdditionalRawData) { @@ -68,10 +68,10 @@ internal ManagedClusterMonitorProfileMetrics() { } - /// Whether to enable or disable the Azure Managed Prometheus addon for Prometheus monitoring. See aka.ms/AzureManagedPrometheus-aks-enable for details on enabling and disabling. + /// Whether to enable the Prometheus collector. [WirePath("enabled")] public bool IsEnabled { get; set; } - /// Kube State Metrics profile for the Azure Managed Prometheus addon. These optional settings are for the kube-state-metrics pod that is deployed with the addon. See aka.ms/AzureManagedPrometheus-optional-parameters for details. + /// Kube State Metrics for prometheus addon profile for the container service cluster. [WirePath("kubeStateMetrics")] public ManagedClusterMonitorProfileKubeStateMetrics KubeStateMetrics { get; set; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs index f4855f3718a6..c34423ab1833 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs @@ -42,7 +42,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("managedOutboundIPProfile"u8); writer.WriteObjectValue(ManagedOutboundIPProfile, options); } - if (Optional.IsCollectionDefined(EffectiveOutboundIPs)) + if (options.Format != "W" && Optional.IsCollectionDefined(EffectiveOutboundIPs)) { writer.WritePropertyName("effectiveOutboundIPs"u8); writer.WriteStartArray(); @@ -95,7 +95,7 @@ internal static ManagedClusterNatGatewayProfile DeserializeManagedClusterNatGate return null; } ManagedClusterManagedOutboundIPProfile managedOutboundIPProfile = default; - IList effectiveOutboundIPs = default; + IReadOnlyList effectiveOutboundIPs = default; int? idleTimeoutInMinutes = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs index 047d979ffec0..70c6a33d445b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs @@ -57,7 +57,7 @@ public ManagedClusterNatGatewayProfile() /// The effective outbound IP resources of the cluster NAT gateway. /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. /// Keeps track of any properties unknown to the library. - internal ManagedClusterNatGatewayProfile(ManagedClusterManagedOutboundIPProfile managedOutboundIPProfile, IList effectiveOutboundIPs, int? idleTimeoutInMinutes, IDictionary serializedAdditionalRawData) + internal ManagedClusterNatGatewayProfile(ManagedClusterManagedOutboundIPProfile managedOutboundIPProfile, IReadOnlyList effectiveOutboundIPs, int? idleTimeoutInMinutes, IDictionary serializedAdditionalRawData) { ManagedOutboundIPProfile = managedOutboundIPProfile; EffectiveOutboundIPs = effectiveOutboundIPs; @@ -82,7 +82,7 @@ public int? ManagedOutboundIPCount /// The effective outbound IP resources of the cluster NAT gateway. [WirePath("effectiveOutboundIPs")] - public IList EffectiveOutboundIPs { get; } + public IReadOnlyList EffectiveOutboundIPs { get; } /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. [WirePath("idleTimeoutInMinutes")] public int? IdleTimeoutInMinutes { get; set; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeOSUpgradeChannel.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeOSUpgradeChannel.cs index 5fd9240d2cc8..33582991c211 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeOSUpgradeChannel.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeOSUpgradeChannel.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Manner in which the OS on your nodes is updated. The default is NodeImage. + /// The default is Unmanaged, but may change to either NodeImage or SecurityPatch at GA. public readonly partial struct ManagedClusterNodeOSUpgradeChannel : IEquatable { private readonly string _value; @@ -24,12 +24,15 @@ public ManagedClusterNodeOSUpgradeChannel(string value) private const string NoneValue = "None"; private const string UnmanagedValue = "Unmanaged"; + private const string SecurityPatchValue = "SecurityPatch"; private const string NodeImageValue = "NodeImage"; /// No attempt to update your machines OS will be made either by OS or by rolling VHDs. This means you are responsible for your security updates. public static ManagedClusterNodeOSUpgradeChannel None { get; } = new ManagedClusterNodeOSUpgradeChannel(NoneValue); - /// OS updates will be applied automatically through the OS built-in patching infrastructure. Newly scaled in machines will be unpatched initially and will be patched at some point by the OS's infrastructure. Behavior of this option depends on the OS in question. Ubuntu and Mariner apply security patches through unattended upgrade roughly once a day around 06:00 UTC. Windows does not apply security patches automatically and so for them this option is equivalent to None till further notice. + /// OS updates will be applied automatically through the OS built-in patching infrastructure. Newly scaled in machines will be unpatched initially, and will be patched at some later time by the OS's infrastructure. Behavior of this option depends on the OS in question. Ubuntu and Mariner apply security patches through unattended upgrade roughly once a day around 06:00 UTC. Windows does not apply security patches automatically and so for them this option is equivalent to None till further notice. public static ManagedClusterNodeOSUpgradeChannel Unmanaged { get; } = new ManagedClusterNodeOSUpgradeChannel(UnmanagedValue); + /// AKS downloads and updates the nodes with tested security updates. These updates honor the maintenance window settings and produce a new VHD that is used on new nodes. On some occasions it's not possible to apply the updates in place, in such cases the existing nodes will also be re-imaged to the newly produced VHD in order to apply the changes. This option incurs an extra cost of hosting the new Security Patch VHDs in your resource group for just in time consumption. + public static ManagedClusterNodeOSUpgradeChannel SecurityPatch { get; } = new ManagedClusterNodeOSUpgradeChannel(SecurityPatchValue); /// AKS will update the nodes with a newly patched VHD containing security fixes and bugfixes on a weekly cadence. With the VHD update machines will be rolling reimaged to that VHD following maintenance windows and surge settings. No extra VHD cost is incurred when choosing this option as AKS hosts the images. public static ManagedClusterNodeOSUpgradeChannel NodeImage { get; } = new ManagedClusterNodeOSUpgradeChannel(NodeImageValue); /// Determines if two values are the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeProvisioningProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeProvisioningProfile.Serialization.cs new file mode 100644 index 000000000000..778fe43667ba --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeProvisioningProfile.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterNodeProvisioningProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterNodeProvisioningProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsDefined(DefaultNodePools)) + { + writer.WritePropertyName("defaultNodePools"u8); + writer.WriteStringValue(DefaultNodePools.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterNodeProvisioningProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterNodeProvisioningProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterNodeProvisioningProfile(document.RootElement, options); + } + + internal static ManagedClusterNodeProvisioningProfile DeserializeManagedClusterNodeProvisioningProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NodeProvisioningMode? mode = default; + NodeProvisioningDefaultNodePool? defaultNodePools = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new NodeProvisioningMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("defaultNodePools"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultNodePools = new NodeProvisioningDefaultNodePool(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterNodeProvisioningProfile(mode, defaultNodePools, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Mode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" mode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Mode)) + { + builder.Append(" mode: "); + builder.AppendLine($"'{Mode.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultNodePools), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" defaultNodePools: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DefaultNodePools)) + { + builder.Append(" defaultNodePools: "); + builder.AppendLine($"'{DefaultNodePools.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterNodeProvisioningProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterNodeProvisioningProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterNodeProvisioningProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterNodeProvisioningProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeProvisioningProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeProvisioningProfile.cs new file mode 100644 index 000000000000..b5c0336662e0 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeProvisioningProfile.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The ManagedClusterNodeProvisioningProfile. + public partial class ManagedClusterNodeProvisioningProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterNodeProvisioningProfile() + { + } + + /// Initializes a new instance of . + /// Once the mode it set to Auto, it cannot be changed back to Manual. + /// This field has no effect unless mode is 'Auto'. Warning: Changing this from Auto to None on an existing cluster will cause the default Karpenter NodePools to be deleted, which will in turn drain and delete the nodes associated with those pools. It is strongly recommended to not do this unless there are idle nodes ready to take the pods evicted by that action. If not specified, the default is Auto. For more information see aka.ms/something. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterNodeProvisioningProfile(NodeProvisioningMode? mode, NodeProvisioningDefaultNodePool? defaultNodePools, IDictionary serializedAdditionalRawData) + { + Mode = mode; + DefaultNodePools = defaultNodePools; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Once the mode it set to Auto, it cannot be changed back to Manual. + [WirePath("mode")] + public NodeProvisioningMode? Mode { get; set; } + /// This field has no effect unless mode is 'Auto'. Warning: Changing this from Auto to None on an existing cluster will cause the default Karpenter NodePools to be deleted, which will in turn drain and delete the nodes associated with those pools. It is strongly recommended to not do this unless there are idle nodes ready to take the pods evicted by that action. If not specified, the default is Auto. For more information see aka.ms/something. + [WirePath("defaultNodePools")] + public NodeProvisioningDefaultNodePool? DefaultNodePools { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs new file mode 100644 index 000000000000..bfcb18ea5ef9 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterNodeResourceGroupProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterNodeResourceGroupProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(RestrictionLevel)) + { + writer.WritePropertyName("restrictionLevel"u8); + writer.WriteStringValue(RestrictionLevel.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterNodeResourceGroupProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterNodeResourceGroupProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterNodeResourceGroupProfile(document.RootElement, options); + } + + internal static ManagedClusterNodeResourceGroupProfile DeserializeManagedClusterNodeResourceGroupProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RestrictionLevel? restrictionLevel = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("restrictionLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + restrictionLevel = new RestrictionLevel(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterNodeResourceGroupProfile(restrictionLevel, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RestrictionLevel), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" restrictionLevel: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RestrictionLevel)) + { + builder.Append(" restrictionLevel: "); + builder.AppendLine($"'{RestrictionLevel.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterNodeResourceGroupProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterNodeResourceGroupProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterNodeResourceGroupProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterNodeResourceGroupProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs new file mode 100644 index 000000000000..8ce5a91dc921 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Node resource group lockdown profile for a managed cluster. + internal partial class ManagedClusterNodeResourceGroupProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterNodeResourceGroupProfile() + { + } + + /// Initializes a new instance of . + /// The restriction level applied to the cluster's node resource group. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterNodeResourceGroupProfile(RestrictionLevel? restrictionLevel, IDictionary serializedAdditionalRawData) + { + RestrictionLevel = restrictionLevel; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The restriction level applied to the cluster's node resource group. + [WirePath("restrictionLevel")] + public RestrictionLevel? RestrictionLevel { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.Serialization.cs index 0153074ba332..b74bfceb3b0c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.Serialization.cs @@ -55,6 +55,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsCollectionDefined(ComponentsByReleases)) + { + writer.WritePropertyName("componentsByReleases"u8); + writer.WriteStartArray(); + foreach (var item in ComponentsByReleases) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -96,6 +106,7 @@ internal static ManagedClusterPoolUpgradeProfile DeserializeManagedClusterPoolUp string name = default; ContainerServiceOSType osType = default; IReadOnlyList upgrades = default; + IReadOnlyList componentsByReleases = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -129,13 +140,33 @@ internal static ManagedClusterPoolUpgradeProfile DeserializeManagedClusterPoolUp upgrades = array; continue; } + if (property.NameEquals("componentsByReleases"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ComponentsByRelease.DeserializeComponentsByRelease(item, options)); + } + componentsByReleases = array; + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterPoolUpgradeProfile(kubernetesVersion, name, osType, upgrades ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ManagedClusterPoolUpgradeProfile( + kubernetesVersion, + name, + osType, + upgrades ?? new ChangeTrackingList(), + componentsByReleases ?? new ChangeTrackingList(), + serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -230,6 +261,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ComponentsByReleases), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" componentsByReleases: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ComponentsByReleases)) + { + if (ComponentsByReleases.Any()) + { + builder.Append(" componentsByReleases: "); + builder.AppendLine("["); + foreach (var item in ComponentsByReleases) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " componentsByReleases: "); + } + builder.AppendLine(" ]"); + } + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs index bae6b2db4cc7..c2f8604ee871 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs @@ -56,6 +56,7 @@ internal ManagedClusterPoolUpgradeProfile(string kubernetesVersion, ContainerSer KubernetesVersion = kubernetesVersion; OSType = osType; Upgrades = new ChangeTrackingList(); + ComponentsByReleases = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -63,13 +64,15 @@ internal ManagedClusterPoolUpgradeProfile(string kubernetesVersion, ContainerSer /// The Agent Pool name. /// The operating system type. The default is Linux. /// List of orchestrator types and versions available for upgrade. + /// List of components grouped by kubernetes major.minor version. /// Keeps track of any properties unknown to the library. - internal ManagedClusterPoolUpgradeProfile(string kubernetesVersion, string name, ContainerServiceOSType osType, IReadOnlyList upgrades, IDictionary serializedAdditionalRawData) + internal ManagedClusterPoolUpgradeProfile(string kubernetesVersion, string name, ContainerServiceOSType osType, IReadOnlyList upgrades, IReadOnlyList componentsByReleases, IDictionary serializedAdditionalRawData) { KubernetesVersion = kubernetesVersion; Name = name; OSType = osType; Upgrades = upgrades; + ComponentsByReleases = componentsByReleases; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -90,5 +93,8 @@ internal ManagedClusterPoolUpgradeProfile() /// List of orchestrator types and versions available for upgrade. [WirePath("upgrades")] public IReadOnlyList Upgrades { get; } + /// List of components grouped by kubernetes major.minor version. + [WirePath("componentsByReleases")] + public IReadOnlyList ComponentsByReleases { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs index da0bb0d9cfc4..5e22596b73f2 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs @@ -45,6 +45,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("isPreview"u8); writer.WriteBooleanValue(IsPreview.Value); } + if (Optional.IsDefined(IsOutOfSupport)) + { + writer.WritePropertyName("isOutOfSupport"u8); + writer.WriteBooleanValue(IsOutOfSupport.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -84,6 +89,7 @@ internal static ManagedClusterPoolUpgradeProfileUpgradesItem DeserializeManagedC } string kubernetesVersion = default; bool? isPreview = default; + bool? isOutOfSupport = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -102,13 +108,22 @@ internal static ManagedClusterPoolUpgradeProfileUpgradesItem DeserializeManagedC isPreview = property.Value.GetBoolean(); continue; } + if (property.NameEquals("isOutOfSupport"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isOutOfSupport = property.Value.GetBoolean(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion, isPreview, serializedAdditionalRawData); + return new ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion, isPreview, isOutOfSupport, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -161,6 +176,22 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsOutOfSupport), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isOutOfSupport: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsOutOfSupport)) + { + builder.Append(" isOutOfSupport: "); + var boolValue = IsOutOfSupport.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.cs index fa913e10a318..cd65bdc9049a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.cs @@ -53,11 +53,13 @@ internal ManagedClusterPoolUpgradeProfileUpgradesItem() /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// Whether the Kubernetes version is currently in preview. + /// Whether the Kubernetes version is out of support. /// Keeps track of any properties unknown to the library. - internal ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion, bool? isPreview, IDictionary serializedAdditionalRawData) + internal ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion, bool? isPreview, bool? isOutOfSupport, IDictionary serializedAdditionalRawData) { KubernetesVersion = kubernetesVersion; IsPreview = isPreview; + IsOutOfSupport = isOutOfSupport; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -67,5 +69,8 @@ internal ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion, /// Whether the Kubernetes version is currently in preview. [WirePath("isPreview")] public bool? IsPreview { get; } + /// Whether the Kubernetes version is out of support. + [WirePath("isOutOfSupport")] + public bool? IsOutOfSupport { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.Serialization.cs new file mode 100644 index 000000000000..05deb1fa7bd1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.Serialization.cs @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterPropertiesForSnapshot : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterPropertiesForSnapshot)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(KubernetesVersion)) + { + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + if (Optional.IsDefined(EnableRbac)) + { + writer.WritePropertyName("enableRbac"u8); + writer.WriteBooleanValue(EnableRbac.Value); + } + if (options.Format != "W" && Optional.IsDefined(NetworkProfile)) + { + writer.WritePropertyName("networkProfile"u8); + writer.WriteObjectValue(NetworkProfile, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterPropertiesForSnapshot IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterPropertiesForSnapshot)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterPropertiesForSnapshot(document.RootElement, options); + } + + internal static ManagedClusterPropertiesForSnapshot DeserializeManagedClusterPropertiesForSnapshot(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kubernetesVersion = default; + ManagedClusterSku sku = default; + bool? enableRbac = default; + NetworkProfileForSnapshot networkProfile = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kubernetesVersion"u8)) + { + kubernetesVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ManagedClusterSku.DeserializeManagedClusterSku(property.Value, options); + continue; + } + if (property.NameEquals("enableRbac"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableRbac = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("networkProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkProfile = NetworkProfileForSnapshot.DeserializeNetworkProfileForSnapshot(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterPropertiesForSnapshot(kubernetesVersion, sku, enableRbac, networkProfile, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubernetesVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kubernetesVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(KubernetesVersion)) + { + builder.Append(" kubernetesVersion: "); + if (KubernetesVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{KubernetesVersion}'''"); + } + else + { + builder.AppendLine($"'{KubernetesVersion}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sku: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Sku)) + { + builder.Append(" sku: "); + BicepSerializationHelpers.AppendChildObject(builder, Sku, options, 2, false, " sku: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableRbac), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enableRbac: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnableRbac)) + { + builder.Append(" enableRbac: "); + var boolValue = EnableRbac.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkProfile)) + { + builder.Append(" networkProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, NetworkProfile, options, 2, false, " networkProfile: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterPropertiesForSnapshot)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterPropertiesForSnapshot IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterPropertiesForSnapshot(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterPropertiesForSnapshot)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.cs new file mode 100644 index 000000000000..23dd746d809a --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// managed cluster properties for snapshot, these properties are read only. + public partial class ManagedClusterPropertiesForSnapshot + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ManagedClusterPropertiesForSnapshot() + { + } + + /// Initializes a new instance of . + /// The current kubernetes version. + /// The current managed cluster sku. + /// Whether the cluster has enabled Kubernetes Role-Based Access Control or not. + /// The current network profile. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterPropertiesForSnapshot(string kubernetesVersion, ManagedClusterSku sku, bool? enableRbac, NetworkProfileForSnapshot networkProfile, IDictionary serializedAdditionalRawData) + { + KubernetesVersion = kubernetesVersion; + Sku = sku; + EnableRbac = enableRbac; + NetworkProfile = networkProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The current kubernetes version. + [WirePath("kubernetesVersion")] + public string KubernetesVersion { get; } + /// The current managed cluster sku. + [WirePath("sku")] + public ManagedClusterSku Sku { get; } + /// Whether the cluster has enabled Kubernetes Role-Based Access Control or not. + [WirePath("enableRbac")] + public bool? EnableRbac { get; } + /// The current network profile. + [WirePath("networkProfile")] + public NetworkProfileForSnapshot NetworkProfile { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs index e7681b75528a..851b420bc426 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -55,6 +56,26 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("imageCleaner"u8); writer.WriteObjectValue(ImageCleaner, options); } + if (Optional.IsDefined(ImageIntegrity)) + { + writer.WritePropertyName("imageIntegrity"u8); + writer.WriteObjectValue(ImageIntegrity, options); + } + if (Optional.IsDefined(NodeRestriction)) + { + writer.WritePropertyName("nodeRestriction"u8); + writer.WriteObjectValue(NodeRestriction, options); + } + if (Optional.IsCollectionDefined(CustomCATrustCertificates)) + { + writer.WritePropertyName("customCATrustCertificates"u8); + writer.WriteStartArray(); + foreach (var item in CustomCATrustCertificates) + { + writer.WriteBase64StringValue(item, "D"); + } + writer.WriteEndArray(); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -96,6 +117,9 @@ internal static ManagedClusterSecurityProfile DeserializeManagedClusterSecurityP ManagedClusterSecurityProfileKeyVaultKms azureKeyVaultKms = default; ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity = default; ManagedClusterSecurityProfileImageCleaner imageCleaner = default; + ManagedClusterSecurityProfileImageIntegrity imageIntegrity = default; + ManagedClusterSecurityProfileNodeRestriction nodeRestriction = default; + IList customCATrustCertificates = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -136,13 +160,53 @@ internal static ManagedClusterSecurityProfile DeserializeManagedClusterSecurityP imageCleaner = ManagedClusterSecurityProfileImageCleaner.DeserializeManagedClusterSecurityProfileImageCleaner(property.Value, options); continue; } + if (property.NameEquals("imageIntegrity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageIntegrity = ManagedClusterSecurityProfileImageIntegrity.DeserializeManagedClusterSecurityProfileImageIntegrity(property.Value, options); + continue; + } + if (property.NameEquals("nodeRestriction"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeRestriction = ManagedClusterSecurityProfileNodeRestriction.DeserializeManagedClusterSecurityProfileNodeRestriction(property.Value, options); + continue; + } + if (property.NameEquals("customCATrustCertificates"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetBytesFromBase64("D")); + } + customCATrustCertificates = array; + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterSecurityProfile(defender, azureKeyVaultKms, workloadIdentity, imageCleaner, serializedAdditionalRawData); + return new ManagedClusterSecurityProfile( + defender, + azureKeyVaultKms, + workloadIdentity, + imageCleaner, + imageIntegrity, + nodeRestriction, + customCATrustCertificates ?? new ChangeTrackingList(), + serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -219,6 +283,70 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("ImageIntegrityEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" imageIntegrity: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(ImageIntegrity)) + { + builder.Append(" imageIntegrity: "); + BicepSerializationHelpers.AppendChildObject(builder, ImageIntegrity, options, 2, false, " imageIntegrity: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("NodeRestrictionEnabled", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeRestriction: "); + builder.AppendLine("{"); + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(NodeRestriction)) + { + builder.Append(" nodeRestriction: "); + BicepSerializationHelpers.AppendChildObject(builder, NodeRestriction, options, 2, false, " nodeRestriction: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomCATrustCertificates), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customCATrustCertificates: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(CustomCATrustCertificates)) + { + if (CustomCATrustCertificates.Any()) + { + builder.Append(" customCATrustCertificates: "); + builder.AppendLine("["); + foreach (var item in CustomCATrustCertificates) + { + if (item == null) + { + builder.Append("null"); + continue; + } + builder.AppendLine($" '{item.ToString()}'"); + } + builder.AppendLine(" ]"); + } + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs index 65d99a578005..8977f2cdcc8f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs @@ -48,6 +48,7 @@ public partial class ManagedClusterSecurityProfile /// Initializes a new instance of . public ManagedClusterSecurityProfile() { + CustomCATrustCertificates = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -55,13 +56,19 @@ public ManagedClusterSecurityProfile() /// Azure Key Vault [key management service](https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/) settings for the security profile. /// Workload identity settings for the security profile. Workload identity enables Kubernetes applications to access Azure cloud resources securely with Azure AD. See https://aka.ms/aks/wi for more details. /// Image Cleaner settings for the security profile. + /// Image integrity is a feature that works with Azure Policy to verify image integrity by signature. This will not have any effect unless Azure Policy is applied to enforce image signatures. See https://aka.ms/aks/image-integrity for how to use this feature via policy. + /// [Node Restriction](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#noderestriction) settings for the security profile. + /// A list of up to 10 base64 encoded CAs that will be added to the trust store on all nodes in the cluster. For more information see [Custom CA Trust Certificates](https://learn.microsoft.com/en-us/azure/aks/custom-certificate-authority). /// Keeps track of any properties unknown to the library. - internal ManagedClusterSecurityProfile(ManagedClusterSecurityProfileDefender defender, ManagedClusterSecurityProfileKeyVaultKms azureKeyVaultKms, ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity, ManagedClusterSecurityProfileImageCleaner imageCleaner, IDictionary serializedAdditionalRawData) + internal ManagedClusterSecurityProfile(ManagedClusterSecurityProfileDefender defender, ManagedClusterSecurityProfileKeyVaultKms azureKeyVaultKms, ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity, ManagedClusterSecurityProfileImageCleaner imageCleaner, ManagedClusterSecurityProfileImageIntegrity imageIntegrity, ManagedClusterSecurityProfileNodeRestriction nodeRestriction, IList customCATrustCertificates, IDictionary serializedAdditionalRawData) { Defender = defender; AzureKeyVaultKms = azureKeyVaultKms; WorkloadIdentity = workloadIdentity; ImageCleaner = imageCleaner; + ImageIntegrity = imageIntegrity; + NodeRestriction = nodeRestriction; + CustomCATrustCertificates = customCATrustCertificates; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -89,5 +96,38 @@ public bool? IsWorkloadIdentityEnabled /// Image Cleaner settings for the security profile. [WirePath("imageCleaner")] public ManagedClusterSecurityProfileImageCleaner ImageCleaner { get; set; } + /// Image integrity is a feature that works with Azure Policy to verify image integrity by signature. This will not have any effect unless Azure Policy is applied to enforce image signatures. See https://aka.ms/aks/image-integrity for how to use this feature via policy. + internal ManagedClusterSecurityProfileImageIntegrity ImageIntegrity { get; set; } + /// Whether to enable image integrity. The default value is false. + [WirePath("imageIntegrity.enabled")] + public bool? ImageIntegrityEnabled + { + get => ImageIntegrity is null ? default : ImageIntegrity.Enabled; + set + { + if (ImageIntegrity is null) + ImageIntegrity = new ManagedClusterSecurityProfileImageIntegrity(); + ImageIntegrity.Enabled = value; + } + } + + /// [Node Restriction](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#noderestriction) settings for the security profile. + internal ManagedClusterSecurityProfileNodeRestriction NodeRestriction { get; set; } + /// Whether to enable Node Restriction. + [WirePath("nodeRestriction.enabled")] + public bool? NodeRestrictionEnabled + { + get => NodeRestriction is null ? default : NodeRestriction.Enabled; + set + { + if (NodeRestriction is null) + NodeRestriction = new ManagedClusterSecurityProfileNodeRestriction(); + NodeRestriction.Enabled = value; + } + } + + /// A list of up to 10 base64 encoded CAs that will be added to the trust store on all nodes in the cluster. For more information see [Custom CA Trust Certificates](https://learn.microsoft.com/en-us/azure/aks/custom-certificate-authority). + [WirePath("customCATrustCertificates")] + public IList CustomCATrustCertificates { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.Serialization.cs index e732f74e07ee..c56ddafafeaf 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.Serialization.cs @@ -45,6 +45,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("securityMonitoring"u8); writer.WriteObjectValue(SecurityMonitoring, options); } + if (Optional.IsDefined(SecurityGating)) + { + writer.WritePropertyName("securityGating"u8); + writer.WriteObjectValue(SecurityGating, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -84,6 +89,7 @@ internal static ManagedClusterSecurityProfileDefender DeserializeManagedClusterS } ResourceIdentifier logAnalyticsWorkspaceResourceId = default; ManagedClusterSecurityProfileDefenderSecurityMonitoring securityMonitoring = default; + ManagedClusterSecurityProfileDefenderSecurityGating securityGating = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -106,13 +112,22 @@ internal static ManagedClusterSecurityProfileDefender DeserializeManagedClusterS securityMonitoring = ManagedClusterSecurityProfileDefenderSecurityMonitoring.DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(property.Value, options); continue; } + if (property.NameEquals("securityGating"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityGating = ManagedClusterSecurityProfileDefenderSecurityGating.DeserializeManagedClusterSecurityProfileDefenderSecurityGating(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterSecurityProfileDefender(logAnalyticsWorkspaceResourceId, securityMonitoring, serializedAdditionalRawData); + return new ManagedClusterSecurityProfileDefender(logAnalyticsWorkspaceResourceId, securityMonitoring, securityGating, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -159,6 +174,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityGating), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" securityGating: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecurityGating)) + { + builder.Append(" securityGating: "); + BicepSerializationHelpers.AppendChildObject(builder, SecurityGating, options, 2, false, " securityGating: "); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs index 03554a08f363..5cb721ed152b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs @@ -54,11 +54,13 @@ public ManagedClusterSecurityProfileDefender() /// Initializes a new instance of . /// Resource ID of the Log Analytics workspace to be associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field empty. /// Microsoft Defender threat detection for Cloud settings for the security profile. + /// Microsoft Defender settings for security gating, validates container images eligibility for deployment based on Defender for Containers security findings. Using Admission Controller, it either audits or prevents the deployment of images that do not meet security standards. /// Keeps track of any properties unknown to the library. - internal ManagedClusterSecurityProfileDefender(ResourceIdentifier logAnalyticsWorkspaceResourceId, ManagedClusterSecurityProfileDefenderSecurityMonitoring securityMonitoring, IDictionary serializedAdditionalRawData) + internal ManagedClusterSecurityProfileDefender(ResourceIdentifier logAnalyticsWorkspaceResourceId, ManagedClusterSecurityProfileDefenderSecurityMonitoring securityMonitoring, ManagedClusterSecurityProfileDefenderSecurityGating securityGating, IDictionary serializedAdditionalRawData) { LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; SecurityMonitoring = securityMonitoring; + SecurityGating = securityGating; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -79,5 +81,9 @@ public bool? IsSecurityMonitoringEnabled SecurityMonitoring.IsSecurityMonitoringEnabled = value; } } + + /// Microsoft Defender settings for security gating, validates container images eligibility for deployment based on Defender for Containers security findings. Using Admission Controller, it either audits or prevents the deployment of images that do not meet security standards. + [WirePath("securityGating")] + public ManagedClusterSecurityProfileDefenderSecurityGating SecurityGating { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGating.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGating.Serialization.cs new file mode 100644 index 000000000000..9c5112610895 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGating.Serialization.cs @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterSecurityProfileDefenderSecurityGating : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileDefenderSecurityGating)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsCollectionDefined(Identities)) + { + writer.WritePropertyName("identities"u8); + writer.WriteStartArray(); + foreach (var item in Identities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AllowSecretAccess)) + { + writer.WritePropertyName("allowSecretAccess"u8); + writer.WriteBooleanValue(AllowSecretAccess.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterSecurityProfileDefenderSecurityGating IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileDefenderSecurityGating)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfileDefenderSecurityGating(document.RootElement, options); + } + + internal static ManagedClusterSecurityProfileDefenderSecurityGating DeserializeManagedClusterSecurityProfileDefenderSecurityGating(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IList identities = default; + bool? allowSecretAccess = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("identities"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem.DeserializeManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem(item, options)); + } + identities = array; + continue; + } + if (property.NameEquals("allowSecretAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowSecretAccess = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterSecurityProfileDefenderSecurityGating(enabled, identities ?? new ChangeTrackingList(), allowSecretAccess, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identities), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" identities: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Identities)) + { + if (Identities.Any()) + { + builder.Append(" identities: "); + builder.AppendLine("["); + foreach (var item in Identities) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " identities: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowSecretAccess), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" allowSecretAccess: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AllowSecretAccess)) + { + builder.Append(" allowSecretAccess: "); + var boolValue = AllowSecretAccess.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileDefenderSecurityGating)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterSecurityProfileDefenderSecurityGating IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterSecurityProfileDefenderSecurityGating(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileDefenderSecurityGating)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGating.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGating.cs new file mode 100644 index 000000000000..d1c320fb7e31 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGating.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Microsoft Defender settings for security gating, validates container images eligibility for deployment based on Defender for Containers security findings. Using Admission Controller, it either audits or prevents the deployment of images that do not meet security standards. + public partial class ManagedClusterSecurityProfileDefenderSecurityGating + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterSecurityProfileDefenderSecurityGating() + { + Identities = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Whether to enable Defender security gating. When enabled, the gating feature will scan container images and audit or block the deployment of images that do not meet security standards according to the configured security rules. + /// List of identities that the admission controller will make use of in order to pull security artifacts from the registry. These are the same identities used by the cluster to pull container images. Each identity provided should have federated identity credential attached to it. + /// In use only while registry access granted by secret rather than managed identity. Set whether to grant the Defender gating agent access to the cluster's secrets for pulling images from registries. If secret access is denied and the registry requires pull secrets, the add-on will not perform any image validation. Default value is false. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfileDefenderSecurityGating(bool? enabled, IList identities, bool? allowSecretAccess, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + Identities = identities; + AllowSecretAccess = allowSecretAccess; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether to enable Defender security gating. When enabled, the gating feature will scan container images and audit or block the deployment of images that do not meet security standards according to the configured security rules. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// List of identities that the admission controller will make use of in order to pull security artifacts from the registry. These are the same identities used by the cluster to pull container images. Each identity provided should have federated identity credential attached to it. + [WirePath("identities")] + public IList Identities { get; } + /// In use only while registry access granted by secret rather than managed identity. Set whether to grant the Defender gating agent access to the cluster's secrets for pulling images from registries. If secret access is denied and the registry requires pull secrets, the add-on will not perform any image validation. Default value is false. + [WirePath("allowSecretAccess")] + public bool? AllowSecretAccess { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem.Serialization.cs new file mode 100644 index 000000000000..4bf543d746f3 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AzureContainerRegistry)) + { + writer.WritePropertyName("azureContainerRegistry"u8); + writer.WriteStringValue(AzureContainerRegistry); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem(document.RootElement, options); + } + + internal static ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem DeserializeManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string azureContainerRegistry = default; + ContainerServiceUserAssignedIdentity identity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureContainerRegistry"u8)) + { + azureContainerRegistry = property.Value.GetString(); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ContainerServiceUserAssignedIdentity.DeserializeContainerServiceUserAssignedIdentity(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem(azureContainerRegistry, identity, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AzureContainerRegistry), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" azureContainerRegistry: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AzureContainerRegistry)) + { + builder.Append(" azureContainerRegistry: "); + if (AzureContainerRegistry.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AzureContainerRegistry}'''"); + } + else + { + builder.AppendLine($"'{AzureContainerRegistry}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" identity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Identity)) + { + builder.Append(" identity: "); + BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem.cs new file mode 100644 index 000000000000..acccae46568d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem. + public partial class ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem() + { + } + + /// Initializes a new instance of . + /// The container registry for which the identity will be used; the identity specified here should have a federated identity credential attached to it. + /// The identity object used to access the registry. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfileDefenderSecurityGatingIdentitiesItem(string azureContainerRegistry, ContainerServiceUserAssignedIdentity identity, IDictionary serializedAdditionalRawData) + { + AzureContainerRegistry = azureContainerRegistry; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The container registry for which the identity will be used; the identity specified here should have a federated identity credential attached to it. + [WirePath("azureContainerRegistry")] + public string AzureContainerRegistry { get; set; } + /// The identity object used to access the registry. + [WirePath("identity")] + public ContainerServiceUserAssignedIdentity Identity { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageIntegrity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageIntegrity.Serialization.cs new file mode 100644 index 000000000000..bbca5d80bf6b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageIntegrity.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterSecurityProfileImageIntegrity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileImageIntegrity)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterSecurityProfileImageIntegrity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileImageIntegrity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfileImageIntegrity(document.RootElement, options); + } + + internal static ManagedClusterSecurityProfileImageIntegrity DeserializeManagedClusterSecurityProfileImageIntegrity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterSecurityProfileImageIntegrity(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileImageIntegrity)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterSecurityProfileImageIntegrity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterSecurityProfileImageIntegrity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileImageIntegrity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageIntegrity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageIntegrity.cs new file mode 100644 index 000000000000..2b4f8b963857 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageIntegrity.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Image integrity related settings for the security profile. + internal partial class ManagedClusterSecurityProfileImageIntegrity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterSecurityProfileImageIntegrity() + { + } + + /// Initializes a new instance of . + /// Whether to enable image integrity. The default value is false. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfileImageIntegrity(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether to enable image integrity. The default value is false. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.Serialization.cs new file mode 100644 index 000000000000..bfbcddcf6ed1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterSecurityProfileNodeRestriction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileNodeRestriction)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterSecurityProfileNodeRestriction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileNodeRestriction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfileNodeRestriction(document.RootElement, options); + } + + internal static ManagedClusterSecurityProfileNodeRestriction DeserializeManagedClusterSecurityProfileNodeRestriction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterSecurityProfileNodeRestriction(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileNodeRestriction)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterSecurityProfileNodeRestriction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterSecurityProfileNodeRestriction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileNodeRestriction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.cs new file mode 100644 index 000000000000..69f329b2b524 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Node Restriction settings for the security profile. + internal partial class ManagedClusterSecurityProfileNodeRestriction + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterSecurityProfileNodeRestriction() + { + } + + /// Initializes a new instance of . + /// Whether to enable Node Restriction. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfileNodeRestriction(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether to enable Node Restriction. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuName.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuName.cs index ff0d3a329ae4..82697722fbeb 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuName.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuName.cs @@ -23,9 +23,12 @@ public ManagedClusterSkuName(string value) } private const string BaseValue = "Base"; + private const string AutomaticValue = "Automatic"; /// Base option for the AKS control plane. public static ManagedClusterSkuName Base { get; } = new ManagedClusterSkuName(BaseValue); + /// Automatic clusters are optimized to run most production workloads with configuration that follows AKS best practices and recommendations for cluster and workload setup, scalability, and security. For more details about Automatic clusters see aka.ms/aks/automatic. + public static ManagedClusterSkuName Automatic { get; } = new ManagedClusterSkuName(AutomaticValue); /// Determines if two values are the same. public static bool operator ==(ManagedClusterSkuName left, ManagedClusterSkuName right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.Serialization.cs new file mode 100644 index 000000000000..2a3b16a0d3ba --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterSnapshotListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSnapshotListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterSnapshotListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterSnapshotListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSnapshotListResult(document.RootElement, options); + } + + internal static ManagedClusterSnapshotListResult DeserializeManagedClusterSnapshotListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterSnapshotListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterSnapshotListResult)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterSnapshotListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterSnapshotListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterSnapshotListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.cs new file mode 100644 index 000000000000..a59b7a1a5b06 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The response from the List Managed Cluster Snapshots operation. + internal partial class ManagedClusterSnapshotListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ManagedClusterSnapshotListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of managed cluster snapshots. + /// The URL to get the next set of managed cluster snapshot results. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSnapshotListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The list of managed cluster snapshots. + public IReadOnlyList Value { get; } + /// The URL to get the next set of managed cluster snapshot results. + public string NextLink { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStaticEgressGatewayProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStaticEgressGatewayProfile.Serialization.cs new file mode 100644 index 000000000000..ad7e101314cb --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStaticEgressGatewayProfile.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterStaticEgressGatewayProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterStaticEgressGatewayProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterStaticEgressGatewayProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterStaticEgressGatewayProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterStaticEgressGatewayProfile(document.RootElement, options); + } + + internal static ManagedClusterStaticEgressGatewayProfile DeserializeManagedClusterStaticEgressGatewayProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterStaticEgressGatewayProfile(enabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterStaticEgressGatewayProfile)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterStaticEgressGatewayProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterStaticEgressGatewayProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterStaticEgressGatewayProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStaticEgressGatewayProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStaticEgressGatewayProfile.cs new file mode 100644 index 000000000000..74e108e940fe --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStaticEgressGatewayProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The Static Egress Gateway addon configuration for the cluster. + internal partial class ManagedClusterStaticEgressGatewayProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterStaticEgressGatewayProfile() + { + } + + /// Initializes a new instance of . + /// Indicates if Static Egress Gateway addon is enabled or not. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterStaticEgressGatewayProfile(bool? enabled, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates if Static Egress Gateway addon is enabled or not. + [WirePath("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStatus.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStatus.Serialization.cs new file mode 100644 index 000000000000..64cafc1646f6 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStatus.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class ManagedClusterStatus : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterStatus)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningError)) + { + writer.WritePropertyName("provisioningError"u8); + JsonSerializer.Serialize(writer, ProvisioningError); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedClusterStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedClusterStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterStatus(document.RootElement, options); + } + + internal static ManagedClusterStatus DeserializeManagedClusterStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResponseError provisioningError = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningError"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningError = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedClusterStatus(provisioningError, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningError), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningError: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningError)) + { + builder.Append(" provisioningError: "); + BicepSerializationHelpers.AppendChildObject(builder, ProvisioningError, options, 2, false, " provisioningError: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedClusterStatus)} does not support writing '{options.Format}' format."); + } + } + + ManagedClusterStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedClusterStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedClusterStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStatus.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStatus.cs new file mode 100644 index 000000000000..e57487447462 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStatus.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Contains read-only information about the Managed Cluster. + internal partial class ManagedClusterStatus + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedClusterStatus() + { + } + + /// Initializes a new instance of . + /// Preserves the detailed info of failure. If there was no error, this field is omitted. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterStatus(ResponseError provisioningError, IDictionary serializedAdditionalRawData) + { + ProvisioningError = provisioningError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Preserves the detailed info of failure. If there was no error, this field is omitted. + [WirePath("provisioningError")] + public ResponseError ProvisioningError { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs index 4a9cb888bc95..8f0acc0299ab 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs @@ -156,14 +156,11 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("IsEnabled", out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DiskCsiDriver), out propertyOverride); if (hasPropertyOverride) { builder.Append(" diskCSIDriver: "); - builder.AppendLine("{"); - builder.Append(" enabled: "); builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); } else { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs index ea5c58a09885..11a373a33d68 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs @@ -66,8 +66,8 @@ internal ManagedClusterStorageProfile(ManagedClusterStorageProfileDiskCsiDriver } /// AzureDisk CSI Driver settings for the storage profile. - internal ManagedClusterStorageProfileDiskCsiDriver DiskCsiDriver { get; set; } - + [WirePath("diskCSIDriver")] + public ManagedClusterStorageProfileDiskCsiDriver DiskCsiDriver { get; set; } /// AzureFile CSI Driver settings for the storage profile. internal ManagedClusterStorageProfileFileCsiDriver FileCsiDriver { get; set; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.Serialization.cs index 50ebb2bc0f6e..5ad36463636e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.Serialization.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterStorageProfileDiskCsiDriver : IUtf8JsonSerializable, IJsonModel + public partial class ManagedClusterStorageProfileDiskCsiDriver : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -40,6 +40,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled.Value); } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -78,6 +83,7 @@ internal static ManagedClusterStorageProfileDiskCsiDriver DeserializeManagedClus return null; } bool? enabled = default; + string version = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -91,13 +97,18 @@ internal static ManagedClusterStorageProfileDiskCsiDriver DeserializeManagedClus enabled = property.Value.GetBoolean(); continue; } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterStorageProfileDiskCsiDriver(enabled, serializedAdditionalRawData); + return new ManagedClusterStorageProfileDiskCsiDriver(enabled, version, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -127,6 +138,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + if (Version.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Version}'''"); + } + else + { + builder.AppendLine($"'{Version}'"); + } + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs index 8e340b83d57c..4a60205af81a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ContainerService.Models { /// AzureDisk CSI Driver settings for the storage profile. - internal partial class ManagedClusterStorageProfileDiskCsiDriver + public partial class ManagedClusterStorageProfileDiskCsiDriver { /// /// Keeps track of any properties unknown to the library. @@ -52,15 +52,20 @@ public ManagedClusterStorageProfileDiskCsiDriver() /// Initializes a new instance of . /// Whether to enable AzureDisk CSI Driver. The default value is true. + /// The version of AzureDisk CSI Driver. The default value is v1. /// Keeps track of any properties unknown to the library. - internal ManagedClusterStorageProfileDiskCsiDriver(bool? isEnabled, IDictionary serializedAdditionalRawData) + internal ManagedClusterStorageProfileDiskCsiDriver(bool? isEnabled, string version, IDictionary serializedAdditionalRawData) { IsEnabled = isEnabled; + Version = version; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable AzureDisk CSI Driver. The default value is true. [WirePath("enabled")] public bool? IsEnabled { get; set; } + /// The version of AzureDisk CSI Driver. The default value is v1. + [WirePath("version")] + public string Version { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.Serialization.cs index 20a3531f730d..ccf83a6bef18 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.Serialization.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterVerticalPodAutoscaler : IUtf8JsonSerializable, IJsonModel + public partial class ManagedClusterVerticalPodAutoscaler : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -37,6 +37,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsVpaEnabled); + if (Optional.IsDefined(AddonAutoscaling)) + { + writer.WritePropertyName("addonAutoscaling"u8); + writer.WriteStringValue(AddonAutoscaling.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -75,6 +80,7 @@ internal static ManagedClusterVerticalPodAutoscaler DeserializeManagedClusterVer return null; } bool enabled = default; + AddonAutoscaling? addonAutoscaling = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -84,13 +90,22 @@ internal static ManagedClusterVerticalPodAutoscaler DeserializeManagedClusterVer enabled = property.Value.GetBoolean(); continue; } + if (property.NameEquals("addonAutoscaling"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + addonAutoscaling = new AddonAutoscaling(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterVerticalPodAutoscaler(enabled, serializedAdditionalRawData); + return new ManagedClusterVerticalPodAutoscaler(enabled, addonAutoscaling, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -117,6 +132,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine($"{boolValue}"); } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AddonAutoscaling), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" addonAutoscaling: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AddonAutoscaling)) + { + builder.Append(" addonAutoscaling: "); + builder.AppendLine($"'{AddonAutoscaling.Value.ToString()}'"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs index dde1490559b2..2ffbece4061d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// VPA (Vertical Pod Autoscaler) settings for the workload auto-scaler profile. - internal partial class ManagedClusterVerticalPodAutoscaler + /// The ManagedClusterVerticalPodAutoscaler. + public partial class ManagedClusterVerticalPodAutoscaler { /// /// Keeps track of any properties unknown to the library. @@ -46,18 +46,20 @@ internal partial class ManagedClusterVerticalPodAutoscaler private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// Whether to enable VPA. Default value is false. + /// Whether to enable VPA add-on in cluster. Default value is false. public ManagedClusterVerticalPodAutoscaler(bool isVpaEnabled) { IsVpaEnabled = isVpaEnabled; } /// Initializes a new instance of . - /// Whether to enable VPA. Default value is false. + /// Whether to enable VPA add-on in cluster. Default value is false. + /// Whether VPA add-on is enabled and configured to scale AKS-managed add-ons. /// Keeps track of any properties unknown to the library. - internal ManagedClusterVerticalPodAutoscaler(bool isVpaEnabled, IDictionary serializedAdditionalRawData) + internal ManagedClusterVerticalPodAutoscaler(bool isVpaEnabled, AddonAutoscaling? addonAutoscaling, IDictionary serializedAdditionalRawData) { IsVpaEnabled = isVpaEnabled; + AddonAutoscaling = addonAutoscaling; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -66,8 +68,11 @@ internal ManagedClusterVerticalPodAutoscaler() { } - /// Whether to enable VPA. Default value is false. + /// Whether to enable VPA add-on in cluster. Default value is false. [WirePath("enabled")] public bool IsVpaEnabled { get; set; } + /// Whether VPA add-on is enabled and configured to scale AKS-managed add-ons. + [WirePath("addonAutoscaling")] + public AddonAutoscaling? AddonAutoscaling { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.Serialization.cs index e16f8d0197fe..8a0930b66af5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.Serialization.cs @@ -144,14 +144,11 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("IsVpaEnabled", out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VerticalPodAutoscaler), out propertyOverride); if (hasPropertyOverride) { builder.Append(" verticalPodAutoscaler: "); - builder.AppendLine("{"); - builder.Append(" enabled: "); builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); } else { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs index 1b6315c05d7f..d6525c247aa1 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs @@ -52,7 +52,7 @@ public ManagedClusterWorkloadAutoScalerProfile() /// Initializes a new instance of . /// KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. - /// VPA (Vertical Pod Autoscaler) settings for the workload auto-scaler profile. + /// /// Keeps track of any properties unknown to the library. internal ManagedClusterWorkloadAutoScalerProfile(ManagedClusterWorkloadAutoScalerProfileKeda keda, ManagedClusterVerticalPodAutoscaler verticalPodAutoscaler, IDictionary serializedAdditionalRawData) { @@ -74,17 +74,8 @@ public bool? IsKedaEnabled } } - /// VPA (Vertical Pod Autoscaler) settings for the workload auto-scaler profile. - internal ManagedClusterVerticalPodAutoscaler VerticalPodAutoscaler { get; set; } - /// Whether to enable VPA. Default value is false. - [WirePath("verticalPodAutoscaler.enabled")] - public bool? IsVpaEnabled - { - get => VerticalPodAutoscaler is null ? default(bool?) : VerticalPodAutoscaler.IsVpaEnabled; - set - { - VerticalPodAutoscaler = value.HasValue ? new ManagedClusterVerticalPodAutoscaler(value.Value) : null; - } - } + /// Gets or sets the vertical pod autoscaler. + [WirePath("verticalPodAutoscaler")] + public ManagedClusterVerticalPodAutoscaler VerticalPodAutoscaler { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManualScaleProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManualScaleProfile.Serialization.cs new file mode 100644 index 000000000000..563be06252e3 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManualScaleProfile.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ManualScaleProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManualScaleProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteStringValue(Size); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManualScaleProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManualScaleProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManualScaleProfile(document.RootElement, options); + } + + internal static ManualScaleProfile DeserializeManualScaleProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string size = default; + int? count = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("size"u8)) + { + size = property.Value.GetString(); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManualScaleProfile(size, count, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Size), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" size: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Size)) + { + builder.Append(" size: "); + if (Size.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Size}'''"); + } + else + { + builder.AppendLine($"'{Size}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Count), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" count: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Count)) + { + builder.Append(" count: "); + builder.AppendLine($"{Count.Value}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManualScaleProfile)} does not support writing '{options.Format}' format."); + } + } + + ManualScaleProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManualScaleProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManualScaleProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManualScaleProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManualScaleProfile.cs new file mode 100644 index 000000000000..1f0be97dc891 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManualScaleProfile.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Specifications on number of machines. + public partial class ManualScaleProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManualScaleProfile() + { + } + + /// Initializes a new instance of . + /// VM size that AKS will use when creating and scaling e.g. 'Standard_E4s_v3', 'Standard_E16s_v3' or 'Standard_D16s_v5'. + /// Number of nodes. + /// Keeps track of any properties unknown to the library. + internal ManualScaleProfile(string size, int? count, IDictionary serializedAdditionalRawData) + { + Size = size; + Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// VM size that AKS will use when creating and scaling e.g. 'Standard_E4s_v3', 'Standard_E16s_v3' or 'Standard_D16s_v5'. + [WirePath("size")] + public string Size { get; set; } + /// Number of nodes. + [WirePath("count")] + public int? Count { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Mode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Mode.cs new file mode 100644 index 000000000000..2f36bb033839 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Mode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Specify which proxy mode to use ('IPTABLES' or 'IPVS'). + public readonly partial struct Mode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Mode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IPTablesValue = "IPTABLES"; + private const string IPVSValue = "IPVS"; + + /// IPTables proxy mode. + public static Mode IPTables { get; } = new Mode(IPTablesValue); + /// IPVS proxy mode. Must be using Kubernetes version >= 1.22. + public static Mode IPVS { get; } = new Mode(IPVSValue); + /// Determines if two values are the same. + public static bool operator ==(Mode left, Mode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Mode left, Mode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Mode(string value) => new Mode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Mode other && Equals(other); + /// + public bool Equals(Mode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceListResult.Serialization.cs new file mode 100644 index 000000000000..99e7a768f1a6 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class NamespaceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamespaceListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NamespaceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamespaceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNamespaceListResult(document.RootElement, options); + } + + internal static NamespaceListResult DeserializeNamespaceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NamespaceData.DeserializeNamespaceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NamespaceListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NamespaceListResult)} does not support writing '{options.Format}' format."); + } + } + + NamespaceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNamespaceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NamespaceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceListResult.cs new file mode 100644 index 000000000000..ba881c43fe1e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The result of a request to list namespaces in a managed cluster. + internal partial class NamespaceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal NamespaceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of namespaces. + /// The URI to fetch the next page of results, if any. + /// Keeps track of any properties unknown to the library. + internal NamespaceListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The list of namespaces. + public IReadOnlyList Value { get; } + /// The URI to fetch the next page of results, if any. + public string NextLink { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceProperties.Serialization.cs new file mode 100644 index 000000000000..172722a74225 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceProperties.Serialization.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class NamespaceProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamespaceProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsCollectionDefined(Labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartObject(); + foreach (var item in Labels) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(Annotations)) + { + writer.WritePropertyName("annotations"u8); + writer.WriteStartObject(); + foreach (var item in Annotations) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(DefaultResourceQuota)) + { + writer.WritePropertyName("defaultResourceQuota"u8); + writer.WriteObjectValue(DefaultResourceQuota, options); + } + if (Optional.IsDefined(DefaultNetworkPolicy)) + { + writer.WritePropertyName("defaultNetworkPolicy"u8); + writer.WriteObjectValue(DefaultNetworkPolicy, options); + } + if (Optional.IsDefined(AdoptionPolicy)) + { + writer.WritePropertyName("adoptionPolicy"u8); + writer.WriteStringValue(AdoptionPolicy.Value.ToString()); + } + if (Optional.IsDefined(DeletePolicy)) + { + writer.WritePropertyName("deletePolicy"u8); + writer.WriteStringValue(DeletePolicy.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NamespaceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamespaceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNamespaceProperties(document.RootElement, options); + } + + internal static NamespaceProperties DeserializeNamespaceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NamespaceProvisioningState? provisioningState = default; + IDictionary labels = default; + IDictionary annotations = default; + ResourceQuota defaultResourceQuota = default; + NetworkPolicies defaultNetworkPolicy = default; + AdoptionPolicy? adoptionPolicy = default; + DeletePolicy? deletePolicy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new NamespaceProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("labels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + labels = dictionary; + continue; + } + if (property.NameEquals("annotations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + annotations = dictionary; + continue; + } + if (property.NameEquals("defaultResourceQuota"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultResourceQuota = ResourceQuota.DeserializeResourceQuota(property.Value, options); + continue; + } + if (property.NameEquals("defaultNetworkPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultNetworkPolicy = NetworkPolicies.DeserializeNetworkPolicies(property.Value, options); + continue; + } + if (property.NameEquals("adoptionPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + adoptionPolicy = new AdoptionPolicy(property.Value.GetString()); + continue; + } + if (property.NameEquals("deletePolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deletePolicy = new DeletePolicy(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NamespaceProperties( + provisioningState, + labels ?? new ChangeTrackingDictionary(), + annotations ?? new ChangeTrackingDictionary(), + defaultResourceQuota, + defaultNetworkPolicy, + adoptionPolicy, + deletePolicy, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Labels), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" labels: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Labels)) + { + if (Labels.Any()) + { + builder.Append(" labels: "); + builder.AppendLine("{"); + foreach (var item in Labels) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Annotations), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" annotations: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Annotations)) + { + if (Annotations.Any()) + { + builder.Append(" annotations: "); + builder.AppendLine("{"); + foreach (var item in Annotations) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultResourceQuota), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" defaultResourceQuota: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DefaultResourceQuota)) + { + builder.Append(" defaultResourceQuota: "); + BicepSerializationHelpers.AppendChildObject(builder, DefaultResourceQuota, options, 2, false, " defaultResourceQuota: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultNetworkPolicy), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" defaultNetworkPolicy: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DefaultNetworkPolicy)) + { + builder.Append(" defaultNetworkPolicy: "); + BicepSerializationHelpers.AppendChildObject(builder, DefaultNetworkPolicy, options, 2, false, " defaultNetworkPolicy: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdoptionPolicy), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" adoptionPolicy: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AdoptionPolicy)) + { + builder.Append(" adoptionPolicy: "); + builder.AppendLine($"'{AdoptionPolicy.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DeletePolicy), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" deletePolicy: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DeletePolicy)) + { + builder.Append(" deletePolicy: "); + builder.AppendLine($"'{DeletePolicy.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NamespaceProperties)} does not support writing '{options.Format}' format."); + } + } + + NamespaceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNamespaceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NamespaceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceProperties.cs new file mode 100644 index 000000000000..8bda6534b29c --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceProperties.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Properties of a namespace managed by ARM. + public partial class NamespaceProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NamespaceProperties() + { + Labels = new ChangeTrackingDictionary(); + Annotations = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The current provisioning state of the namespace. + /// The labels of managed namespace. + /// The annotations of managed namespace. + /// The default resource quota enforced upon the namespace. Customers can have other Kubernetes resource quota objects under the namespace. All the resource quotas will be enforced. + /// The default network policy enforced upon the namespace. Customers can have other Kubernetes network policy objects under the namespace. All the network policies will be enforced. + /// Action if Kubernetes namespace with same name already exists. + /// Delete options of a namespace. + /// Keeps track of any properties unknown to the library. + internal NamespaceProperties(NamespaceProvisioningState? provisioningState, IDictionary labels, IDictionary annotations, ResourceQuota defaultResourceQuota, NetworkPolicies defaultNetworkPolicy, AdoptionPolicy? adoptionPolicy, DeletePolicy? deletePolicy, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + Labels = labels; + Annotations = annotations; + DefaultResourceQuota = defaultResourceQuota; + DefaultNetworkPolicy = defaultNetworkPolicy; + AdoptionPolicy = adoptionPolicy; + DeletePolicy = deletePolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The current provisioning state of the namespace. + [WirePath("provisioningState")] + public NamespaceProvisioningState? ProvisioningState { get; } + /// The labels of managed namespace. + [WirePath("labels")] + public IDictionary Labels { get; } + /// The annotations of managed namespace. + [WirePath("annotations")] + public IDictionary Annotations { get; } + /// The default resource quota enforced upon the namespace. Customers can have other Kubernetes resource quota objects under the namespace. All the resource quotas will be enforced. + [WirePath("defaultResourceQuota")] + public ResourceQuota DefaultResourceQuota { get; set; } + /// The default network policy enforced upon the namespace. Customers can have other Kubernetes network policy objects under the namespace. All the network policies will be enforced. + [WirePath("defaultNetworkPolicy")] + public NetworkPolicies DefaultNetworkPolicy { get; set; } + /// Action if Kubernetes namespace with same name already exists. + [WirePath("adoptionPolicy")] + public AdoptionPolicy? AdoptionPolicy { get; set; } + /// Delete options of a namespace. + [WirePath("deletePolicy")] + public DeletePolicy? DeletePolicy { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceProvisioningState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceProvisioningState.cs new file mode 100644 index 000000000000..ce5710b1b2b7 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NamespaceProvisioningState.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The current provisioning state of the namespace. + public readonly partial struct NamespaceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NamespaceProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string CreatingValue = "Creating"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Updating. + public static NamespaceProvisioningState Updating { get; } = new NamespaceProvisioningState(UpdatingValue); + /// Deleting. + public static NamespaceProvisioningState Deleting { get; } = new NamespaceProvisioningState(DeletingValue); + /// Creating. + public static NamespaceProvisioningState Creating { get; } = new NamespaceProvisioningState(CreatingValue); + /// Succeeded. + public static NamespaceProvisioningState Succeeded { get; } = new NamespaceProvisioningState(SucceededValue); + /// Failed. + public static NamespaceProvisioningState Failed { get; } = new NamespaceProvisioningState(FailedValue); + /// Canceled. + public static NamespaceProvisioningState Canceled { get; } = new NamespaceProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(NamespaceProvisioningState left, NamespaceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NamespaceProvisioningState left, NamespaceProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator NamespaceProvisioningState(string value) => new NamespaceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NamespaceProvisioningState other && Equals(other); + /// + public bool Equals(NamespaceProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkPolicies.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkPolicies.Serialization.cs new file mode 100644 index 000000000000..68045f01e359 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkPolicies.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class NetworkPolicies : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkPolicies)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Ingress)) + { + writer.WritePropertyName("ingress"u8); + writer.WriteStringValue(Ingress.Value.ToString()); + } + if (Optional.IsDefined(Egress)) + { + writer.WritePropertyName("egress"u8); + writer.WriteStringValue(Egress.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkPolicies IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkPolicies)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkPolicies(document.RootElement, options); + } + + internal static NetworkPolicies DeserializeNetworkPolicies(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PolicyRule? ingress = default; + PolicyRule? egress = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ingress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ingress = new PolicyRule(property.Value.GetString()); + continue; + } + if (property.NameEquals("egress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + egress = new PolicyRule(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkPolicies(ingress, egress, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Ingress), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ingress: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Ingress)) + { + builder.Append(" ingress: "); + builder.AppendLine($"'{Ingress.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Egress), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" egress: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Egress)) + { + builder.Append(" egress: "); + builder.AppendLine($"'{Egress.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkPolicies)} does not support writing '{options.Format}' format."); + } + } + + NetworkPolicies IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNetworkPolicies(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkPolicies)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkPolicies.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkPolicies.cs new file mode 100644 index 000000000000..c90fbc45ea96 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkPolicies.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Default network policy of the namespace, specifying ingress and egress rules. + public partial class NetworkPolicies + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NetworkPolicies() + { + } + + /// Initializes a new instance of . + /// Ingress policy for the network. + /// Egress policy for the network. + /// Keeps track of any properties unknown to the library. + internal NetworkPolicies(PolicyRule? ingress, PolicyRule? egress, IDictionary serializedAdditionalRawData) + { + Ingress = ingress; + Egress = egress; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Ingress policy for the network. + [WirePath("ingress")] + public PolicyRule? Ingress { get; set; } + /// Egress policy for the network. + [WirePath("egress")] + public PolicyRule? Egress { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkProfileForSnapshot.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkProfileForSnapshot.Serialization.cs new file mode 100644 index 000000000000..f068cf892aea --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkProfileForSnapshot.Serialization.cs @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class NetworkProfileForSnapshot : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkProfileForSnapshot)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NetworkPlugin)) + { + writer.WritePropertyName("networkPlugin"u8); + writer.WriteStringValue(NetworkPlugin.Value.ToString()); + } + if (Optional.IsDefined(NetworkPluginMode)) + { + writer.WritePropertyName("networkPluginMode"u8); + writer.WriteStringValue(NetworkPluginMode.Value.ToString()); + } + if (Optional.IsDefined(NetworkPolicy)) + { + writer.WritePropertyName("networkPolicy"u8); + writer.WriteStringValue(NetworkPolicy.Value.ToString()); + } + if (Optional.IsDefined(NetworkMode)) + { + writer.WritePropertyName("networkMode"u8); + writer.WriteStringValue(NetworkMode.Value.ToString()); + } + if (Optional.IsDefined(LoadBalancerSku)) + { + writer.WritePropertyName("loadBalancerSku"u8); + writer.WriteStringValue(LoadBalancerSku.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkProfileForSnapshot IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkProfileForSnapshot)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkProfileForSnapshot(document.RootElement, options); + } + + internal static NetworkProfileForSnapshot DeserializeNetworkProfileForSnapshot(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ContainerServiceNetworkPlugin? networkPlugin = default; + ContainerServiceNetworkPluginMode? networkPluginMode = default; + ContainerServiceNetworkPolicy? networkPolicy = default; + ContainerServiceNetworkMode? networkMode = default; + ContainerServiceLoadBalancerSku? loadBalancerSku = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkPlugin"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkPlugin = new ContainerServiceNetworkPlugin(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkPluginMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkPluginMode = new ContainerServiceNetworkPluginMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkPolicy = new ContainerServiceNetworkPolicy(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkMode = new ContainerServiceNetworkMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("loadBalancerSku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loadBalancerSku = new ContainerServiceLoadBalancerSku(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkProfileForSnapshot( + networkPlugin, + networkPluginMode, + networkPolicy, + networkMode, + loadBalancerSku, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkPlugin), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkPlugin: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkPlugin)) + { + builder.Append(" networkPlugin: "); + builder.AppendLine($"'{NetworkPlugin.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkPluginMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkPluginMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkPluginMode)) + { + builder.Append(" networkPluginMode: "); + builder.AppendLine($"'{NetworkPluginMode.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkPolicy), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkPolicy: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkPolicy)) + { + builder.Append(" networkPolicy: "); + builder.AppendLine($"'{NetworkPolicy.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkMode)) + { + builder.Append(" networkMode: "); + builder.AppendLine($"'{NetworkMode.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LoadBalancerSku), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" loadBalancerSku: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LoadBalancerSku)) + { + builder.Append(" loadBalancerSku: "); + builder.AppendLine($"'{LoadBalancerSku.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkProfileForSnapshot)} does not support writing '{options.Format}' format."); + } + } + + NetworkProfileForSnapshot IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNetworkProfileForSnapshot(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkProfileForSnapshot)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkProfileForSnapshot.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkProfileForSnapshot.cs new file mode 100644 index 000000000000..a0172dd59c68 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkProfileForSnapshot.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// network profile for managed cluster snapshot, these properties are read only. + public partial class NetworkProfileForSnapshot + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal NetworkProfileForSnapshot() + { + } + + /// Initializes a new instance of . + /// networkPlugin for managed cluster snapshot. + /// NetworkPluginMode for managed cluster snapshot. + /// networkPolicy for managed cluster snapshot. + /// networkMode for managed cluster snapshot. + /// loadBalancerSku for managed cluster snapshot. + /// Keeps track of any properties unknown to the library. + internal NetworkProfileForSnapshot(ContainerServiceNetworkPlugin? networkPlugin, ContainerServiceNetworkPluginMode? networkPluginMode, ContainerServiceNetworkPolicy? networkPolicy, ContainerServiceNetworkMode? networkMode, ContainerServiceLoadBalancerSku? loadBalancerSku, IDictionary serializedAdditionalRawData) + { + NetworkPlugin = networkPlugin; + NetworkPluginMode = networkPluginMode; + NetworkPolicy = networkPolicy; + NetworkMode = networkMode; + LoadBalancerSku = loadBalancerSku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// networkPlugin for managed cluster snapshot. + [WirePath("networkPlugin")] + public ContainerServiceNetworkPlugin? NetworkPlugin { get; } + /// NetworkPluginMode for managed cluster snapshot. + [WirePath("networkPluginMode")] + public ContainerServiceNetworkPluginMode? NetworkPluginMode { get; } + /// networkPolicy for managed cluster snapshot. + [WirePath("networkPolicy")] + public ContainerServiceNetworkPolicy? NetworkPolicy { get; } + /// networkMode for managed cluster snapshot. + [WirePath("networkMode")] + public ContainerServiceNetworkMode? NetworkMode { get; } + /// loadBalancerSku for managed cluster snapshot. + [WirePath("loadBalancerSku")] + public ContainerServiceLoadBalancerSku? LoadBalancerSku { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NginxIngressControllerType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NginxIngressControllerType.cs new file mode 100644 index 000000000000..d787a52f31a9 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NginxIngressControllerType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Ingress type for the default NginxIngressController custom resource. + public readonly partial struct NginxIngressControllerType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NginxIngressControllerType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AnnotationControlledValue = "AnnotationControlled"; + private const string ExternalValue = "External"; + private const string InternalValue = "Internal"; + private const string NoneValue = "None"; + + /// The default NginxIngressController will be created. Users can edit the default NginxIngressController Custom Resource to configure load balancer annotations. + public static NginxIngressControllerType AnnotationControlled { get; } = new NginxIngressControllerType(AnnotationControlledValue); + /// The default NginxIngressController will be created and the operator will provision an external loadbalancer with it. Any annotation to make the default loadbalancer internal will be overwritten. + public static NginxIngressControllerType External { get; } = new NginxIngressControllerType(ExternalValue); + /// The default NginxIngressController will be created and the operator will provision an internal loadbalancer with it. Any annotation to make the default loadbalancer external will be overwritten. + public static NginxIngressControllerType Internal { get; } = new NginxIngressControllerType(InternalValue); + /// The default Ingress Controller will not be created. It will not be deleted by the system if it exists. Users should delete the default NginxIngressController Custom Resource manually if desired. + public static NginxIngressControllerType None { get; } = new NginxIngressControllerType(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(NginxIngressControllerType left, NginxIngressControllerType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NginxIngressControllerType left, NginxIngressControllerType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator NginxIngressControllerType(string value) => new NginxIngressControllerType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NginxIngressControllerType other && Equals(other); + /// + public bool Equals(NginxIngressControllerType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.Serialization.cs new file mode 100644 index 000000000000..0bc27d635cce --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.Serialization.cs @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class NodeImageVersion : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NodeImageVersion)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(OS)) + { + writer.WritePropertyName("os"u8); + writer.WriteStringValue(OS); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteStringValue(Sku); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (Optional.IsDefined(FullName)) + { + writer.WritePropertyName("fullName"u8); + writer.WriteStringValue(FullName); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NodeImageVersion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NodeImageVersion)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNodeImageVersion(document.RootElement, options); + } + + internal static NodeImageVersion DeserializeNodeImageVersion(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string os = default; + string sku = default; + string version = default; + string fullName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("os"u8)) + { + os = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku"u8)) + { + sku = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("fullName"u8)) + { + fullName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NodeImageVersion(os, sku, version, fullName, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OS), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" os: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(OS)) + { + builder.Append(" os: "); + if (OS.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{OS}'''"); + } + else + { + builder.AppendLine($"'{OS}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sku: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Sku)) + { + builder.Append(" sku: "); + if (Sku.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Sku}'''"); + } + else + { + builder.AppendLine($"'{Sku}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + if (Version.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Version}'''"); + } + else + { + builder.AppendLine($"'{Version}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FullName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" fullName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FullName)) + { + builder.Append(" fullName: "); + if (FullName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{FullName}'''"); + } + else + { + builder.AppendLine($"'{FullName}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NodeImageVersion)} does not support writing '{options.Format}' format."); + } + } + + NodeImageVersion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNodeImageVersion(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NodeImageVersion)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.cs new file mode 100644 index 000000000000..760f06d567a1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// node image version profile for given major.minor.patch release. + public partial class NodeImageVersion + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal NodeImageVersion() + { + } + + /// Initializes a new instance of . + /// The operating system of the node image. Example: AKSUbuntu. + /// The SKU or flavor of the node image. Example: 2004gen2containerd. + /// major.minor.patch version of the node image version release. Example: 2024.02.02. + /// The OS + SKU + version of the node image. Example: AKSUbuntu-1804gen2containerd-2024.02.02. + /// Keeps track of any properties unknown to the library. + internal NodeImageVersion(string os, string sku, string version, string fullName, IDictionary serializedAdditionalRawData) + { + OS = os; + Sku = sku; + Version = version; + FullName = fullName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The operating system of the node image. Example: AKSUbuntu. + [WirePath("os")] + public string OS { get; } + /// The SKU or flavor of the node image. Example: 2004gen2containerd. + [WirePath("sku")] + public string Sku { get; } + /// major.minor.patch version of the node image version release. Example: 2024.02.02. + [WirePath("version")] + public string Version { get; } + /// The OS + SKU + version of the node image. Example: AKSUbuntu-1804gen2containerd-2024.02.02. + [WirePath("fullName")] + public string FullName { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersionsListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersionsListResult.Serialization.cs new file mode 100644 index 000000000000..cd01facab68a --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersionsListResult.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class NodeImageVersionsListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NodeImageVersionsListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NodeImageVersionsListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NodeImageVersionsListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNodeImageVersionsListResult(document.RootElement, options); + } + + internal static NodeImageVersionsListResult DeserializeNodeImageVersionsListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NodeImageVersion.DeserializeNodeImageVersion(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NodeImageVersionsListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NodeImageVersionsListResult)} does not support writing '{options.Format}' format."); + } + } + + NodeImageVersionsListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNodeImageVersionsListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NodeImageVersionsListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersionsListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersionsListResult.cs new file mode 100644 index 000000000000..2fa77186f173 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersionsListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Holds an array NodeImageVersions. + internal partial class NodeImageVersionsListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal NodeImageVersionsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Array of AKS Node Image versions. + /// The URL to get the next set of machine results. + /// Keeps track of any properties unknown to the library. + internal NodeImageVersionsListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Array of AKS Node Image versions. + public IReadOnlyList Value { get; } + /// The URL to get the next set of machine results. + public Uri NextLink { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeProvisioningDefaultNodePool.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeProvisioningDefaultNodePool.cs new file mode 100644 index 000000000000..b96218554eb1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeProvisioningDefaultNodePool.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// This field has no effect unless mode is 'Auto'. Warning: Changing this from Auto to None on an existing cluster will cause the default Karpenter NodePools to be deleted, which will in turn drain and delete the nodes associated with those pools. It is strongly recommended to not do this unless there are idle nodes ready to take the pods evicted by that action. If not specified, the default is Auto. For more information see aka.ms/something. + public readonly partial struct NodeProvisioningDefaultNodePool : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NodeProvisioningDefaultNodePool(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string AutoValue = "Auto"; + + /// No Karpenter NodePools are provisioned automatically. Automatic scaling will not happen unless the user creates one or more NodePool instances. + public static NodeProvisioningDefaultNodePool None { get; } = new NodeProvisioningDefaultNodePool(NoneValue); + /// A standard set of Karpenter NodePools are provisioned. + public static NodeProvisioningDefaultNodePool Auto { get; } = new NodeProvisioningDefaultNodePool(AutoValue); + /// Determines if two values are the same. + public static bool operator ==(NodeProvisioningDefaultNodePool left, NodeProvisioningDefaultNodePool right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NodeProvisioningDefaultNodePool left, NodeProvisioningDefaultNodePool right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator NodeProvisioningDefaultNodePool(string value) => new NodeProvisioningDefaultNodePool(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NodeProvisioningDefaultNodePool other && Equals(other); + /// + public bool Equals(NodeProvisioningDefaultNodePool other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeProvisioningMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeProvisioningMode.cs new file mode 100644 index 000000000000..70f2a7aa9fdd --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeProvisioningMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Once the mode it set to Auto, it cannot be changed back to Manual. + public readonly partial struct NodeProvisioningMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NodeProvisioningMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ManualValue = "Manual"; + private const string AutoValue = "Auto"; + + /// Nodes are provisioned manually by the user. + public static NodeProvisioningMode Manual { get; } = new NodeProvisioningMode(ManualValue); + /// Nodes are provisioned automatically by AKS using Karpenter. Fixed size Node Pools can still be created, but autoscaling Node Pools cannot be. (See aka.ms/aks/nap for more details). + public static NodeProvisioningMode Auto { get; } = new NodeProvisioningMode(AutoValue); + /// Determines if two values are the same. + public static bool operator ==(NodeProvisioningMode left, NodeProvisioningMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NodeProvisioningMode left, NodeProvisioningMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator NodeProvisioningMode(string value) => new NodeProvisioningMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NodeProvisioningMode other && Equals(other); + /// + public bool Equals(NodeProvisioningMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResult.Serialization.cs new file mode 100644 index 000000000000..038236c5ff89 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResult.Serialization.cs @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class OperationStatusResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + if (Optional.IsDefined(PercentComplete)) + { + writer.WritePropertyName("percentComplete"u8); + writer.WriteNumberValue(PercentComplete.Value); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsCollectionDefined(Operations)) + { + writer.WritePropertyName("operations"u8); + writer.WriteStartArray(); + foreach (var item in Operations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationStatusResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationStatusResult(document.RootElement, options); + } + + internal static OperationStatusResult DeserializeOperationStatusResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + ResourceIdentifier resourceId = default; + string name = default; + string status = default; + float? percentComplete = default; + DateTimeOffset? startTime = default; + DateTimeOffset? endTime = default; + IReadOnlyList operations = default; + ResponseError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("percentComplete"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentComplete = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("operations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeOperationStatusResult(item, options)); + } + operations = array; + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationStatusResult( + id, + resourceId, + name, + status, + percentComplete, + startTime, + endTime, + operations ?? new ChangeTrackingList(), + error, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceId)) + { + builder.Append(" resourceId: "); + builder.AppendLine($"'{ResourceId.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + if (Status.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Status}'''"); + } + else + { + builder.AppendLine($"'{Status}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PercentComplete), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" percentComplete: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PercentComplete)) + { + builder.Append(" percentComplete: "); + builder.AppendLine($"'{PercentComplete.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartOn)) + { + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndOn)) + { + builder.Append(" endTime: "); + var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Operations), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" operations: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Operations)) + { + if (Operations.Any()) + { + builder.Append(" operations: "); + builder.AppendLine("["); + foreach (var item in Operations) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " operations: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support writing '{options.Format}' format."); + } + } + + OperationStatusResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationStatusResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResult.cs new file mode 100644 index 000000000000..3930083a0674 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResult.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The current status of an async operation. + public partial class OperationStatusResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Operation status. + /// is null. + internal OperationStatusResult(string status) + { + Argument.AssertNotNull(status, nameof(status)); + + Status = status; + Operations = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Fully qualified ID of the resource against which the original async operation was started. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + /// Keeps track of any properties unknown to the library. + internal OperationStatusResult(ResourceIdentifier id, ResourceIdentifier resourceId, string name, string status, float? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList operations, ResponseError error, IDictionary serializedAdditionalRawData) + { + Id = id; + ResourceId = resourceId; + Name = name; + Status = status; + PercentComplete = percentComplete; + StartOn = startOn; + EndOn = endOn; + Operations = operations; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OperationStatusResult() + { + } + + /// Fully qualified ID for the async operation. + [WirePath("id")] + public ResourceIdentifier Id { get; } + /// Fully qualified ID of the resource against which the original async operation was started. + [WirePath("resourceId")] + public ResourceIdentifier ResourceId { get; } + /// Name of the async operation. + [WirePath("name")] + public string Name { get; } + /// Operation status. + [WirePath("status")] + public string Status { get; } + /// Percent of the operation that is complete. + [WirePath("percentComplete")] + public float? PercentComplete { get; } + /// The start time of the operation. + [WirePath("startTime")] + public DateTimeOffset? StartOn { get; } + /// The end time of the operation. + [WirePath("endTime")] + public DateTimeOffset? EndOn { get; } + /// The operations list. + [WirePath("operations")] + public IReadOnlyList Operations { get; } + /// If present, details of the operation error. + [WirePath("error")] + public ResponseError Error { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResultList.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResultList.Serialization.cs new file mode 100644 index 000000000000..64ee2c73fed0 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResultList.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class OperationStatusResultList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationStatusResultList)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationStatusResultList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationStatusResultList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationStatusResultList(document.RootElement, options); + } + + internal static OperationStatusResultList DeserializeOperationStatusResultList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OperationStatusResult.DeserializeOperationStatusResult(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationStatusResultList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(OperationStatusResultList)} does not support writing '{options.Format}' format."); + } + } + + OperationStatusResultList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationStatusResultList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationStatusResultList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResultList.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResultList.cs new file mode 100644 index 000000000000..3f82dd5fd989 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OperationStatusResultList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The operations list. It contains an URL link to get the next set of results. + internal partial class OperationStatusResultList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal OperationStatusResultList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of operations. + /// URL to get the next set of operation list results (if there are any). + /// Keeps track of any properties unknown to the library. + internal OperationStatusResultList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of operations. + public IReadOnlyList Value { get; } + /// URL to get the next set of operation list results (if there are any). + public Uri NextLink { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Operator.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Operator.cs new file mode 100644 index 000000000000..703a9e168a58 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/Operator.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// operator represents a key's relationship to a set of values. Valid operators are In and NotIn. + public readonly partial struct Operator : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Operator(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InValue = "In"; + private const string NotInValue = "NotIn"; + private const string ExistsValue = "Exists"; + private const string DoesNotExistValue = "DoesNotExist"; + + /// The value of the key should be in the given list. + public static Operator In { get; } = new Operator(InValue); + /// The value of the key should not be in the given list. + public static Operator NotIn { get; } = new Operator(NotInValue); + /// The value of the key should exist. + public static Operator Exists { get; } = new Operator(ExistsValue); + /// The value of the key should not exist. + public static Operator DoesNotExist { get; } = new Operator(DoesNotExistValue); + /// Determines if two values are the same. + public static bool operator ==(Operator left, Operator right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Operator left, Operator right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Operator(string value) => new Operator(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Operator other && Equals(other); + /// + public bool Equals(Operator other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/PodIPAllocationMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/PodIPAllocationMode.cs new file mode 100644 index 000000000000..d68e1e51ce1b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/PodIPAllocationMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The IP allocation mode for pods in the agent pool. Must be used with podSubnetId. The default is 'DynamicIndividual'. + public readonly partial struct PodIPAllocationMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PodIPAllocationMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DynamicIndividualValue = "DynamicIndividual"; + private const string StaticBlockValue = "StaticBlock"; + + /// Each pod gets a single IP address assigned. This is better for maximizing a small to medium subnet of size /16 or smaller. The Azure CNI cluster with dynamic IP allocation defaults to this mode if the customer does not explicitly specify a podIPAllocationMode. + public static PodIPAllocationMode DynamicIndividual { get; } = new PodIPAllocationMode(DynamicIndividualValue); + /// Each node is statically allocated CIDR block(s) of size /28 = 16 IPs per block to satisfy the maxPods per node. Number of CIDR blocks >= (maxPods / 16). The block, rather than a single IP, counts against the Azure Vnet Private IP limit of 65K. Therefore block mode is suitable for running larger workloads with more than the current limit of 65K pods in a cluster. This mode is better suited to scale with larger subnets of /15 or bigger. + public static PodIPAllocationMode StaticBlock { get; } = new PodIPAllocationMode(StaticBlockValue); + /// Determines if two values are the same. + public static bool operator ==(PodIPAllocationMode left, PodIPAllocationMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PodIPAllocationMode left, PodIPAllocationMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PodIPAllocationMode(string value) => new PodIPAllocationMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PodIPAllocationMode other && Equals(other); + /// + public bool Equals(PodIPAllocationMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/PodLinkLocalAccess.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/PodLinkLocalAccess.cs new file mode 100644 index 000000000000..0cbea651a3c3 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/PodLinkLocalAccess.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Defines access to special link local addresses (Azure Instance Metadata Service, aka IMDS) for pods with hostNetwork=false. If not specified, the default is 'IMDS'. + public readonly partial struct PodLinkLocalAccess : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PodLinkLocalAccess(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ImdsValue = "IMDS"; + private const string NoneValue = "None"; + + /// Pods with hostNetwork=false can access Azure Instance Metadata Service (IMDS) without restriction. + public static PodLinkLocalAccess Imds { get; } = new PodLinkLocalAccess(ImdsValue); + /// Pods with hostNetwork=false cannot access Azure Instance Metadata Service (IMDS). + public static PodLinkLocalAccess None { get; } = new PodLinkLocalAccess(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(PodLinkLocalAccess left, PodLinkLocalAccess right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PodLinkLocalAccess left, PodLinkLocalAccess right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PodLinkLocalAccess(string value) => new PodLinkLocalAccess(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PodLinkLocalAccess other && Equals(other); + /// + public bool Equals(PodLinkLocalAccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/PolicyRule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/PolicyRule.cs new file mode 100644 index 000000000000..76e5a8e67542 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/PolicyRule.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Enum representing different network policy rules. + public readonly partial struct PolicyRule : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PolicyRule(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DenyAllValue = "DenyAll"; + private const string AllowAllValue = "AllowAll"; + private const string AllowSameNamespaceValue = "AllowSameNamespace"; + + /// Deny all network traffic. + public static PolicyRule DenyAll { get; } = new PolicyRule(DenyAllValue); + /// Allow all network traffic. + public static PolicyRule AllowAll { get; } = new PolicyRule(AllowAllValue); + /// Allow traffic within the same namespace. + public static PolicyRule AllowSameNamespace { get; } = new PolicyRule(AllowSameNamespaceValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyRule left, PolicyRule right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyRule left, PolicyRule right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PolicyRule(string value) => new PolicyRule(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyRule other && Equals(other); + /// + public bool Equals(PolicyRule other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RebalanceLoadBalancersRequestBody.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RebalanceLoadBalancersRequestBody.Serialization.cs new file mode 100644 index 000000000000..996afcae4091 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RebalanceLoadBalancersRequestBody.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class RebalanceLoadBalancersRequestBody : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RebalanceLoadBalancersRequestBody)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(LoadBalancerNames)) + { + writer.WritePropertyName("loadBalancerNames"u8); + writer.WriteStartArray(); + foreach (var item in LoadBalancerNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RebalanceLoadBalancersRequestBody IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RebalanceLoadBalancersRequestBody)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRebalanceLoadBalancersRequestBody(document.RootElement, options); + } + + internal static RebalanceLoadBalancersRequestBody DeserializeRebalanceLoadBalancersRequestBody(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList loadBalancerNames = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loadBalancerNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + loadBalancerNames = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RebalanceLoadBalancersRequestBody(loadBalancerNames ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RebalanceLoadBalancersRequestBody)} does not support writing '{options.Format}' format."); + } + } + + RebalanceLoadBalancersRequestBody IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRebalanceLoadBalancersRequestBody(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RebalanceLoadBalancersRequestBody)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RebalanceLoadBalancersRequestBody.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RebalanceLoadBalancersRequestBody.cs new file mode 100644 index 000000000000..975cd9bc22dd --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RebalanceLoadBalancersRequestBody.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The names of the load balancers to rebalance. If set to empty, all load balancers will be rebalanced. + public partial class RebalanceLoadBalancersRequestBody + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RebalanceLoadBalancersRequestBody() + { + LoadBalancerNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The load balancer names list. + /// Keeps track of any properties unknown to the library. + internal RebalanceLoadBalancersRequestBody(IList loadBalancerNames, IDictionary serializedAdditionalRawData) + { + LoadBalancerNames = loadBalancerNames; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The load balancer names list. + [WirePath("loadBalancerNames")] + public IList LoadBalancerNames { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ResourceQuota.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ResourceQuota.Serialization.cs new file mode 100644 index 000000000000..6cb7cb077d90 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ResourceQuota.Serialization.cs @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ResourceQuota : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceQuota)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(CpuRequest)) + { + writer.WritePropertyName("cpuRequest"u8); + writer.WriteStringValue(CpuRequest); + } + if (Optional.IsDefined(CpuLimit)) + { + writer.WritePropertyName("cpuLimit"u8); + writer.WriteStringValue(CpuLimit); + } + if (Optional.IsDefined(MemoryRequest)) + { + writer.WritePropertyName("memoryRequest"u8); + writer.WriteStringValue(MemoryRequest); + } + if (Optional.IsDefined(MemoryLimit)) + { + writer.WritePropertyName("memoryLimit"u8); + writer.WriteStringValue(MemoryLimit); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceQuota IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceQuota)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceQuota(document.RootElement, options); + } + + internal static ResourceQuota DeserializeResourceQuota(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string cpuRequest = default; + string cpuLimit = default; + string memoryRequest = default; + string memoryLimit = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("cpuRequest"u8)) + { + cpuRequest = property.Value.GetString(); + continue; + } + if (property.NameEquals("cpuLimit"u8)) + { + cpuLimit = property.Value.GetString(); + continue; + } + if (property.NameEquals("memoryRequest"u8)) + { + memoryRequest = property.Value.GetString(); + continue; + } + if (property.NameEquals("memoryLimit"u8)) + { + memoryLimit = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceQuota(cpuRequest, cpuLimit, memoryRequest, memoryLimit, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CpuRequest), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" cpuRequest: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CpuRequest)) + { + builder.Append(" cpuRequest: "); + if (CpuRequest.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CpuRequest}'''"); + } + else + { + builder.AppendLine($"'{CpuRequest}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CpuLimit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" cpuLimit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CpuLimit)) + { + builder.Append(" cpuLimit: "); + if (CpuLimit.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CpuLimit}'''"); + } + else + { + builder.AppendLine($"'{CpuLimit}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MemoryRequest), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" memoryRequest: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MemoryRequest)) + { + builder.Append(" memoryRequest: "); + if (MemoryRequest.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MemoryRequest}'''"); + } + else + { + builder.AppendLine($"'{MemoryRequest}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MemoryLimit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" memoryLimit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MemoryLimit)) + { + builder.Append(" memoryLimit: "); + if (MemoryLimit.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MemoryLimit}'''"); + } + else + { + builder.AppendLine($"'{MemoryLimit}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ResourceQuota)} does not support writing '{options.Format}' format."); + } + } + + ResourceQuota IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceQuota(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceQuota)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ResourceQuota.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ResourceQuota.cs new file mode 100644 index 000000000000..b8343d0d59ee --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ResourceQuota.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Resource quota for the namespace. + public partial class ResourceQuota + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ResourceQuota() + { + } + + /// Initializes a new instance of . + /// CPU request of the namespace in one-thousandth CPU form. See [CPU resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu) for more details. + /// CPU limit of the namespace in one-thousandth CPU form. See [CPU resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu) for more details. + /// Memory request of the namespace in the power-of-two equivalents form: Ei, Pi, Ti, Gi, Mi, Ki. See [Memory resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory) for more details. + /// Memory limit of the namespace in the power-of-two equivalents form: Ei, Pi, Ti, Gi, Mi, Ki. See [Memory resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory) for more details. + /// Keeps track of any properties unknown to the library. + internal ResourceQuota(string cpuRequest, string cpuLimit, string memoryRequest, string memoryLimit, IDictionary serializedAdditionalRawData) + { + CpuRequest = cpuRequest; + CpuLimit = cpuLimit; + MemoryRequest = memoryRequest; + MemoryLimit = memoryLimit; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// CPU request of the namespace in one-thousandth CPU form. See [CPU resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu) for more details. + [WirePath("cpuRequest")] + public string CpuRequest { get; set; } + /// CPU limit of the namespace in one-thousandth CPU form. See [CPU resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu) for more details. + [WirePath("cpuLimit")] + public string CpuLimit { get; set; } + /// Memory request of the namespace in the power-of-two equivalents form: Ei, Pi, Ti, Gi, Mi, Ki. See [Memory resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory) for more details. + [WirePath("memoryRequest")] + public string MemoryRequest { get; set; } + /// Memory limit of the namespace in the power-of-two equivalents form: Ei, Pi, Ti, Gi, Mi, Ki. See [Memory resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory) for more details. + [WirePath("memoryLimit")] + public string MemoryLimit { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RestrictionLevel.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RestrictionLevel.cs new file mode 100644 index 000000000000..ce97733ed562 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/RestrictionLevel.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The restriction level applied to the cluster's node resource group. + public readonly partial struct RestrictionLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RestrictionLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnrestrictedValue = "Unrestricted"; + private const string ReadOnlyValue = "ReadOnly"; + + /// All RBAC permissions are allowed on the managed node resource group. + public static RestrictionLevel Unrestricted { get; } = new RestrictionLevel(UnrestrictedValue); + /// Only */read RBAC permissions allowed on the managed node resource group. + public static RestrictionLevel ReadOnly { get; } = new RestrictionLevel(ReadOnlyValue); + /// Determines if two values are the same. + public static bool operator ==(RestrictionLevel left, RestrictionLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RestrictionLevel left, RestrictionLevel right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RestrictionLevel(string value) => new RestrictionLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RestrictionLevel other && Equals(other); + /// + public bool Equals(RestrictionLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsList.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsList.Serialization.cs new file mode 100644 index 000000000000..e090a06ec646 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsList.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class SafeguardsAvailableVersionsList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionsList)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SafeguardsAvailableVersionsList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionsList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSafeguardsAvailableVersionsList(document.RootElement, options); + } + + internal static SafeguardsAvailableVersionsList DeserializeSafeguardsAvailableVersionsList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SafeguardsAvailableVersionData.DeserializeSafeguardsAvailableVersionData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SafeguardsAvailableVersionsList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionsList)} does not support writing '{options.Format}' format."); + } + } + + SafeguardsAvailableVersionsList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSafeguardsAvailableVersionsList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionsList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsList.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsList.cs new file mode 100644 index 000000000000..5255ccc9b591 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Hold values properties, which is array of SafeguardsVersions. + internal partial class SafeguardsAvailableVersionsList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal SafeguardsAvailableVersionsList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Array of AKS supported Safeguards versions. + /// The URL to get the next Safeguards available version. + /// Keeps track of any properties unknown to the library. + internal SafeguardsAvailableVersionsList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Array of AKS supported Safeguards versions. + public IReadOnlyList Value { get; } + /// The URL to get the next Safeguards available version. + public string NextLink { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsProperties.Serialization.cs new file mode 100644 index 000000000000..44ff2f44d876 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsProperties.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class SafeguardsAvailableVersionsProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionsProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(IsDefaultVersion)) + { + writer.WritePropertyName("isDefaultVersion"u8); + writer.WriteBooleanValue(IsDefaultVersion.Value); + } + if (options.Format != "W" && Optional.IsDefined(Support)) + { + writer.WritePropertyName("support"u8); + writer.WriteStringValue(Support.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SafeguardsAvailableVersionsProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionsProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSafeguardsAvailableVersionsProperties(document.RootElement, options); + } + + internal static SafeguardsAvailableVersionsProperties DeserializeSafeguardsAvailableVersionsProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? isDefaultVersion = default; + SafeguardsSupport? support = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("isDefaultVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDefaultVersion = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("support"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + support = new SafeguardsSupport(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SafeguardsAvailableVersionsProperties(isDefaultVersion, support, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsDefaultVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isDefaultVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsDefaultVersion)) + { + builder.Append(" isDefaultVersion: "); + var boolValue = IsDefaultVersion.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Support), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" support: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Support)) + { + builder.Append(" support: "); + builder.AppendLine($"'{Support.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionsProperties)} does not support writing '{options.Format}' format."); + } + } + + SafeguardsAvailableVersionsProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSafeguardsAvailableVersionsProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionsProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsProperties.cs new file mode 100644 index 000000000000..c5da2e631c29 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsAvailableVersionsProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Whether the version is default or not and support info. + public partial class SafeguardsAvailableVersionsProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SafeguardsAvailableVersionsProperties() + { + } + + /// Initializes a new instance of . + /// + /// Whether the version is preview or stable. + /// Keeps track of any properties unknown to the library. + internal SafeguardsAvailableVersionsProperties(bool? isDefaultVersion, SafeguardsSupport? support, IDictionary serializedAdditionalRawData) + { + IsDefaultVersion = isDefaultVersion; + Support = support; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets the is default version. + [WirePath("isDefaultVersion")] + public bool? IsDefaultVersion { get; } + /// Whether the version is preview or stable. + [WirePath("support")] + public SafeguardsSupport? Support { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsProfile.Serialization.cs new file mode 100644 index 000000000000..b5220d62e206 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsProfile.Serialization.cs @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class SafeguardsProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SafeguardsProfile)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsCollectionDefined(SystemExcludedNamespaces)) + { + writer.WritePropertyName("systemExcludedNamespaces"u8); + writer.WriteStartArray(); + foreach (var item in SystemExcludedNamespaces) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + writer.WritePropertyName("level"u8); + writer.WriteStringValue(Level.ToString()); + if (Optional.IsCollectionDefined(ExcludedNamespaces)) + { + writer.WritePropertyName("excludedNamespaces"u8); + writer.WriteStartArray(); + foreach (var item in ExcludedNamespaces) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SafeguardsProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SafeguardsProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSafeguardsProfile(document.RootElement, options); + } + + internal static SafeguardsProfile DeserializeSafeguardsProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList systemExcludedNamespaces = default; + string version = default; + Level level = default; + IList excludedNamespaces = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("systemExcludedNamespaces"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + systemExcludedNamespaces = array; + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("level"u8)) + { + level = new Level(property.Value.GetString()); + continue; + } + if (property.NameEquals("excludedNamespaces"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + excludedNamespaces = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SafeguardsProfile(systemExcludedNamespaces ?? new ChangeTrackingList(), version, level, excludedNamespaces ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemExcludedNamespaces), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemExcludedNamespaces: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(SystemExcludedNamespaces)) + { + if (SystemExcludedNamespaces.Any()) + { + builder.Append(" systemExcludedNamespaces: "); + builder.AppendLine("["); + foreach (var item in SystemExcludedNamespaces) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + if (Version.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Version}'''"); + } + else + { + builder.AppendLine($"'{Version}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Level), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" level: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" level: "); + builder.AppendLine($"'{Level.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExcludedNamespaces), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" excludedNamespaces: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ExcludedNamespaces)) + { + if (ExcludedNamespaces.Any()) + { + builder.Append(" excludedNamespaces: "); + builder.AppendLine("["); + foreach (var item in ExcludedNamespaces) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SafeguardsProfile)} does not support writing '{options.Format}' format."); + } + } + + SafeguardsProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSafeguardsProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SafeguardsProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsProfile.cs new file mode 100644 index 000000000000..58421490cba0 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsProfile.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The Safeguards profile. + public partial class SafeguardsProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The Safeguards level to be used. By default, Safeguards is enabled for all namespaces except those that AKS excludes via systemExcludedNamespaces. + public SafeguardsProfile(Level level) + { + SystemExcludedNamespaces = new ChangeTrackingList(); + Level = level; + ExcludedNamespaces = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of namespaces specified by AKS to be excluded from Safeguards. + /// The version of constraints to use. + /// The Safeguards level to be used. By default, Safeguards is enabled for all namespaces except those that AKS excludes via systemExcludedNamespaces. + /// List of namespaces excluded from Safeguards checks. + /// Keeps track of any properties unknown to the library. + internal SafeguardsProfile(IReadOnlyList systemExcludedNamespaces, string version, Level level, IList excludedNamespaces, IDictionary serializedAdditionalRawData) + { + SystemExcludedNamespaces = systemExcludedNamespaces; + Version = version; + Level = level; + ExcludedNamespaces = excludedNamespaces; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SafeguardsProfile() + { + } + + /// List of namespaces specified by AKS to be excluded from Safeguards. + [WirePath("systemExcludedNamespaces")] + public IReadOnlyList SystemExcludedNamespaces { get; } + /// The version of constraints to use. + [WirePath("version")] + public string Version { get; set; } + /// The Safeguards level to be used. By default, Safeguards is enabled for all namespaces except those that AKS excludes via systemExcludedNamespaces. + [WirePath("level")] + public Level Level { get; set; } + /// List of namespaces excluded from Safeguards checks. + [WirePath("excludedNamespaces")] + public IList ExcludedNamespaces { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsSupport.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsSupport.cs new file mode 100644 index 000000000000..88b0a410a3af --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SafeguardsSupport.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Whether the version is preview or stable. + public readonly partial struct SafeguardsSupport : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SafeguardsSupport(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PreviewValue = "Preview"; + private const string StableValue = "Stable"; + + /// The version is preview. It is not recommended to use preview versions on critical production clusters. The preview version may not support all use-cases. + public static SafeguardsSupport Preview { get; } = new SafeguardsSupport(PreviewValue); + /// The version is stable and can be used on critical production clusters. + public static SafeguardsSupport Stable { get; } = new SafeguardsSupport(StableValue); + /// Determines if two values are the same. + public static bool operator ==(SafeguardsSupport left, SafeguardsSupport right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SafeguardsSupport left, SafeguardsSupport right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SafeguardsSupport(string value) => new SafeguardsSupport(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SafeguardsSupport other && Equals(other); + /// + public bool Equals(SafeguardsSupport other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleProfile.Serialization.cs new file mode 100644 index 000000000000..4895618707bb --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleProfile.Serialization.cs @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + public partial class ScaleProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ScaleProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Manual)) + { + writer.WritePropertyName("manual"u8); + writer.WriteStartArray(); + foreach (var item in Manual) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Autoscale)) + { + writer.WritePropertyName("autoscale"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Autoscale); +#else + using (JsonDocument document = JsonDocument.Parse(Autoscale, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ScaleProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ScaleProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScaleProfile(document.RootElement, options); + } + + internal static ScaleProfile DeserializeScaleProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList manual = default; + BinaryData autoscale = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("manual"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManualScaleProfile.DeserializeManualScaleProfile(item, options)); + } + manual = array; + continue; + } + if (property.NameEquals("autoscale"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoscale = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScaleProfile(manual ?? new ChangeTrackingList(), autoscale, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Manual), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" manual: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Manual)) + { + if (Manual.Any()) + { + builder.Append(" manual: "); + builder.AppendLine("["); + foreach (var item in Manual) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " manual: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Autoscale), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" autoscale: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Autoscale)) + { + builder.Append(" autoscale: "); + builder.AppendLine($"'{Autoscale.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ScaleProfile)} does not support writing '{options.Format}' format."); + } + } + + ScaleProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeScaleProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScaleProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleProfile.cs new file mode 100644 index 000000000000..6c24596e5c4d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleProfile.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Specifications on how to scale a VirtualMachines agent pool. + public partial class ScaleProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ScaleProfile() + { + Manual = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Specifications on how to scale the VirtualMachines agent pool to a fixed size. + /// Specifications on how to auto-scale the VirtualMachines agent pool within a predefined size range. + /// Keeps track of any properties unknown to the library. + internal ScaleProfile(IList manual, BinaryData autoscale, IDictionary serializedAdditionalRawData) + { + Manual = manual; + Autoscale = autoscale; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Specifications on how to scale the VirtualMachines agent pool to a fixed size. + [WirePath("manual")] + public IList Manual { get; } + /// + /// Specifications on how to auto-scale the VirtualMachines agent pool within a predefined size range. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("autoscale")] + public BinaryData Autoscale { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerConfigMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerConfigMode.cs new file mode 100644 index 000000000000..2a3a64595bba --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerConfigMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The config customization mode for this scheduler instance. + public readonly partial struct SchedulerConfigMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SchedulerConfigMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string ManagedByCRDValue = "ManagedByCRD"; + + /// No config customization. Use default configuration. + public static SchedulerConfigMode Default { get; } = new SchedulerConfigMode(DefaultValue); + /// Enable config customization. Customer can specify scheduler configuration via a CRD. See aka.ms/aks/scheduler-crd for details. + public static SchedulerConfigMode ManagedByCRD { get; } = new SchedulerConfigMode(ManagedByCRDValue); + /// Determines if two values are the same. + public static bool operator ==(SchedulerConfigMode left, SchedulerConfigMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SchedulerConfigMode left, SchedulerConfigMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SchedulerConfigMode(string value) => new SchedulerConfigMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SchedulerConfigMode other && Equals(other); + /// + public bool Equals(SchedulerConfigMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerInstanceProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerInstanceProfile.Serialization.cs new file mode 100644 index 000000000000..ed4e3ae42095 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerInstanceProfile.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class SchedulerInstanceProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerInstanceProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SchedulerConfigMode)) + { + writer.WritePropertyName("schedulerConfigMode"u8); + writer.WriteStringValue(SchedulerConfigMode.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerInstanceProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerInstanceProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerInstanceProfile(document.RootElement, options); + } + + internal static SchedulerInstanceProfile DeserializeSchedulerInstanceProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SchedulerConfigMode? schedulerConfigMode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("schedulerConfigMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + schedulerConfigMode = new SchedulerConfigMode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerInstanceProfile(schedulerConfigMode, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SchedulerConfigMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" schedulerConfigMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SchedulerConfigMode)) + { + builder.Append(" schedulerConfigMode: "); + builder.AppendLine($"'{SchedulerConfigMode.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SchedulerInstanceProfile)} does not support writing '{options.Format}' format."); + } + } + + SchedulerInstanceProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSchedulerInstanceProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerInstanceProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerInstanceProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerInstanceProfile.cs new file mode 100644 index 000000000000..1498b3f2c33e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerInstanceProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The scheduler profile for a single scheduler instance. + internal partial class SchedulerInstanceProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SchedulerInstanceProfile() + { + } + + /// Initializes a new instance of . + /// The config customization mode for this scheduler instance. + /// Keeps track of any properties unknown to the library. + internal SchedulerInstanceProfile(SchedulerConfigMode? schedulerConfigMode, IDictionary serializedAdditionalRawData) + { + SchedulerConfigMode = schedulerConfigMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The config customization mode for this scheduler instance. + [WirePath("schedulerConfigMode")] + public SchedulerConfigMode? SchedulerConfigMode { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfile.Serialization.cs new file mode 100644 index 000000000000..085b54f4bc4e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfile.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class SchedulerProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SchedulerInstanceProfiles)) + { + writer.WritePropertyName("schedulerInstanceProfiles"u8); + writer.WriteObjectValue(SchedulerInstanceProfiles, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerProfile(document.RootElement, options); + } + + internal static SchedulerProfile DeserializeSchedulerProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SchedulerProfileSchedulerInstanceProfiles schedulerInstanceProfiles = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("schedulerInstanceProfiles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + schedulerInstanceProfiles = SchedulerProfileSchedulerInstanceProfiles.DeserializeSchedulerProfileSchedulerInstanceProfiles(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerProfile(schedulerInstanceProfiles, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("UpstreamSchedulerConfigMode", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" schedulerInstanceProfiles: "); + builder.AppendLine("{"); + builder.AppendLine(" upstream: {"); + builder.Append(" schedulerConfigMode: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(SchedulerInstanceProfiles)) + { + builder.Append(" schedulerInstanceProfiles: "); + BicepSerializationHelpers.AppendChildObject(builder, SchedulerInstanceProfiles, options, 2, false, " schedulerInstanceProfiles: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SchedulerProfile)} does not support writing '{options.Format}' format."); + } + } + + SchedulerProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSchedulerProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfile.cs new file mode 100644 index 000000000000..c8294cf68363 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfile.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// The pod scheduler profile for the cluster. + internal partial class SchedulerProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SchedulerProfile() + { + } + + /// Initializes a new instance of . + /// Mapping of each scheduler instance to its profile. + /// Keeps track of any properties unknown to the library. + internal SchedulerProfile(SchedulerProfileSchedulerInstanceProfiles schedulerInstanceProfiles, IDictionary serializedAdditionalRawData) + { + SchedulerInstanceProfiles = schedulerInstanceProfiles; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Mapping of each scheduler instance to its profile. + internal SchedulerProfileSchedulerInstanceProfiles SchedulerInstanceProfiles { get; set; } + /// The config customization mode for this scheduler instance. + [WirePath("schedulerInstanceProfiles.upstream.schedulerConfigMode")] + public SchedulerConfigMode? UpstreamSchedulerConfigMode + { + get => SchedulerInstanceProfiles is null ? default : SchedulerInstanceProfiles.UpstreamSchedulerConfigMode; + set + { + if (SchedulerInstanceProfiles is null) + SchedulerInstanceProfiles = new SchedulerProfileSchedulerInstanceProfiles(); + SchedulerInstanceProfiles.UpstreamSchedulerConfigMode = value; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfileSchedulerInstanceProfiles.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfileSchedulerInstanceProfiles.Serialization.cs new file mode 100644 index 000000000000..58f8210bb96f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfileSchedulerInstanceProfiles.Serialization.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class SchedulerProfileSchedulerInstanceProfiles : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerProfileSchedulerInstanceProfiles)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Upstream)) + { + writer.WritePropertyName("upstream"u8); + writer.WriteObjectValue(Upstream, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerProfileSchedulerInstanceProfiles IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerProfileSchedulerInstanceProfiles)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerProfileSchedulerInstanceProfiles(document.RootElement, options); + } + + internal static SchedulerProfileSchedulerInstanceProfiles DeserializeSchedulerProfileSchedulerInstanceProfiles(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SchedulerInstanceProfile upstream = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("upstream"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upstream = SchedulerInstanceProfile.DeserializeSchedulerInstanceProfile(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerProfileSchedulerInstanceProfiles(upstream, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("UpstreamSchedulerConfigMode", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" upstream: "); + builder.AppendLine("{"); + builder.Append(" schedulerConfigMode: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Upstream)) + { + builder.Append(" upstream: "); + BicepSerializationHelpers.AppendChildObject(builder, Upstream, options, 2, false, " upstream: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SchedulerProfileSchedulerInstanceProfiles)} does not support writing '{options.Format}' format."); + } + } + + SchedulerProfileSchedulerInstanceProfiles IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSchedulerProfileSchedulerInstanceProfiles(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerProfileSchedulerInstanceProfiles)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfileSchedulerInstanceProfiles.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfileSchedulerInstanceProfiles.cs new file mode 100644 index 000000000000..b58198377c0c --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SchedulerProfileSchedulerInstanceProfiles.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Mapping of each scheduler instance to its profile. + internal partial class SchedulerProfileSchedulerInstanceProfiles + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SchedulerProfileSchedulerInstanceProfiles() + { + } + + /// Initializes a new instance of . + /// The scheduler profile for the upstream scheduler instance. + /// Keeps track of any properties unknown to the library. + internal SchedulerProfileSchedulerInstanceProfiles(SchedulerInstanceProfile upstream, IDictionary serializedAdditionalRawData) + { + Upstream = upstream; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The scheduler profile for the upstream scheduler instance. + internal SchedulerInstanceProfile Upstream { get; set; } + /// The config customization mode for this scheduler instance. + [WirePath("upstream.schedulerConfigMode")] + public SchedulerConfigMode? UpstreamSchedulerConfigMode + { + get => Upstream is null ? default : Upstream.SchedulerConfigMode; + set + { + if (Upstream is null) + Upstream = new SchedulerInstanceProfile(); + Upstream.SchedulerConfigMode = value; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SeccompDefault.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SeccompDefault.cs new file mode 100644 index 000000000000..70fa86c3ec9e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SeccompDefault.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Specifies the default seccomp profile applied to all workloads. If not specified, 'Unconfined' will be used by default. + public readonly partial struct SeccompDefault : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SeccompDefault(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnconfinedValue = "Unconfined"; + private const string RuntimeDefaultValue = "RuntimeDefault"; + + /// No seccomp profile is applied, allowing all system calls. + public static SeccompDefault Unconfined { get; } = new SeccompDefault(UnconfinedValue); + /// The default seccomp profile for container runtime is applied, which restricts certain system calls for enhanced security. + public static SeccompDefault RuntimeDefault { get; } = new SeccompDefault(RuntimeDefaultValue); + /// Determines if two values are the same. + public static bool operator ==(SeccompDefault left, SeccompDefault right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SeccompDefault left, SeccompDefault right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SeccompDefault(string value) => new SeccompDefault(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SeccompDefault other && Equals(other); + /// + public bool Equals(SeccompDefault other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SnapshotType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SnapshotType.cs index 0a958be845e9..b0fd9778a210 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SnapshotType.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SnapshotType.cs @@ -23,9 +23,12 @@ public SnapshotType(string value) } private const string NodePoolValue = "NodePool"; + private const string ManagedClusterValue = "ManagedCluster"; /// The snapshot is a snapshot of a node pool. public static SnapshotType NodePool { get; } = new SnapshotType(NodePoolValue); + /// The snapshot is a snapshot of a managed cluster. + public static SnapshotType ManagedCluster { get; } = new SnapshotType(ManagedClusterValue); /// Determines if two values are the same. public static bool operator ==(SnapshotType left, SnapshotType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TransitEncryptionType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TransitEncryptionType.cs new file mode 100644 index 000000000000..93a337d39d8e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TransitEncryptionType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// This can be enabled only on Cilium-based clusters. If not specified, the default value is None. + public readonly partial struct TransitEncryptionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TransitEncryptionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string WireGuardValue = "WireGuard"; + private const string NoneValue = "None"; + + /// Enable WireGuard encryption. Refer to https://docs.cilium.io/en/latest/security/network/encryption-wireguard/ on use cases and implementation details. + public static TransitEncryptionType WireGuard { get; } = new TransitEncryptionType(WireGuardValue); + /// Disable Transit encryption. + public static TransitEncryptionType None { get; } = new TransitEncryptionType(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(TransitEncryptionType left, TransitEncryptionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TransitEncryptionType left, TransitEncryptionType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TransitEncryptionType(string value) => new TransitEncryptionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TransitEncryptionType other && Equals(other); + /// + public bool Equals(TransitEncryptionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UndrainableNodeBehavior.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UndrainableNodeBehavior.cs new file mode 100644 index 000000000000..da9c4bac1342 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UndrainableNodeBehavior.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Defines the behavior for undrainable nodes during upgrade. The most common cause of undrainable nodes is Pod Disruption Budgets (PDBs), but other issues, such as pod termination grace period is exceeding the remaining per-node drain timeout or pod is still being in a running state, can also cause undrainable nodes. + public readonly partial struct UndrainableNodeBehavior : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public UndrainableNodeBehavior(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CordonValue = "Cordon"; + private const string ScheduleValue = "Schedule"; + + /// AKS will cordon the blocked nodes and replace them with surge nodes during upgrade. The blocked nodes will be cordoned and replaced by surge nodes. The blocked nodes will have label 'kubernetes.azure.com/upgrade-status:Quarantined'. A surge node will be retained for each blocked node. A best-effort attempt will be made to delete all other surge nodes. If there are enough surge nodes to replace blocked nodes, then the upgrade operation and the managed cluster will be in failed state. Otherwise, the upgrade operation and the managed cluster will be in canceled state. + public static UndrainableNodeBehavior Cordon { get; } = new UndrainableNodeBehavior(CordonValue); + /// AKS will mark the blocked nodes schedulable, but the blocked nodes are not upgraded. A best-effort attempt will be made to delete all surge nodes. The upgrade operation and the managed cluster will be in failed state if there are any blocked nodes. + public static UndrainableNodeBehavior Schedule { get; } = new UndrainableNodeBehavior(ScheduleValue); + /// Determines if two values are the same. + public static bool operator ==(UndrainableNodeBehavior left, UndrainableNodeBehavior right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(UndrainableNodeBehavior left, UndrainableNodeBehavior right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator UndrainableNodeBehavior(string value) => new UndrainableNodeBehavior(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is UndrainableNodeBehavior other && Equals(other); + /// + public bool Equals(UndrainableNodeBehavior other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachineNodes.Serialization.cs similarity index 58% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachineNodes.Serialization.cs index 4796fc7e6210..8f2cce279cb4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachineNodes.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceOSOptionProperty : IUtf8JsonSerializable, IJsonModel + public partial class VirtualMachineNodes : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -29,16 +29,22 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ContainerServiceOSOptionProperty)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VirtualMachineNodes)} does not support writing '{format}' format."); } - writer.WritePropertyName("os-type"u8); - writer.WriteStringValue(OSType); - writer.WritePropertyName("enable-fips-image"u8); - writer.WriteBooleanValue(EnableFipsImage); + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteStringValue(Size); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -56,19 +62,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ContainerServiceOSOptionProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VirtualMachineNodes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ContainerServiceOSOptionProperty)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VirtualMachineNodes)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceOSOptionProperty(document.RootElement, options); + return DeserializeVirtualMachineNodes(document.RootElement, options); } - internal static ContainerServiceOSOptionProperty DeserializeContainerServiceOSOptionProperty(JsonElement element, ModelReaderWriterOptions options = null) + internal static VirtualMachineNodes DeserializeVirtualMachineNodes(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,20 +82,24 @@ internal static ContainerServiceOSOptionProperty DeserializeContainerServiceOSOp { return null; } - string osType = default; - bool enableFipsImage = default; + string size = default; + int? count = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("os-type"u8)) + if (property.NameEquals("size"u8)) { - osType = property.Value.GetString(); + size = property.Value.GetString(); continue; } - if (property.NameEquals("enable-fips-image"u8)) + if (property.NameEquals("count"u8)) { - enableFipsImage = property.Value.GetBoolean(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt32(); continue; } if (options.Format != "W") @@ -98,7 +108,7 @@ internal static ContainerServiceOSOptionProperty DeserializeContainerServiceOSOp } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceOSOptionProperty(osType, enableFipsImage, serializedAdditionalRawData); + return new VirtualMachineNodes(size, count, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -112,49 +122,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSType), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Size), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" os-type: "); + builder.Append(" size: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(OSType)) + if (Optional.IsDefined(Size)) { - builder.Append(" os-type: "); - if (OSType.Contains(Environment.NewLine)) + builder.Append(" size: "); + if (Size.Contains(Environment.NewLine)) { builder.AppendLine("'''"); - builder.AppendLine($"{OSType}'''"); + builder.AppendLine($"{Size}'''"); } else { - builder.AppendLine($"'{OSType}'"); + builder.AppendLine($"'{Size}'"); } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableFipsImage), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Count), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" enable-fips-image: "); + builder.Append(" count: "); builder.AppendLine(propertyOverride); } else { - builder.Append(" enable-fips-image: "); - var boolValue = EnableFipsImage == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); + if (Optional.IsDefined(Count)) + { + builder.Append(" count: "); + builder.AppendLine($"{Count.Value}"); + } } builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { @@ -163,26 +175,26 @@ BinaryData IPersistableModel.Write(ModelReader case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServiceOSOptionProperty)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VirtualMachineNodes)} does not support writing '{options.Format}' format."); } } - ContainerServiceOSOptionProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VirtualMachineNodes IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeContainerServiceOSOptionProperty(document.RootElement, options); + return DeserializeVirtualMachineNodes(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceOSOptionProperty)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VirtualMachineNodes)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachineNodes.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachineNodes.cs new file mode 100644 index 000000000000..a8ac2fe50070 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachineNodes.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Current status on a group of nodes of the same vm size. + public partial class VirtualMachineNodes + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public VirtualMachineNodes() + { + } + + /// Initializes a new instance of . + /// The VM size of the agents used to host this group of nodes. + /// Number of nodes. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineNodes(string size, int? count, IDictionary serializedAdditionalRawData) + { + Size = size; + Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The VM size of the agents used to host this group of nodes. + [WirePath("size")] + public string Size { get; set; } + /// Number of nodes. + [WirePath("count")] + public int? Count { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachinesProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachinesProfile.Serialization.cs new file mode 100644 index 000000000000..8ebd6466b116 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachinesProfile.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Models +{ + internal partial class VirtualMachinesProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VirtualMachinesProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Scale)) + { + writer.WritePropertyName("scale"u8); + writer.WriteObjectValue(Scale, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VirtualMachinesProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VirtualMachinesProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachinesProfile(document.RootElement, options); + } + + internal static VirtualMachinesProfile DeserializeVirtualMachinesProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ScaleProfile scale = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scale"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scale = ScaleProfile.DeserializeScaleProfile(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VirtualMachinesProfile(scale, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Scale), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scale: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Scale)) + { + builder.Append(" scale: "); + BicepSerializationHelpers.AppendChildObject(builder, Scale, options, 2, false, " scale: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(VirtualMachinesProfile)} does not support writing '{options.Format}' format."); + } + } + + VirtualMachinesProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVirtualMachinesProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VirtualMachinesProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachinesProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachinesProfile.cs new file mode 100644 index 000000000000..cc527b2ea286 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/VirtualMachinesProfile.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Specifications on VirtualMachines agent pool. + internal partial class VirtualMachinesProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public VirtualMachinesProfile() + { + } + + /// Initializes a new instance of . + /// Specifications on how to scale a VirtualMachines agent pool. + /// Keeps track of any properties unknown to the library. + internal VirtualMachinesProfile(ScaleProfile scale, IDictionary serializedAdditionalRawData) + { + Scale = scale; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Specifications on how to scale a VirtualMachines agent pool. + [WirePath("scale")] + public ScaleProfile Scale { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WorkloadRuntime.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WorkloadRuntime.cs index 84e4f59e5f98..abc70340a6ff 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WorkloadRuntime.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WorkloadRuntime.cs @@ -24,11 +24,14 @@ public WorkloadRuntime(string value) private const string OciContainerValue = "OCIContainer"; private const string WasmWasiValue = "WasmWasi"; + private const string KataMshvVmIsolationValue = "KataMshvVmIsolation"; /// Nodes will use Kubelet to run standard OCI container workloads. public static WorkloadRuntime OciContainer { get; } = new WorkloadRuntime(OciContainerValue); /// Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). public static WorkloadRuntime WasmWasi { get; } = new WorkloadRuntime(WasmWasiValue); + /// Nodes can use (Kata + Cloud Hypervisor + Hyper-V) to enable Nested VM-based pods (Preview). Due to the use Hyper-V, AKS node OS itself is a nested VM (the root OS) of Hyper-V. Thus it can only be used with VM series that support Nested Virtualization such as Dv3 series. + public static WorkloadRuntime KataMshvVmIsolation { get; } = new WorkloadRuntime(KataMshvVmIsolationValue); /// Determines if two values are the same. public static bool operator ==(WorkloadRuntime left, WorkloadRuntime right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceCollection.cs new file mode 100644 index 000000000000..b1e36659b576 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetNamespaces method from an instance of . + /// + public partial class NamespaceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _namespaceClientDiagnostics; + private readonly NamespacesRestOperations _namespaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected NamespaceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal NamespaceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _namespaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", NamespaceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NamespaceResource.ResourceType, out string namespaceApiVersion); + _namespaceRestClient = new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, namespaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ContainerServiceManagedClusterResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ContainerServiceManagedClusterResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a namespace in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the namespace. + /// The namespace to create or update. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string namespaceName, NamespaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _namespaceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, data, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new NamespaceOperationSource(Client), _namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a namespace in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the namespace. + /// The namespace to create or update. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string namespaceName, NamespaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _namespaceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, data, cancellationToken); + var operation = new ContainerServiceArmOperation(new NamespaceOperationSource(Client), _namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified namespace of a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.Get"); + scope.Start(); + try + { + var response = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified namespace of a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.Get"); + scope.Start(); + try + { + var response = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of managed namespaces in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces + /// + /// + /// Operation Id + /// Namespaces_ListByManagedCluster + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _namespaceRestClient.CreateListByManagedClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _namespaceRestClient.CreateListByManagedClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NamespaceResource(Client, NamespaceData.DeserializeNamespaceData(e)), _namespaceClientDiagnostics, Pipeline, "NamespaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of managed namespaces in the specified managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces + /// + /// + /// Operation Id + /// Namespaces_ListByManagedCluster + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _namespaceRestClient.CreateListByManagedClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _namespaceRestClient.CreateListByManagedClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NamespaceResource(Client, NamespaceData.DeserializeNamespaceData(e)), _namespaceClientDiagnostics, Pipeline, "NamespaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.Exists"); + scope.Start(); + try + { + var response = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.Exists"); + scope.Start(); + try + { + var response = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceData.Serialization.cs new file mode 100644 index 000000000000..485c430e58ba --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceData.Serialization.cs @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class NamespaceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamespaceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + NamespaceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamespaceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNamespaceData(document.RootElement, options); + } + + internal static NamespaceData DeserializeNamespaceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? etag = default; + NamespaceProperties properties = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NamespaceProperties.DeserializeNamespaceProperties(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NamespaceData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + etag, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" eTag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" eTag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NamespaceData)} does not support writing '{options.Format}' format."); + } + } + + NamespaceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNamespaceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NamespaceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceData.cs new file mode 100644 index 000000000000..ca70f79f0ed3 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceData.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing the Namespace data model. + /// Namespace managed by ARM. + /// + public partial class NamespaceData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public NamespaceData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. + /// Properties of a namespace. + /// Keeps track of any properties unknown to the library. + internal NamespaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, NamespaceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + ETag = etag; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NamespaceData() + { + } + + /// Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource is updated. Specify an if-match or if-none-match header with the eTag value for a subsequent request to enable optimistic concurrency per the normal etag convention. + [WirePath("eTag")] + public ETag? ETag { get; } + /// Properties of a namespace. + [WirePath("properties")] + public NamespaceProperties Properties { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceResource.Serialization.cs new file mode 100644 index 000000000000..b7a586c33c03 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class NamespaceResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + NamespaceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + NamespaceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceResource.cs new file mode 100644 index 000000000000..df5fabaf8a2e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/NamespaceResource.cs @@ -0,0 +1,775 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A Class representing a Namespace along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetNamespaceResource method. + /// Otherwise you can get one from its parent resource using the GetNamespace method. + /// + public partial class NamespaceResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The namespaceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _namespaceClientDiagnostics; + private readonly NamespacesRestOperations _namespaceRestClient; + private readonly NamespaceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/namespaces"; + + /// Initializes a new instance of the class for mocking. + protected NamespaceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NamespaceResource(ArmClient client, NamespaceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal NamespaceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _namespaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string namespaceApiVersion); + _namespaceRestClient = new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, namespaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual NamespaceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the specified namespace of a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Get"); + scope.Start(); + try + { + var response = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified namespace of a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Get"); + scope.Start(); + try + { + var response = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Delete + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Delete"); + scope.Start(); + try + { + var response = await _namespaceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Delete + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Delete"); + scope.Start(); + try + { + var response = _namespaceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ContainerServiceArmOperation(_namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates tags on a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Update + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Parameters supplied to the patch namespace operation, we only support patch tags for now. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Update"); + scope.Start(); + try + { + var response = await _namespaceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, containerServiceTagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates tags on a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Update + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Parameters supplied to the patch namespace operation, we only support patch tags for now. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Update"); + scope.Start(); + try + { + var response = _namespaceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, containerServiceTagsObject, cancellationToken); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the credentials of a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName}/listCredential + /// + /// + /// Operation Id + /// Namespaces_ListCredential + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetCredentialAsync(CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.GetCredential"); + scope.Start(); + try + { + var response = await _namespaceRestClient.ListCredentialAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the credentials of a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName}/listCredential + /// + /// + /// Operation Id + /// Namespaces_ListCredential + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetCredential(CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.GetCredential"); + scope.Start(); + try + { + var response = _namespaceRestClient.ListCredential(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ContainerServiceTagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ContainerServiceTagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ContainerServiceTagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ContainerServiceTagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ContainerServiceTagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ContainerServiceTagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.Serialization.cs deleted file mode 100644 index 506123d852f4..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.ContainerService -{ - public partial class OSOptionProfileResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - OSOptionProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - OSOptionProfileData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs index 4700f59edb16..ec77f3f2e240 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs @@ -32,7 +32,7 @@ public AgentPoolsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-02-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -76,7 +76,7 @@ internal HttpMessage CreateAbortLatestOperationRequest(string subscriptionId, st return message; } - /// Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, a 409 error code is returned. + /// Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, an error is returned. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. @@ -103,7 +103,7 @@ public async Task AbortLatestOperationAsync(string subscriptionId, str } } - /// Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, a 409 error code is returned. + /// Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, an error is returned. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. @@ -328,7 +328,7 @@ public Response Get(string subscriptionId, string } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch, string ifNoneMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -344,7 +344,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch, string ifNoneMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -361,6 +361,14 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(agentPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); @@ -376,10 +384,12 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The name of the managed cluster resource. /// The name of the agent pool. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -387,7 +397,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, data, ifMatch, ifNoneMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -405,10 +415,12 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re /// The name of the managed cluster resource. /// The name of the agent pool. /// The agent pool to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -416,7 +428,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, data, ifMatch, ifNoneMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -428,7 +440,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -441,10 +453,14 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/agentPools/", false); uri.AppendPath(agentPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (ignorePodDisruptionBudget != null) + { + uri.AppendQuery("ignore-pod-disruption-budget", ignorePodDisruptionBudget.Value, true); + } return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -460,7 +476,15 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/agentPools/", false); uri.AppendPath(agentPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (ignorePodDisruptionBudget != null) + { + uri.AppendQuery("ignore-pod-disruption-budget", ignorePodDisruptionBudget.Value, true); + } request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; @@ -471,17 +495,19 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The name of the agent pool. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = null, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -498,17 +524,19 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The name of the agent pool. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = null, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -626,6 +654,106 @@ public Response GetUpgradeProfile(string subscripti } } + internal RequestUriBuilder CreateDeleteMachinesRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, AgentPoolDeleteMachinesParameter machines) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/deleteMachines", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteMachinesRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, AgentPoolDeleteMachinesParameter machines) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/deleteMachines", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(machines, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Deletes specific machines in an agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// A list of machines from the agent pool to be deleted. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteMachinesAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, AgentPoolDeleteMachinesParameter machines, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNull(machines, nameof(machines)); + + using var message = CreateDeleteMachinesRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, machines); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific machines in an agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// A list of machines from the agent pool to be deleted. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response DeleteMachines(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, AgentPoolDeleteMachinesParameter machines, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNull(machines, nameof(machines)); + + using var message = CreateDeleteMachinesRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, machines); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateGetAvailableAgentPoolVersionsRequestUri(string subscriptionId, string resourceGroupName, string resourceName) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ContainerServiceRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ContainerServiceRestOperations.cs new file mode 100644 index 000000000000..34e662de0093 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ContainerServiceRestOperations.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; + +namespace Azure.ResourceManager.ContainerService +{ + internal partial class ContainerServiceRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ContainerServiceRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ContainerServiceRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-02-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListNodeImageVersionsRequestUri(string subscriptionId, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/nodeImageVersions", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListNodeImageVersionsRequest(string subscriptionId, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/nodeImageVersions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Only returns the latest version of each node image. For example there may be an AKSUbuntu-1804gen2containerd-2024.01.26, but only AKSUbuntu-1804gen2containerd-2024.02.02 is visible in this list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNodeImageVersionsAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNodeImageVersionsRequest(subscriptionId, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NodeImageVersionsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NodeImageVersionsListResult.DeserializeNodeImageVersionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Only returns the latest version of each node image. For example there may be an AKSUbuntu-1804gen2containerd-2024.01.26, but only AKSUbuntu-1804gen2containerd-2024.02.02 is visible in this list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNodeImageVersions(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNodeImageVersionsRequest(subscriptionId, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NodeImageVersionsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NodeImageVersionsListResult.DeserializeNodeImageVersionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNodeImageVersionsNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNodeImageVersionsNextPageRequest(string nextLink, string subscriptionId, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Only returns the latest version of each node image. For example there may be an AKSUbuntu-1804gen2containerd-2024.01.26, but only AKSUbuntu-1804gen2containerd-2024.02.02 is visible in this list. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNodeImageVersionsNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNodeImageVersionsNextPageRequest(nextLink, subscriptionId, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NodeImageVersionsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NodeImageVersionsListResult.DeserializeNodeImageVersionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Only returns the latest version of each node image. For example there may be an AKSUbuntu-1804gen2containerd-2024.01.26, but only AKSUbuntu-1804gen2containerd-2024.02.02 is visible in this list. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNodeImageVersionsNextPage(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNodeImageVersionsNextPageRequest(nextLink, subscriptionId, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NodeImageVersionsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NodeImageVersionsListResult.DeserializeNodeImageVersionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/LoadBalancersRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/LoadBalancersRestOperations.cs new file mode 100644 index 000000000000..72ceb6d1bb2c --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/LoadBalancersRestOperations.cs @@ -0,0 +1,523 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; + +namespace Azure.ResourceManager.ContainerService +{ + internal partial class LoadBalancersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of LoadBalancersRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public LoadBalancersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-02-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListByManagedClusterRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/loadBalancers", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByManagedClusterRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/loadBalancers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of load balancers in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByManagedClusterAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByManagedClusterRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LoadBalancerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of load balancers in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByManagedCluster(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByManagedClusterRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LoadBalancerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/loadBalancers/", false); + uri.AppendPath(loadBalancerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/loadBalancers/", false); + uri.AppendPath(loadBalancerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified load balancer. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the load balancer. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, loadBalancerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LoadBalancerData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = LoadBalancerData.DeserializeLoadBalancerData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((LoadBalancerData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified load balancer. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the load balancer. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, loadBalancerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LoadBalancerData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = LoadBalancerData.DeserializeLoadBalancerData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((LoadBalancerData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName, LoadBalancerData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/loadBalancers/", false); + uri.AppendPath(loadBalancerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName, LoadBalancerData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/loadBalancers/", false); + uri.AppendPath(loadBalancerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a load balancer in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the load balancer. + /// The load balancer to create or update. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName, LoadBalancerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, loadBalancerName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + LoadBalancerData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = LoadBalancerData.DeserializeLoadBalancerData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a load balancer in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the load balancer. + /// The load balancer to create or update. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName, LoadBalancerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, loadBalancerName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + LoadBalancerData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = LoadBalancerData.DeserializeLoadBalancerData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/loadBalancers/", false); + uri.AppendPath(loadBalancerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/loadBalancers/", false); + uri.AppendPath(loadBalancerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a load balancer in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the load balancer. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, loadBalancerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a load balancer in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the load balancer. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, string loadBalancerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, loadBalancerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByManagedClusterNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByManagedClusterNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of load balancers in the specified managed cluster. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByManagedClusterNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByManagedClusterNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LoadBalancerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of load balancers in the specified managed cluster. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByManagedClusterNextPage(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByManagedClusterNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LoadBalancerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MachinesRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MachinesRestOperations.cs new file mode 100644 index 000000000000..12707ed9bbf6 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MachinesRestOperations.cs @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; + +namespace Azure.ResourceManager.ContainerService +{ + internal partial class MachinesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of MachinesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public MachinesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-02-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/machines", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/machines", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of machines in the specified agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MachineListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MachineListResult.DeserializeMachineListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of machines in the specified agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MachineListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MachineListResult.DeserializeMachineListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string machineName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/machines/", false); + uri.AppendPath(machineName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string machineName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/machines/", false); + uri.AppendPath(machineName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a specific machine in the specified agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// host name of the machine. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, machineName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MachineData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MachineData.DeserializeMachineData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MachineData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a specific machine in the specified agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// host name of the machine. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string machineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, machineName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MachineData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MachineData.DeserializeMachineData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MachineData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of machines in the specified agent pool. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName, agentPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MachineListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MachineListResult.DeserializeMachineListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of machines in the specified agent pool. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName, agentPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MachineListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MachineListResult.DeserializeMachineListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs index 85c36138e890..d80b586d479a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs @@ -32,7 +32,7 @@ public MaintenanceConfigurationsRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-02-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClusterSnapshotsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClusterSnapshotsRestOperations.cs new file mode 100644 index 000000000000..3140408ef9d0 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClusterSnapshotsRestOperations.cs @@ -0,0 +1,741 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; + +namespace Azure.ResourceManager.ContainerService +{ + internal partial class ManagedClusterSnapshotsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ManagedClusterSnapshotsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ManagedClusterSnapshotsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-02-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of managed cluster snapshots in the specified subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedClusterSnapshotListResult.DeserializeManagedClusterSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of managed cluster snapshots in the specified subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedClusterSnapshotListResult.DeserializeManagedClusterSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists managed cluster snapshots in the specified subscription and resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedClusterSnapshotListResult.DeserializeManagedClusterSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists managed cluster snapshots in the specified subscription and resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedClusterSnapshotListResult.DeserializeManagedClusterSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a managed cluster snapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedClusterSnapshotData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a managed cluster snapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedClusterSnapshotData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterSnapshotData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterSnapshotData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a managed cluster snapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The managed cluster snapshot to create or update. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagedClusterSnapshotData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a managed cluster snapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The managed cluster snapshot to create or update. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagedClusterSnapshotData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateTagsRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(containerServiceTagsObject, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates tags on a managed cluster snapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// Parameters supplied to the Update managed cluster snapshot Tags operation. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateTagsAsync(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates tags on a managed cluster snapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// Parameters supplied to the Update managed cluster snapshot Tags operation. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateTags(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclustersnapshots/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a managed cluster snapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a managed cluster snapshot. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of managed cluster snapshots in the specified subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedClusterSnapshotListResult.DeserializeManagedClusterSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of managed cluster snapshots in the specified subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedClusterSnapshotListResult.DeserializeManagedClusterSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists managed cluster snapshots in the specified subscription and resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedClusterSnapshotListResult.DeserializeManagedClusterSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists managed cluster snapshots in the specified subscription and resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterSnapshotListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedClusterSnapshotListResult.DeserializeManagedClusterSnapshotListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs index cd05eefd8423..4fb814434d4a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs @@ -32,108 +32,10 @@ public ManagedClustersRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-02-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetOSOptionsRequestUri(string subscriptionId, AzureLocation location, ResourceType? resourceType) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/osOptions/default", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (resourceType != null) - { - uri.AppendQuery("resource-type", resourceType.Value, true); - } - return uri; - } - - internal HttpMessage CreateGetOSOptionsRequest(string subscriptionId, AzureLocation location, ResourceType? resourceType) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/osOptions/default", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (resourceType != null) - { - uri.AppendQuery("resource-type", resourceType.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets supported OS options in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The resource type for which the OS options needs to be returned. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> GetOSOptionsAsync(string subscriptionId, AzureLocation location, ResourceType? resourceType = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateGetOSOptionsRequest(subscriptionId, location, resourceType); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OSOptionProfileData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OSOptionProfileData.DeserializeOSOptionProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((OSOptionProfileData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets supported OS options in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The resource type for which the OS options needs to be returned. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response GetOSOptions(string subscriptionId, AzureLocation location, ResourceType? resourceType = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateGetOSOptionsRequest(subscriptionId, location, resourceType); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OSOptionProfileData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OSOptionProfileData.DeserializeOSOptionProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((OSOptionProfileData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - internal RequestUriBuilder CreateListKubernetesVersionsRequestUri(string subscriptionId, AzureLocation location) { var uri = new RawRequestUriBuilder(); @@ -1000,7 +902,7 @@ public Response Get(string subscriptionId, s } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, string ifMatch, string ifNoneMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1014,7 +916,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, string ifMatch, string ifNoneMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1029,6 +931,14 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(resourceName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); @@ -1043,17 +953,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The managed cluster to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data, ifMatch, ifNoneMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1070,17 +982,19 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The managed cluster to create or update. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data, ifMatch, ifNoneMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1092,7 +1006,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } - internal RequestUriBuilder CreateUpdateTagsRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject) + internal RequestUriBuilder CreateUpdateTagsRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1106,7 +1020,7 @@ internal RequestUriBuilder CreateUpdateTagsRequestUri(string subscriptionId, str return uri; } - internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject) + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1121,6 +1035,10 @@ internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resou uri.AppendPath(resourceName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); @@ -1135,17 +1053,18 @@ internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resou /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// Parameters supplied to the Update Managed Cluster Tags operation. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task UpdateTagsAsync(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + public async Task UpdateTagsAsync(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); - using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject); + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1161,17 +1080,18 @@ public async Task UpdateTagsAsync(string subscriptionId, string resour /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// Parameters supplied to the Update Managed Cluster Tags operation. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response UpdateTags(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + public Response UpdateTags(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); - using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject); + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1182,7 +1102,7 @@ public Response UpdateTags(string subscriptionId, string resourceGroupName, stri } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string ifMatch, bool? ignorePodDisruptionBudget) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1193,10 +1113,14 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); uri.AppendPath(resourceName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (ignorePodDisruptionBudget != null) + { + uri.AppendQuery("ignore-pod-disruption-budget", ignorePodDisruptionBudget.Value, true); + } return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string ifMatch, bool? ignorePodDisruptionBudget) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1210,7 +1134,15 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); uri.AppendPath(resourceName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (ignorePodDisruptionBudget != null) + { + uri.AppendQuery("ignore-pod-disruption-budget", ignorePodDisruptionBudget.Value, true); + } request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; @@ -1220,16 +1152,18 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. + /// The request should only proceed if an entity matches this string. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, string ifMatch = null, bool? ignorePodDisruptionBudget = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, ifMatch, ignorePodDisruptionBudget); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1245,16 +1179,18 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. + /// The request should only proceed if an entity matches this string. + /// ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, string ifMatch = null, bool? ignorePodDisruptionBudget = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, ifMatch, ignorePodDisruptionBudget); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1454,7 +1390,7 @@ public Response ResetAadProfile(string subscriptionId, string resourceGroupName, } } - internal RequestUriBuilder CreateRotateClusterCertificatesRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateAbortLatestOperationRequestUri(string subscriptionId, string resourceGroupName, string resourceName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1462,14 +1398,14 @@ internal RequestUriBuilder CreateRotateClusterCertificatesRequestUri(string subs uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclusters/", false); uri.AppendPath(resourceName, true); - uri.AppendPath("/rotateClusterCertificates", false); + uri.AppendPath("/abort", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateRotateClusterCertificatesRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateAbortLatestOperationRequest(string subscriptionId, string resourceGroupName, string resourceName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1480,9 +1416,9 @@ internal HttpMessage CreateRotateClusterCertificatesRequest(string subscriptionI uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath("/providers/Microsoft.ContainerService/managedclusters/", false); uri.AppendPath(resourceName, true); - uri.AppendPath("/rotateClusterCertificates", false); + uri.AppendPath("/abort", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1490,20 +1426,20 @@ internal HttpMessage CreateRotateClusterCertificatesRequest(string subscriptionI return message; } - /// See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. + /// Aborts the currently running operation on the managed cluster. The Managed Cluster will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, an error is returned. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task RotateClusterCertificatesAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + public async Task AbortLatestOperationAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var message = CreateRotateClusterCertificatesRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateAbortLatestOperationRequest(subscriptionId, resourceGroupName, resourceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1515,20 +1451,20 @@ public async Task RotateClusterCertificatesAsync(string subscriptionId } } - /// See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. + /// Aborts the currently running operation on the managed cluster. The Managed Cluster will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, an error is returned. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response RotateClusterCertificates(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + public Response AbortLatestOperation(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var message = CreateRotateClusterCertificatesRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateAbortLatestOperationRequest(subscriptionId, resourceGroupName, resourceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1540,7 +1476,7 @@ public Response RotateClusterCertificates(string subscriptionId, string resource } } - internal RequestUriBuilder CreateAbortLatestOperationRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateRotateClusterCertificatesRequestUri(string subscriptionId, string resourceGroupName, string resourceName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1548,14 +1484,14 @@ internal RequestUriBuilder CreateAbortLatestOperationRequestUri(string subscript uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/managedclusters/", false); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); uri.AppendPath(resourceName, true); - uri.AppendPath("/abort", false); + uri.AppendPath("/rotateClusterCertificates", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateAbortLatestOperationRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateRotateClusterCertificatesRequest(string subscriptionId, string resourceGroupName, string resourceName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1566,9 +1502,9 @@ internal HttpMessage CreateAbortLatestOperationRequest(string subscriptionId, st uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/managedclusters/", false); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); uri.AppendPath(resourceName, true); - uri.AppendPath("/abort", false); + uri.AppendPath("/rotateClusterCertificates", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1576,20 +1512,20 @@ internal HttpMessage CreateAbortLatestOperationRequest(string subscriptionId, st return message; } - /// Aborts the currently running operation on the managed cluster. The Managed Cluster will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, a 409 error code is returned. + /// See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task AbortLatestOperationAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + public async Task RotateClusterCertificatesAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var message = CreateAbortLatestOperationRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateRotateClusterCertificatesRequest(subscriptionId, resourceGroupName, resourceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1601,20 +1537,20 @@ public async Task AbortLatestOperationAsync(string subscriptionId, str } } - /// Aborts the currently running operation on the managed cluster. The Managed Cluster will be moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes before cancellation can take place, a 409 error code is returned. + /// See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the managed cluster resource. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response AbortLatestOperation(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + public Response RotateClusterCertificates(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var message = CreateAbortLatestOperationRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateRotateClusterCertificatesRequest(subscriptionId, resourceGroupName, resourceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -2176,7 +2112,7 @@ public Response ListOutboundNetworkDepend } } - internal RequestUriBuilder CreateListMeshRevisionProfilesRequestUri(string subscriptionId, AzureLocation location) + internal RequestUriBuilder CreateGetGuardrailsVersionsRequestUri(string subscriptionId, AzureLocation location, string version) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -2184,12 +2120,13 @@ internal RequestUriBuilder CreateListMeshRevisionProfilesRequestUri(string subsc uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/meshRevisionProfiles", false); + uri.AppendPath("/guardrailsVersions/", false); + uri.AppendPath(version, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListMeshRevisionProfilesRequest(string subscriptionId, AzureLocation location) + internal HttpMessage CreateGetGuardrailsVersionsRequest(string subscriptionId, AzureLocation location, string version) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2200,7 +2137,8 @@ internal HttpMessage CreateListMeshRevisionProfilesRequest(string subscriptionId uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/meshRevisionProfiles", false); + uri.AppendPath("/guardrailsVersions/", false); + uri.AppendPath(version, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -2208,59 +2146,67 @@ internal HttpMessage CreateListMeshRevisionProfilesRequest(string subscriptionId return message; } - /// Contains extra metadata on each revision, including supported revisions, cluster compatibility and available upgrades. + /// Contains Guardrails version along with its support info and whether it is a default version. /// The ID of the target subscription. The value must be an UUID. /// The name of the Azure region. + /// Safeguards version. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListMeshRevisionProfilesAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetGuardrailsVersionsAsync(string subscriptionId, AzureLocation location, string version, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(version, nameof(version)); - using var message = CreateListMeshRevisionProfilesRequest(subscriptionId, location); + using var message = CreateGetGuardrailsVersionsRequest(subscriptionId, location, version); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - MeshRevisionProfileList value = default; + GuardrailsAvailableVersionData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = MeshRevisionProfileList.DeserializeMeshRevisionProfileList(document.RootElement); + value = GuardrailsAvailableVersionData.DeserializeGuardrailsAvailableVersionData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((GuardrailsAvailableVersionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Contains extra metadata on each revision, including supported revisions, cluster compatibility and available upgrades. + /// Contains Guardrails version along with its support info and whether it is a default version. /// The ID of the target subscription. The value must be an UUID. /// The name of the Azure region. + /// Safeguards version. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListMeshRevisionProfiles(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response GetGuardrailsVersions(string subscriptionId, AzureLocation location, string version, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(version, nameof(version)); - using var message = CreateListMeshRevisionProfilesRequest(subscriptionId, location); + using var message = CreateGetGuardrailsVersionsRequest(subscriptionId, location, version); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - MeshRevisionProfileList value = default; + GuardrailsAvailableVersionData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = MeshRevisionProfileList.DeserializeMeshRevisionProfileList(document.RootElement); + value = GuardrailsAvailableVersionData.DeserializeGuardrailsAvailableVersionData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((GuardrailsAvailableVersionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetMeshRevisionProfileRequestUri(string subscriptionId, AzureLocation location, string mode) + internal RequestUriBuilder CreateListGuardrailsVersionsRequestUri(string subscriptionId, AzureLocation location) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -2268,13 +2214,12 @@ internal RequestUriBuilder CreateGetMeshRevisionProfileRequestUri(string subscri uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/meshRevisionProfiles/", false); - uri.AppendPath(mode, true); + uri.AppendPath("/guardrailsVersions", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetMeshRevisionProfileRequest(string subscriptionId, AzureLocation location, string mode) + internal HttpMessage CreateListGuardrailsVersionsRequest(string subscriptionId, AzureLocation location) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2285,8 +2230,7 @@ internal HttpMessage CreateGetMeshRevisionProfileRequest(string subscriptionId, uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/meshRevisionProfiles/", false); - uri.AppendPath(mode, true); + uri.AppendPath("/guardrailsVersions", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -2294,82 +2238,73 @@ internal HttpMessage CreateGetMeshRevisionProfileRequest(string subscriptionId, return message; } - /// Contains extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades. + /// Contains list of Guardrails version along with its support info and whether it is a default version. /// The ID of the target subscription. The value must be an UUID. /// The name of the Azure region. - /// The mode of the mesh. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> GetMeshRevisionProfileAsync(string subscriptionId, AzureLocation location, string mode, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListGuardrailsVersionsAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - using var message = CreateGetMeshRevisionProfileRequest(subscriptionId, location, mode); + using var message = CreateListGuardrailsVersionsRequest(subscriptionId, location); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - MeshRevisionProfileData value = default; + GuardrailsAvailableVersionsList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = MeshRevisionProfileData.DeserializeMeshRevisionProfileData(document.RootElement); + value = GuardrailsAvailableVersionsList.DeserializeGuardrailsAvailableVersionsList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((MeshRevisionProfileData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Contains extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades. + /// Contains list of Guardrails version along with its support info and whether it is a default version. /// The ID of the target subscription. The value must be an UUID. /// The name of the Azure region. - /// The mode of the mesh. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response GetMeshRevisionProfile(string subscriptionId, AzureLocation location, string mode, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListGuardrailsVersions(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - using var message = CreateGetMeshRevisionProfileRequest(subscriptionId, location, mode); + using var message = CreateListGuardrailsVersionsRequest(subscriptionId, location); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - MeshRevisionProfileData value = default; + GuardrailsAvailableVersionsList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = MeshRevisionProfileData.DeserializeMeshRevisionProfileData(document.RootElement); + value = GuardrailsAvailableVersionsList.DeserializeGuardrailsAvailableVersionsList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((MeshRevisionProfileData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListMeshUpgradeProfilesRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateGetSafeguardsVersionsRequestUri(string subscriptionId, AzureLocation location, string version) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); - uri.AppendPath(resourceName, true); - uri.AppendPath("/meshUpgradeProfiles", false); + uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/safeguardsVersions/", false); + uri.AppendPath(version, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListMeshUpgradeProfilesRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateGetSafeguardsVersionsRequest(string subscriptionId, AzureLocation location, string version) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2378,11 +2313,10 @@ internal HttpMessage CreateListMeshUpgradeProfilesRequest(string subscriptionId, uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); - uri.AppendPath(resourceName, true); - uri.AppendPath("/meshUpgradeProfiles", false); + uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/safeguardsVersions/", false); + uri.AppendPath(version, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -2390,81 +2324,80 @@ internal HttpMessage CreateListMeshUpgradeProfilesRequest(string subscriptionId, return message; } - /// Lists available upgrades for all service meshes in a specific cluster. + /// Contains Safeguards version along with its support info and whether it is a default version. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Azure region. + /// Safeguards version. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListMeshUpgradeProfilesAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetSafeguardsVersionsAsync(string subscriptionId, AzureLocation location, string version, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(version, nameof(version)); - using var message = CreateListMeshUpgradeProfilesRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateGetSafeguardsVersionsRequest(subscriptionId, location, version); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - MeshUpgradeProfileList value = default; + SafeguardsAvailableVersionData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = MeshUpgradeProfileList.DeserializeMeshUpgradeProfileList(document.RootElement); + value = SafeguardsAvailableVersionData.DeserializeSafeguardsAvailableVersionData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((SafeguardsAvailableVersionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Lists available upgrades for all service meshes in a specific cluster. + /// Contains Safeguards version along with its support info and whether it is a default version. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Azure region. + /// Safeguards version. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListMeshUpgradeProfiles(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response GetSafeguardsVersions(string subscriptionId, AzureLocation location, string version, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(version, nameof(version)); - using var message = CreateListMeshUpgradeProfilesRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateGetSafeguardsVersionsRequest(subscriptionId, location, version); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - MeshUpgradeProfileList value = default; + SafeguardsAvailableVersionData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = MeshUpgradeProfileList.DeserializeMeshUpgradeProfileList(document.RootElement); + value = SafeguardsAvailableVersionData.DeserializeSafeguardsAvailableVersionData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((SafeguardsAvailableVersionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetMeshUpgradeProfileRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string mode) + internal RequestUriBuilder CreateListSafeguardsVersionsRequestUri(string subscriptionId, AzureLocation location) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); - uri.AppendPath(resourceName, true); - uri.AppendPath("/meshUpgradeProfiles/", false); - uri.AppendPath(mode, true); + uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/safeguardsVersions", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetMeshUpgradeProfileRequest(string subscriptionId, string resourceGroupName, string resourceName, string mode) + internal HttpMessage CreateListSafeguardsVersionsRequest(string subscriptionId, AzureLocation location) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2473,12 +2406,9 @@ internal HttpMessage CreateGetMeshUpgradeProfileRequest(string subscriptionId, s uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); - uri.AppendPath(resourceName, true); - uri.AppendPath("/meshUpgradeProfiles/", false); - uri.AppendPath(mode, true); + uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/safeguardsVersions", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -2486,19 +2416,381 @@ internal HttpMessage CreateGetMeshUpgradeProfileRequest(string subscriptionId, s return message; } - /// Gets available upgrades for a service mesh in a cluster. + /// Contains list of Safeguards version along with its support info and whether it is a default version. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The mode of the mesh. + /// The name of the Azure region. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetMeshUpgradeProfileAsync(string subscriptionId, string resourceGroupName, string resourceName, string mode, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListSafeguardsVersionsAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListSafeguardsVersionsRequest(subscriptionId, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SafeguardsAvailableVersionsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SafeguardsAvailableVersionsList.DeserializeSafeguardsAvailableVersionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Contains list of Safeguards version along with its support info and whether it is a default version. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListSafeguardsVersions(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListSafeguardsVersionsRequest(subscriptionId, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SafeguardsAvailableVersionsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SafeguardsAvailableVersionsList.DeserializeSafeguardsAvailableVersionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListMeshRevisionProfilesRequestUri(string subscriptionId, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/meshRevisionProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListMeshRevisionProfilesRequest(string subscriptionId, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/meshRevisionProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Contains extra metadata on each revision, including supported revisions, cluster compatibility and available upgrades. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListMeshRevisionProfilesAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListMeshRevisionProfilesRequest(subscriptionId, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MeshRevisionProfileList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MeshRevisionProfileList.DeserializeMeshRevisionProfileList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Contains extra metadata on each revision, including supported revisions, cluster compatibility and available upgrades. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListMeshRevisionProfiles(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListMeshRevisionProfilesRequest(subscriptionId, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MeshRevisionProfileList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MeshRevisionProfileList.DeserializeMeshRevisionProfileList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetMeshRevisionProfileRequestUri(string subscriptionId, AzureLocation location, string mode) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/meshRevisionProfiles/", false); + uri.AppendPath(mode, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetMeshRevisionProfileRequest(string subscriptionId, AzureLocation location, string mode) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/meshRevisionProfiles/", false); + uri.AppendPath(mode, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Contains extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The mode of the mesh. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetMeshRevisionProfileAsync(string subscriptionId, AzureLocation location, string mode, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(mode, nameof(mode)); + + using var message = CreateGetMeshRevisionProfileRequest(subscriptionId, location, mode); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MeshRevisionProfileData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MeshRevisionProfileData.DeserializeMeshRevisionProfileData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MeshRevisionProfileData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Contains extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The mode of the mesh. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response GetMeshRevisionProfile(string subscriptionId, AzureLocation location, string mode, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(mode, nameof(mode)); + + using var message = CreateGetMeshRevisionProfileRequest(subscriptionId, location, mode); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MeshRevisionProfileData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MeshRevisionProfileData.DeserializeMeshRevisionProfileData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MeshRevisionProfileData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListMeshUpgradeProfilesRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/meshUpgradeProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListMeshUpgradeProfilesRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/meshUpgradeProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists available upgrades for all service meshes in a specific cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListMeshUpgradeProfilesAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListMeshUpgradeProfilesRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MeshUpgradeProfileList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MeshUpgradeProfileList.DeserializeMeshUpgradeProfileList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists available upgrades for all service meshes in a specific cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListMeshUpgradeProfiles(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListMeshUpgradeProfilesRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MeshUpgradeProfileList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MeshUpgradeProfileList.DeserializeMeshUpgradeProfileList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetMeshUpgradeProfileRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string mode) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/meshUpgradeProfiles/", false); + uri.AppendPath(mode, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetMeshUpgradeProfileRequest(string subscriptionId, string resourceGroupName, string resourceName, string mode) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/meshUpgradeProfiles/", false); + uri.AppendPath(mode, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets available upgrades for a service mesh in a cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The mode of the mesh. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetMeshUpgradeProfileAsync(string subscriptionId, string resourceGroupName, string resourceName, string mode, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNullOrEmpty(mode, nameof(mode)); using var message = CreateGetMeshUpgradeProfileRequest(subscriptionId, resourceGroupName, resourceName, mode); @@ -2552,6 +2844,98 @@ public Response GetMeshUpgradeProfile(string subscriptio } } + internal RequestUriBuilder CreateRebalanceLoadBalancersRequestUri(string subscriptionId, string resourceGroupName, string resourceName, RebalanceLoadBalancersRequestBody rebalanceLoadBalancersRequestBody) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/rebalanceLoadBalancers", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateRebalanceLoadBalancersRequest(string subscriptionId, string resourceGroupName, string resourceName, RebalanceLoadBalancersRequestBody rebalanceLoadBalancersRequestBody) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/rebalanceLoadBalancers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(rebalanceLoadBalancersRequestBody, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Rebalance nodes across specific load balancers. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The names of the load balancers to be rebalanced. If set to empty, all load balancers will be rebalanced. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task RebalanceLoadBalancersAsync(string subscriptionId, string resourceGroupName, string resourceName, RebalanceLoadBalancersRequestBody rebalanceLoadBalancersRequestBody, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(rebalanceLoadBalancersRequestBody, nameof(rebalanceLoadBalancersRequestBody)); + + using var message = CreateRebalanceLoadBalancersRequest(subscriptionId, resourceGroupName, resourceName, rebalanceLoadBalancersRequestBody); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Rebalance nodes across specific load balancers. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The names of the load balancers to be rebalanced. If set to empty, all load balancers will be rebalanced. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response RebalanceLoadBalancers(string subscriptionId, string resourceGroupName, string resourceName, RebalanceLoadBalancersRequestBody rebalanceLoadBalancersRequestBody, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(rebalanceLoadBalancersRequestBody, nameof(rebalanceLoadBalancersRequestBody)); + + using var message = CreateRebalanceLoadBalancersRequest(subscriptionId, resourceGroupName, resourceName, rebalanceLoadBalancersRequestBody); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId) { var uri = new RawRequestUriBuilder(); @@ -2792,6 +3176,162 @@ public Response ListOutboundNetworkDepend } } + internal RequestUriBuilder CreateListGuardrailsVersionsNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListGuardrailsVersionsNextPageRequest(string nextLink, string subscriptionId, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Contains list of Guardrails version along with its support info and whether it is a default version. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListGuardrailsVersionsNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListGuardrailsVersionsNextPageRequest(nextLink, subscriptionId, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GuardrailsAvailableVersionsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = GuardrailsAvailableVersionsList.DeserializeGuardrailsAvailableVersionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Contains list of Guardrails version along with its support info and whether it is a default version. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListGuardrailsVersionsNextPage(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListGuardrailsVersionsNextPageRequest(nextLink, subscriptionId, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GuardrailsAvailableVersionsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = GuardrailsAvailableVersionsList.DeserializeGuardrailsAvailableVersionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListSafeguardsVersionsNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListSafeguardsVersionsNextPageRequest(string nextLink, string subscriptionId, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Contains list of Safeguards version along with its support info and whether it is a default version. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListSafeguardsVersionsNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListSafeguardsVersionsNextPageRequest(nextLink, subscriptionId, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SafeguardsAvailableVersionsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SafeguardsAvailableVersionsList.DeserializeSafeguardsAvailableVersionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Contains list of Safeguards version along with its support info and whether it is a default version. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListSafeguardsVersionsNextPage(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListSafeguardsVersionsNextPageRequest(nextLink, subscriptionId, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SafeguardsAvailableVersionsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SafeguardsAvailableVersionsList.DeserializeSafeguardsAvailableVersionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateListMeshRevisionProfilesNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/NamespacesRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/NamespacesRestOperations.cs new file mode 100644 index 000000000000..009159781445 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/NamespacesRestOperations.cs @@ -0,0 +1,723 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; + +namespace Azure.ResourceManager.ContainerService +{ + internal partial class NamespacesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NamespacesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public NamespacesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-02-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListByManagedClusterRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByManagedClusterRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of managed namespaces in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByManagedClusterAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByManagedClusterRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NamespaceListResult.DeserializeNamespaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of managed namespaces in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByManagedCluster(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByManagedClusterRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NamespaceListResult.DeserializeNamespaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified namespace of a managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the namespace. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, namespaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespaceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NamespaceData.DeserializeNamespaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NamespaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified namespace of a managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the namespace. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, namespaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespaceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NamespaceData.DeserializeNamespaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NamespaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, NamespaceData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, NamespaceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a namespace in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the namespace. + /// The namespace to create or update. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, NamespaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, namespaceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a namespace in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the namespace. + /// The namespace to create or update. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, NamespaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, namespaceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a namespace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the namespace. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, namespaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a namespace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the namespace. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, namespaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, ContainerServiceTagsObject containerServiceTagsObject) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, ContainerServiceTagsObject containerServiceTagsObject) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(containerServiceTagsObject, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates tags on a namespace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the namespace. + /// Parameters supplied to the patch namespace operation, we only support patch tags for now. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, resourceName, namespaceName, containerServiceTagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespaceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NamespaceData.DeserializeNamespaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates tags on a namespace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the namespace. + /// Parameters supplied to the patch namespace operation, we only support patch tags for now. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, resourceName, namespaceName, containerServiceTagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespaceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NamespaceData.DeserializeNamespaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListCredentialRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/listCredential", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListCredentialRequest(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/listCredential", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the credentials of a namespace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the namespace. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListCredentialAsync(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListCredentialRequest(subscriptionId, resourceGroupName, resourceName, namespaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterCredentials value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedClusterCredentials.DeserializeManagedClusterCredentials(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the credentials of a namespace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the namespace. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListCredential(string subscriptionId, string resourceGroupName, string resourceName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListCredentialRequest(subscriptionId, resourceGroupName, resourceName, namespaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedClusterCredentials value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedClusterCredentials.DeserializeManagedClusterCredentials(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByManagedClusterNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByManagedClusterNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of managed namespaces in the specified managed cluster. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByManagedClusterNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByManagedClusterNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NamespaceListResult.DeserializeNamespaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of managed namespaces in the specified managed cluster. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByManagedClusterNextPage(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListByManagedClusterNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NamespaceListResult.DeserializeNamespaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/OperationStatusResultRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/OperationStatusResultRestOperations.cs new file mode 100644 index 000000000000..f4d818f75d79 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/OperationStatusResultRestOperations.cs @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; + +namespace Azure.ResourceManager.ContainerService +{ + internal partial class OperationStatusResultRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OperationStatusResultRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public OperationStatusResultRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-02-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/operations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/operations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of operations in the specified managedCluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationStatusResultList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OperationStatusResultList.DeserializeOperationStatusResultList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of operations in the specified managedCluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationStatusResultList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OperationStatusResultList.DeserializeOperationStatusResultList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string operationId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the status of a specific operation in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string resourceName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationStatusResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OperationStatusResult.DeserializeOperationStatusResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the status of a specific operation in the specified managed cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string resourceName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationStatusResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OperationStatusResult.DeserializeOperationStatusResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetByAgentPoolRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string operationId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetByAgentPoolRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/managedClusters/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/agentPools/", false); + uri.AppendPath(agentPoolName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the status of a specific operation in the specified agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetByAgentPoolAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetByAgentPoolRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationStatusResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OperationStatusResult.DeserializeOperationStatusResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the status of a specific operation in the specified agent pool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The name of the agent pool. + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetByAgentPool(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetByAgentPoolRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationStatusResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OperationStatusResult.DeserializeOperationStatusResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of operations in the specified managedCluster. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationStatusResultList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OperationStatusResultList.DeserializeOperationStatusResultList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of operations in the specified managedCluster. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationStatusResultList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OperationStatusResultList.DeserializeOperationStatusResultList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 69d51fb6d1d0..127ae561c537 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -32,7 +32,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-02-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index b7313ad968ed..6bceed8d621b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -32,7 +32,7 @@ public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-02-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs index f7680dc72cdc..41aaf4ca14f3 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs @@ -32,7 +32,7 @@ public ResolvePrivateLinkServiceIdRestOperations(HttpPipeline pipeline, string a { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-02-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs index 54f88932263d..40d978f972df 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs @@ -32,7 +32,7 @@ public SnapshotsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-02-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs index 0ac7e97fa71c..12fb910e0504 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs @@ -32,7 +32,7 @@ public TrustedAccessRoleBindingsRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-02-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs index 5e561646f440..96a3a8f751b2 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs @@ -32,7 +32,7 @@ public TrustedAccessRolesRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-02-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionCollection.cs new file mode 100644 index 000000000000..06aa9955bb84 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionCollection.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetSafeguardsAvailableVersions method from an instance of . + /// + public partial class SafeguardsAvailableVersionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _safeguardsAvailableVersionManagedClustersClientDiagnostics; + private readonly ManagedClustersRestOperations _safeguardsAvailableVersionManagedClustersRestClient; + private readonly AzureLocation _location; + + /// Initializes a new instance of the class for mocking. + protected SafeguardsAvailableVersionCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + /// The name of the Azure region. + internal SafeguardsAvailableVersionCollection(ArmClient client, ResourceIdentifier id, AzureLocation location) : base(client, id) + { + _location = location; + _safeguardsAvailableVersionManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", SafeguardsAvailableVersionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SafeguardsAvailableVersionResource.ResourceType, out string safeguardsAvailableVersionManagedClustersApiVersion); + _safeguardsAvailableVersionManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, safeguardsAvailableVersionManagedClustersApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Contains Safeguards version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _safeguardsAvailableVersionManagedClustersClientDiagnostics.CreateScope("SafeguardsAvailableVersionCollection.Get"); + scope.Start(); + try + { + var response = await _safeguardsAvailableVersionManagedClustersRestClient.GetSafeguardsVersionsAsync(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SafeguardsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Contains Safeguards version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _safeguardsAvailableVersionManagedClustersClientDiagnostics.CreateScope("SafeguardsAvailableVersionCollection.Get"); + scope.Start(); + try + { + var response = _safeguardsAvailableVersionManagedClustersRestClient.GetSafeguardsVersions(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SafeguardsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Contains list of Safeguards version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions + /// + /// + /// Operation Id + /// ManagedClusters_ListSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _safeguardsAvailableVersionManagedClustersRestClient.CreateListSafeguardsVersionsRequest(Id.SubscriptionId, new AzureLocation(_location)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _safeguardsAvailableVersionManagedClustersRestClient.CreateListSafeguardsVersionsNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SafeguardsAvailableVersionResource(Client, SafeguardsAvailableVersionData.DeserializeSafeguardsAvailableVersionData(e)), _safeguardsAvailableVersionManagedClustersClientDiagnostics, Pipeline, "SafeguardsAvailableVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Contains list of Safeguards version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions + /// + /// + /// Operation Id + /// ManagedClusters_ListSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _safeguardsAvailableVersionManagedClustersRestClient.CreateListSafeguardsVersionsRequest(Id.SubscriptionId, new AzureLocation(_location)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _safeguardsAvailableVersionManagedClustersRestClient.CreateListSafeguardsVersionsNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SafeguardsAvailableVersionResource(Client, SafeguardsAvailableVersionData.DeserializeSafeguardsAvailableVersionData(e)), _safeguardsAvailableVersionManagedClustersClientDiagnostics, Pipeline, "SafeguardsAvailableVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _safeguardsAvailableVersionManagedClustersClientDiagnostics.CreateScope("SafeguardsAvailableVersionCollection.Exists"); + scope.Start(); + try + { + var response = await _safeguardsAvailableVersionManagedClustersRestClient.GetSafeguardsVersionsAsync(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _safeguardsAvailableVersionManagedClustersClientDiagnostics.CreateScope("SafeguardsAvailableVersionCollection.Exists"); + scope.Start(); + try + { + var response = _safeguardsAvailableVersionManagedClustersRestClient.GetSafeguardsVersions(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _safeguardsAvailableVersionManagedClustersClientDiagnostics.CreateScope("SafeguardsAvailableVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _safeguardsAvailableVersionManagedClustersRestClient.GetSafeguardsVersionsAsync(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SafeguardsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Safeguards version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _safeguardsAvailableVersionManagedClustersClientDiagnostics.CreateScope("SafeguardsAvailableVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _safeguardsAvailableVersionManagedClustersRestClient.GetSafeguardsVersions(Id.SubscriptionId, new AzureLocation(_location), version, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SafeguardsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionData.Serialization.cs new file mode 100644 index 000000000000..e61071904eb2 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionData.Serialization.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class SafeguardsAvailableVersionData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + + SafeguardsAvailableVersionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSafeguardsAvailableVersionData(document.RootElement, options); + } + + internal static SafeguardsAvailableVersionData DeserializeSafeguardsAvailableVersionData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SafeguardsAvailableVersionsProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = SafeguardsAvailableVersionsProperties.DeserializeSafeguardsAvailableVersionsProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SafeguardsAvailableVersionData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionData)} does not support writing '{options.Format}' format."); + } + } + + SafeguardsAvailableVersionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSafeguardsAvailableVersionData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SafeguardsAvailableVersionData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionData.cs new file mode 100644 index 000000000000..62b21ff171ad --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionData.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A class representing the SafeguardsAvailableVersion data model. + /// Available Safeguards Version + /// + public partial class SafeguardsAvailableVersionData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Whether the version is default or not and support info. + /// is null. + public SafeguardsAvailableVersionData(SafeguardsAvailableVersionsProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Whether the version is default or not and support info. + /// Keeps track of any properties unknown to the library. + internal SafeguardsAvailableVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SafeguardsAvailableVersionsProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SafeguardsAvailableVersionData() + { + } + + /// Whether the version is default or not and support info. + [WirePath("properties")] + public SafeguardsAvailableVersionsProperties Properties { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionResource.Serialization.cs new file mode 100644 index 000000000000..1198cdcfb60b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.ContainerService +{ + public partial class SafeguardsAvailableVersionResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SafeguardsAvailableVersionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SafeguardsAvailableVersionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionResource.cs new file mode 100644 index 000000000000..4f5f36639896 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/SafeguardsAvailableVersionResource.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A Class representing a SafeguardsAvailableVersion along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSafeguardsAvailableVersionResource method. + /// Otherwise you can get one from its parent resource using the GetSafeguardsAvailableVersion method. + /// + public partial class SafeguardsAvailableVersionResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The version. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string version) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _safeguardsAvailableVersionManagedClustersClientDiagnostics; + private readonly ManagedClustersRestOperations _safeguardsAvailableVersionManagedClustersRestClient; + private readonly SafeguardsAvailableVersionData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/locations/safeguardsVersions"; + + /// Initializes a new instance of the class for mocking. + protected SafeguardsAvailableVersionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SafeguardsAvailableVersionResource(ArmClient client, SafeguardsAvailableVersionData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SafeguardsAvailableVersionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _safeguardsAvailableVersionManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string safeguardsAvailableVersionManagedClustersApiVersion); + _safeguardsAvailableVersionManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, safeguardsAvailableVersionManagedClustersApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SafeguardsAvailableVersionData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Contains Safeguards version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _safeguardsAvailableVersionManagedClustersClientDiagnostics.CreateScope("SafeguardsAvailableVersionResource.Get"); + scope.Start(); + try + { + var response = await _safeguardsAvailableVersionManagedClustersRestClient.GetSafeguardsVersionsAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SafeguardsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Contains Safeguards version along with its support info and whether it is a default version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version} + /// + /// + /// Operation Id + /// ManagedClusters_GetSafeguardsVersions + /// + /// + /// Default Api Version + /// 2025-03-02-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _safeguardsAvailableVersionManagedClustersClientDiagnostics.CreateScope("SafeguardsAvailableVersionResource.Get"); + scope.Start(); + try + { + var response = _safeguardsAvailableVersionManagedClustersRestClient.GetSafeguardsVersions(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SafeguardsAvailableVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/autorest.md b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/autorest.md index c904c624099b..bb994b961d52 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/autorest.md +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: ContainerService namespace: Azure.ResourceManager.ContainerService -require: https://github.com/Azure/azure-rest-api-specs/blob/8e674dd2a88ae73868c6fa7593a0ba4371e45991/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md #tag: package-2023-10 output-folder: $(this-folder)/Generated clear-output-folder: true diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/